Safir SDK Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ConnectionBase.h
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * Copyright Saab AB, 2007-2013 (http://safir.sourceforge.net)
4 *
5 * Created by: Anders Widén / stawi
6 *
7 *******************************************************************************
8 *
9 * This file is part of Safir SDK Core.
10 *
11 * Safir SDK Core is free software: you can redistribute it and/or modify
12 * it under the terms of version 3 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * Safir SDK Core is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Safir SDK Core. If not, see <http://www.gnu.org/licenses/>.
22 *
23 ******************************************************************************/
24 
25 #ifndef _SAFIR_DOB_CONNECTION_BASE_H
26 #define _SAFIR_DOB_CONNECTION_BASE_H
27 
28 #include <Safir/Dob/Consumer.h>
29 #include <Safir/Dob/Defs.h>
31 #include <Safir/Dob/Entity.h>
33 #include <Safir/Dob/EntityProxy.h>
34 #include <Safir/Dob/Message.h>
35 #include <Safir/Dob/Response.h>
36 #include <Safir/Dob/Service.h>
41 
42 namespace Safir
43 {
44 namespace Dob
45 {
53  {
54  public:
55 
60 
64  virtual ~ConnectionBase();
65 
71  virtual bool IsOpen() const = 0;
72 
99  void RegisterEntityHandler(const Safir::Dob::Typesystem::TypeId typeId,
100  const Dob::Typesystem::HandlerId& handlerId,
101  const Dob::InstanceIdPolicy::Enumeration instanceIdPolicy,
102  Dob::EntityHandler* const entityHandler) const;
103 
128  void RegisterEntityHandlerInjection(const Safir::Dob::Typesystem::TypeId typeId,
129  const Dob::Typesystem::HandlerId& handlerId,
130  const Dob::InstanceIdPolicy::Enumeration instanceIdPolicy,
131  Dob::EntityHandlerInjection* const entityHandlerInjection) const;
163  void RegisterEntityHandlerPending(const Dob::Typesystem::TypeId typeId,
164  const Dob::Typesystem::HandlerId& handlerId,
165  const Dob::InstanceIdPolicy::Enumeration instanceIdPolicy,
166  Dob::EntityHandlerPending* const entityHandlerPending) const;
167 
184  void RegisterServiceHandler(const Safir::Dob::Typesystem::TypeId typeId,
185  const Dob::Typesystem::HandlerId& handlerId,
186  Dob::ServiceHandler* const serviceHandler) const;
187 
204  void RegisterServiceHandlerPending(const Dob::Typesystem::TypeId typeId,
205  const Dob::Typesystem::HandlerId& handlerId,
206  Dob::ServiceHandlerPending* const serviceHandlerPending) const;
230  void UnregisterHandler(const Dob::Typesystem::TypeId typeId,
231  const Dob::Typesystem::HandlerId& handlerId) const;
232 
254  void SubscribeMessage(const Dob::Typesystem::TypeId typeId,
255  const Dob::Typesystem::ChannelId& channelId,
256  Dob::MessageSubscriber* const messageSubscriber) const;
257 
270  void SubscribeMessage(const Dob::Typesystem::TypeId typeId,
271  const Dob::Typesystem::ChannelId& channelId,
272  const bool includeSubclasses,
273  Dob::MessageSubscriber* const messageSubscriber) const;
274 
293  void UnsubscribeMessage(const Dob::Typesystem::TypeId typeId,
294  const Dob::Typesystem::ChannelId& channelId,
295  Dob::MessageSubscriber* const messageSubscriber) const;
296 
310  void UnsubscribeMessage(const Dob::Typesystem::TypeId typeId,
311  const Dob::Typesystem::ChannelId& channelId,
312  const bool includeSubclasses,
313  Dob::MessageSubscriber* const messageSubscriber) const;
314 
315 
336  void SubscribeEntity(const Dob::Typesystem::TypeId typeId,
337  Dob::EntitySubscriber* const entitySubscriber) const;
338 
354  void SubscribeEntity(const Dob::Typesystem::TypeId typeId,
355  const bool includeUpdates,
356  const bool includeSubclasses,
357  const bool restartSubscription,
358  Dob::EntitySubscriber* const entitySubscriber) const;
359 
373  void SubscribeEntity(const Dob::Typesystem::EntityId& entityId,
374  const bool includeUpdates,
375  const bool restartSubscription,
376  Dob::EntitySubscriber* const entitySubscriber) const;
377 
389  void UnsubscribeEntity(const Dob::Typesystem::TypeId typeId,
390  Dob::EntitySubscriber* const entitySubscriber) const;
391 
404  void UnsubscribeEntity(const Dob::Typesystem::TypeId typeId,
405  const bool includeSubclasses,
406  Dob::EntitySubscriber* const entitySubscriber) const;
407 
417  void UnsubscribeEntity(const Dob::Typesystem::EntityId& entityId,
418  Dob::EntitySubscriber* const entitySubscriber) const;
448  void SubscribeRegistration(const Dob::Typesystem::TypeId typeId,
449  const Dob::Typesystem::HandlerId& handlerId,
450  const bool includeSubclasses,
451  const bool restartSubscription,
452  Dob::RegistrationSubscriber* const registrationSubscriber) const;
453 
469  void UnsubscribeRegistration(const Dob::Typesystem::TypeId typeId,
470  const Dob::Typesystem::HandlerId& handlerId,
471  const bool includeSubclasses,
472  Dob::RegistrationSubscriber* const registrationSubscriber) const;
494  void Send(const Dob::MessagePtr& message,
495  const Dob::Typesystem::ChannelId& channelId,
496  Dob::MessageSender* const messageSender) const;
497 
528  Dob::RequestId CreateRequest(const Dob::EntityPtr& request,
529  const Dob::Typesystem::HandlerId& handlerId,
530  Dob::Requestor* const requestor) const;
531 
559  Dob::RequestId CreateRequest(const Dob::EntityPtr& request,
560  const Dob::Typesystem::InstanceId& instanceId,
561  const Dob::Typesystem::HandlerId& handlerId,
562  Dob::Requestor* const requestor) const;
563 
582  Dob::RequestId UpdateRequest(const Dob::EntityPtr& request,
583  const Dob::Typesystem::InstanceId& instanceId,
584  Dob::Requestor* const requestor) const;
585 
603  Dob::RequestId DeleteRequest(const Dob::Typesystem::EntityId& entityId,
604  Dob::Requestor* const requestor) const;
605 
622  Dob::RequestId ServiceRequest(const Dob::ServicePtr& request,
623  const Dob::Typesystem::HandlerId& handlerId,
624  Dob::Requestor* const requestor) const;
625 
647  void SetChanges(const Dob::EntityPtr& entity,
648  const Dob::Typesystem::InstanceId& instanceId,
649  const Dob::Typesystem::HandlerId& handlerId) const;
650 
670  void SetAll(const Dob::EntityPtr& entity,
671  const Dob::Typesystem::InstanceId& instanceId,
672  const Dob::Typesystem::HandlerId& handlerId) const;
673 
685  void Delete(const Dob::Typesystem::EntityId& entityId,
686  const Dob::Typesystem::HandlerId& handlerId) const;
687 
696  void DeleteAllInstances(const Dob::Typesystem::TypeId typeId,
697  const Dob::Typesystem::HandlerId& handlerId) const;
698 
723  Dob::EntityIterator GetEntityIterator(const Dob::Typesystem::TypeId typeId,
724  const bool includeSubclasses) const;
725 
742  const Dob::EntityProxy Read(const Dob::Typesystem::EntityId & entityId) const;
743 
759  bool IsCreated(const Dob::Typesystem::EntityId & entityId) const;
760 
769  Dob::Typesystem::Int64 GetNumberOfInstances(const Dob::Typesystem::TypeId typeId,
770  const Dob::Typesystem::HandlerId& handlerId,
771  const bool includeSubclasses) const;
772 
783  Dob::InstanceIdPolicy::Enumeration GetInstanceIdPolicy(const Dob::Typesystem::TypeId typeId,
784  const Dob::Typesystem::HandlerId& handlerId) const;
785 
798  void ExitDispatch() const;
799 
802  private:
803  //Disable copying and assignment
804  ConnectionBase(const ConnectionBase& d);
805  ConnectionBase& operator=(const ConnectionBase& rhs);
806 
807  friend class ConnectionAspectBase;
808 
809  virtual long GetControllerId() const = 0;
810 
811  void Set(const Dob::EntityPtr& entity,
812  const Dob::Typesystem::InstanceId& instanceId,
813  const Dob::Typesystem::HandlerId& handlerId,
814  const bool considerChangeFlags) const;
815  };
816 
817 }
818 }
819 
820 #endif
Interface to be implemented by subscribers of messages.
Definition: Consumer.h:329
Class containing the identity of a channel.
Definition: ChannelId.h:44
Base class for all aspects.
Definition: ConnectionAspectBase.h:38
Interface to be implemented by subscribers of handler registrations.
Definition: Consumer.h:297
Class containing the identity of an entity.
Definition: EntityId.h:41
Interface to be implemented by senders of messages.
Definition: Consumer.h:278
Class containing the identity of a handler.
Definition: HandlerId.h:44
A STL conformant forward iterator used to traverse entity instances.
Definition: EntityIterator.h:41
boost::shared_ptr< Entity > EntityPtr
Definition: Entity.h:32
Enumeration
Definition: InstanceIdPolicy.h:37
Class containing the identity of an instance.
Definition: InstanceId.h:47
Interface to be implemented by an application that sends requests (Request on entities or service req...
Definition: Consumer.h:252
Interface to be implemented by subscribers of entities.
Definition: Consumer.h:350
boost::shared_ptr< Message > MessagePtr
Definition: Message.h:32
DotsC_Int64 Int64
64 bit integer type.
Definition: Defs.h:70
DotsC_TypeId TypeId
A unique type identifier.
Definition: Defs.h:219
Interface to be implemented by an entity handler that makes a pending registration.
Definition: Consumer.h:194
boost::shared_ptr< Service > ServicePtr
Definition: Service.h:32
Safir::Dob::Typesystem::Int32 RequestId
Represents the id of a request.
Definition: Defs.h:42
Common base class for connections to the DOB.
Definition: ConnectionBase.h:52
Interface to be implemented by an entity handler that makes a non-pending registration for a type tha...
Definition: Consumer.h:152
#define DOSE_CPP_API
Definition: DoseCppExportDefs.h:33
Interface to be implemented by a service handler that makes a non-pending registration.
Definition: Consumer.h:215
Interface to be implemented by an entity handler that makes a non-pending registration and that doesn...
Definition: Consumer.h:112
Interface to be implemented by a service handler that makes a pending registration.
Definition: Consumer.h:239
Proxy class for an entity.
Definition: EntityProxy.h:53