Safir SDK Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Safir::Dob::SecondaryConnection Class Reference

A secondary connection attached to a "real" connection. More...

#include <Safir/Dob/SecondaryConnection.h>

Inheritance diagram for Safir::Dob::SecondaryConnection:
Collaboration diagram for Safir::Dob::SecondaryConnection:

Public Member Functions

 SecondaryConnection ()
 Constructor. More...
 
virtual ~SecondaryConnection ()
 Destructor. More...
 
void Attach ()
 Attach to a connection in this thread. More...
 
void Attach (const std::wstring &connectionNameCommonPart, const std::wstring &connectionNameInstancePart)
 Attach to a named connection in this thread. More...
 
void Detach ()
 Detach a SecondaryConnection. More...
 
bool IsAttached () const
 Check if a SecondaryConnection is attached to an open connection. More...
 
virtual bool IsOpen () const
 For a secondary connection this is the same as the IsAttached check. More...
 
- Public Member Functions inherited from Safir::Dob::ConnectionBase
 ConnectionBase ()
 Constructor. More...
 
virtual ~ConnectionBase ()
 Destructor. More...
 
void RegisterEntityHandler (const Safir::Dob::Typesystem::TypeId typeId, const Dob::Typesystem::HandlerId &handlerId, const Dob::InstanceIdPolicy::Enumeration instanceIdPolicy, Dob::EntityHandler *const entityHandler) const
 Registration of an entity handler for a given type. More...
 
void RegisterEntityHandlerInjection (const Safir::Dob::Typesystem::TypeId typeId, const Dob::Typesystem::HandlerId &handlerId, const Dob::InstanceIdPolicy::Enumeration instanceIdPolicy, Dob::EntityHandlerInjection *const entityHandlerInjection) const
 Register an entity handler that also gets informed about injected entities. More...
 
void RegisterEntityHandlerPending (const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::HandlerId &handlerId, const Dob::InstanceIdPolicy::Enumeration instanceIdPolicy, Dob::EntityHandlerPending *const entityHandlerPending) const
 Pending registration of a handler for a given entity type. More...
 
void RegisterServiceHandler (const Safir::Dob::Typesystem::TypeId typeId, const Dob::Typesystem::HandlerId &handlerId, Dob::ServiceHandler *const serviceHandler) const
 Register a service handler for a given type. More...
 
void RegisterServiceHandlerPending (const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::HandlerId &handlerId, Dob::ServiceHandlerPending *const serviceHandlerPending) const
 Pending registration of a handler for a given service type. More...
 
void UnregisterHandler (const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::HandlerId &handlerId) const
 Unregister of an entity handler or a service handler. More...
 
void SubscribeMessage (const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::ChannelId &channelId, Dob::MessageSubscriber *const messageSubscriber) const
 Set up subscription for messages of a certain type and its subclasses. More...
 
void SubscribeMessage (const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::ChannelId &channelId, const bool includeSubclasses, Dob::MessageSubscriber *const messageSubscriber) const
 Set up subscription for messages of a certain type (additional parameters). More...
 
void UnsubscribeMessage (const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::ChannelId &channelId, Dob::MessageSubscriber *const messageSubscriber) const
 Remove a message subscription made by the given subscriber. More...
 
void UnsubscribeMessage (const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::ChannelId &channelId, const bool includeSubclasses, Dob::MessageSubscriber *const messageSubscriber) const
 Remove a message subscription made by the given subscriber (additional parameters). More...
 
void SubscribeEntity (const Dob::Typesystem::TypeId typeId, Dob::EntitySubscriber *const entitySubscriber) const
 Set up subscription for instances of an entity type and its subclasses. More...
 
void SubscribeEntity (const Dob::Typesystem::TypeId typeId, const bool includeUpdates, const bool includeSubclasses, const bool restartSubscription, Dob::EntitySubscriber *const entitySubscriber) const
 Subscription for an entity type (additional parameters). More...
 
void SubscribeEntity (const Dob::Typesystem::EntityId &entityId, const bool includeUpdates, const bool restartSubscription, Dob::EntitySubscriber *const entitySubscriber) const
 Set up subscription for a specific instance of an entity type. More...
 
void UnsubscribeEntity (const Dob::Typesystem::TypeId typeId, Dob::EntitySubscriber *const entitySubscriber) const
 Remove an entity subscription made by the given subscriber. More...
 
void UnsubscribeEntity (const Dob::Typesystem::TypeId typeId, const bool includeSubclasses, Dob::EntitySubscriber *const entitySubscriber) const
 Remove an entity subscription made by the given subscriber (additional parameters). More...
 
void UnsubscribeEntity (const Dob::Typesystem::EntityId &entityId, Dob::EntitySubscriber *const entitySubscriber) const
 Remove an entity instance subscription made by the given subscriber. More...
 
void SubscribeRegistration (const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::HandlerId &handlerId, const bool includeSubclasses, const bool restartSubscription, Dob::RegistrationSubscriber *const registrationSubscriber) const
 Set up subscription for notifications about when a specific handler for an entity type or a service type is registered and unregistered. More...
 
void UnsubscribeRegistration (const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::HandlerId &handlerId, const bool includeSubclasses, Dob::RegistrationSubscriber *const registrationSubscriber) const
 Removes a registration subscription. More...
 
void Send (const Dob::MessagePtr &message, const Dob::Typesystem::ChannelId &channelId, Dob::MessageSender *const messageSender) const
 Send a message on the specified channel. More...
 
Dob::RequestId CreateRequest (const Dob::EntityPtr &request, const Dob::Typesystem::HandlerId &handlerId, Dob::Requestor *const requestor) const
 Request to a handler to create an entity instance without specifying the instanceId. More...
 
Dob::RequestId CreateRequest (const Dob::EntityPtr &request, const Dob::Typesystem::InstanceId &instanceId, const Dob::Typesystem::HandlerId &handlerId, Dob::Requestor *const requestor) const
 Request to a handler to create a specific entity instance. More...
 
Dob::RequestId UpdateRequest (const Dob::EntityPtr &request, const Dob::Typesystem::InstanceId &instanceId, Dob::Requestor *const requestor) const
 Send an update request on an existing entity instance. More...
 
Dob::RequestId DeleteRequest (const Dob::Typesystem::EntityId &entityId, Dob::Requestor *const requestor) const
 Send a delete request on an existing entity instance. More...
 
Dob::RequestId ServiceRequest (const Dob::ServicePtr &request, const Dob::Typesystem::HandlerId &handlerId, Dob::Requestor *const requestor) const
 Send a request to the given service handler. More...
 
void SetChanges (const Dob::EntityPtr &entity, const Dob::Typesystem::InstanceId &instanceId, const Dob::Typesystem::HandlerId &handlerId) const
 Merge the changed members of an entity straight into the pool (the given handler must be the owner). More...
 
void SetAll (const Dob::EntityPtr &entity, const Dob::Typesystem::InstanceId &instanceId, const Dob::Typesystem::HandlerId &handlerId) const
 Allows an entity handler to create or update an entity. More...
 
void Delete (const Dob::Typesystem::EntityId &entityId, const Dob::Typesystem::HandlerId &handlerId) const
 Allows an entity handler to delete a specific owned entity instance. More...
 
void DeleteAllInstances (const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::HandlerId &handlerId) const
 Allows an entity handler to delete all owned instances. More...
 
Dob::EntityIterator GetEntityIterator (const Dob::Typesystem::TypeId typeId, const bool includeSubclasses) const
 Retreives an STL compliant iterator to iterate over created instances. More...
 
const Dob::EntityProxy Read (const Dob::Typesystem::EntityId &entityId) const
 Read an entity from the distributed object pool. More...
 
bool IsCreated (const Dob::Typesystem::EntityId &entityId) const
 Check if an instance of an entity is created or not. More...
 
Dob::Typesystem::Int64 GetNumberOfInstances (const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::HandlerId &handlerId, const bool includeSubclasses) const
 This method is used to get the number of instances of an entity that exists. More...
 
Dob::InstanceIdPolicy::Enumeration GetInstanceIdPolicy (const Dob::Typesystem::TypeId typeId, const Dob::Typesystem::HandlerId &handlerId) const
 This method is used to get the instanceIdPolicy for a specific class and handler. More...
 
void ExitDispatch () const
 Interrupt the ongoing Dispatch even if all data to the application have not been distpatched. More...
 

Detailed Description

A secondary connection attached to a "real" connection.

This class is used to attach yourself to an existing connection in the same thread. All attach calls ensure that you will get a connection that is valid in the current thread, but each SecondaryConnection must still only be used from within one thread.

Constructor & Destructor Documentation

Safir::Dob::SecondaryConnection::SecondaryConnection ( )

Constructor.

virtual Safir::Dob::SecondaryConnection::~SecondaryConnection ( )
virtual

Destructor.

Member Function Documentation

void Safir::Dob::SecondaryConnection::Attach ( )

Attach to a connection in this thread.

This method will attach the SecondaryConnection to the first Connection that was opened in this thread.

This method can be used to let part of a program, for example a module or a dll, attach to an existing open connection.

Exceptions
Safir::Dob::NotOpenExceptionThere is no open Connection in this thread.
void Safir::Dob::SecondaryConnection::Attach ( const std::wstring &  connectionNameCommonPart,
const std::wstring &  connectionNameInstancePart 
)

Attach to a named connection in this thread.

This method will attach the SecondaryConnection to the named Connection if that Connection was opened in this thread.

This method can be used to let part of a program, for example a module or a dll, attach to an existing open connection. The connection name parameters are used to identify the connection to attach to. This connection must already be opened, otherwise an exception will be thrown.

Parameters
[in]connectionNameCommonPartName that identifies the connection but not any particular instance.
[in]connectionNameInstancePartName that identifies a particular connection instance.
Exceptions
Safir::Dob::NotOpenExceptionIf the Connection instance we are trying to attach to is not open.
void Safir::Dob::SecondaryConnection::Detach ( )

Detach a SecondaryConnection.

When a connection has been detached it can be attached again.

bool Safir::Dob::SecondaryConnection::IsAttached ( ) const

Check if a SecondaryConnection is attached to an open connection.

Returns
True if the SecondaryConnection is attached to a Connection and that Connection is open.
virtual bool Safir::Dob::SecondaryConnection::IsOpen ( ) const
virtual

For a secondary connection this is the same as the IsAttached check.

Returns
True if the SecondaryConnection is attached to a Connection and that Connection is open.

Implements Safir::Dob::ConnectionBase.