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

Proxy class for an entity. More...

#include <Safir/Dob/EntityProxy.h>

Public Member Functions

const Dob::Typesystem::TypeId GetTypeId () const
 Get type id. More...
 
const Dob::Typesystem::InstanceId GetInstanceId () const
 Get instance id. More...
 
const Dob::Typesystem::EntityId GetEntityId () const
 Get entity id. More...
 
const Dob::EntityPtr GetEntity () const
 Get entity. More...
 
const Dob::EntityPtr GetEntityWithChangeInfo () const
 Get entity with change information. More...
 
const Dob::Typesystem::HandlerId GetOwner () const
 Get owner handler id. More...
 
const Dob::ConnectionInfoPtr GetOwnerConnectionInfo () const
 Get info about the connection to which the owner handler is related. More...
 
 EntityProxy (Internal::EntityProxyImpl *pImpl)
 
Retrieve binary blob
const char * GetBlob () const
 Get binary blob of the received entity without changeflags set. More...
 
const char * GetBlobWithChangeInfo () const
 Get binary blob with change information. More...
 
Retrieve previous entity state
const Dob::PreviousEntityProxy GetPrevious () const
 Get previous entity state. More...
 
Trace and Debug stuff
const Dob::Typesystem::HandlerId GetOwnerWithStringRepresentation () const
 Get owner handler id that also contains the string representation. More...
 
Retrieve timestamps. (Extended info for applications with special need)
  Note that timestamps is only available for types configured with this option.
const Dob::Typesystem::Int64 GetTimestamp () const
 Retrieves the timestamp for the latest create, update or delete. More...
 
const Dob::Typesystem::Int64 GetTimestamp (const Dob::Typesystem::MemberIndex member) const
 Retrieves the timestamp for the given top member. More...
 

Detailed Description

Proxy class for an entity.

Constructor & Destructor Documentation

Safir::Dob::EntityProxy::EntityProxy ( Internal::EntityProxyImpl *  pImpl)
explicit

Member Function Documentation

const char* Safir::Dob::EntityProxy::GetBlob ( ) const

Get binary blob of the received entity without changeflags set.

This method will give you a pointer to the underlying representation of the object. Note that this pointer is only valid while the EntityProxy is in scope. If you want to keep the blob you must copy it using methods in Safir::Dob::Typesystem.

This method is mainly useful if all you want to do with a received object is to write it to a database or pass it over a C-interface to a library or plugin.

As an example, if you want to copy the bytes into a std::vector<char> you could do it like this "v = std::vector<char>(blob,blob+Safir::Dob::Typesystem::BlobOperations.GetSize())"

Returns
Binary blob of the received entity.
const char* Safir::Dob::EntityProxy::GetBlobWithChangeInfo ( ) const

Get binary blob with change information.

Retrieves the entity with change flags set to indicate which members have changed since the last subscription response.

See also
GetBlob
Returns
Binary blob.
const Dob::EntityPtr Safir::Dob::EntityProxy::GetEntity ( ) const

Get entity.

Retrieves a smart pointer to the entity.

No change flags will be set in the returned entity.

Returns
entity.
const Dob::Typesystem::EntityId Safir::Dob::EntityProxy::GetEntityId ( ) const

Get entity id.

Aggregation of type id and instance id.

Returns
Entity id.
const Dob::EntityPtr Safir::Dob::EntityProxy::GetEntityWithChangeInfo ( ) const

Get entity with change information.

Retrieves the entity with change flags set to indicate which members have changed since the last subscription response.

Returns
entity.
const Dob::Typesystem::InstanceId Safir::Dob::EntityProxy::GetInstanceId ( ) const

Get instance id.

Retrieves instance id of the Entity.

Returns
Instance id.
const Dob::Typesystem::HandlerId Safir::Dob::EntityProxy::GetOwner ( ) const

Get owner handler id.

Retrieves the handler id of the handler that owns (has created) this entity instance.

Returns
Handler id.
const Dob::ConnectionInfoPtr Safir::Dob::EntityProxy::GetOwnerConnectionInfo ( ) const

Get info about the connection to which the owner handler is related.

Returns
Connection info.
const Dob::Typesystem::HandlerId Safir::Dob::EntityProxy::GetOwnerWithStringRepresentation ( ) const

Get owner handler id that also contains the string representation.

Mainly for trace and debug purposes.

See also
GetOwner()
Returns
Handler id.
const Dob::PreviousEntityProxy Safir::Dob::EntityProxy::GetPrevious ( ) const

Get previous entity state.

Used to get the entity state that preceeded this state.

Can be used when a "previous" state exists, that is, from within the following callbacks:

No change flags will be set in the returned entity.

Calling this function inside an OnDeletedEntity when the subscription was set up with includeUpdates set to false may yield an entity state that you have not received in an OnNewEntity callback. In fact it will most likely give you one of the updated entity states that were filtered out because you didn't include updates.

Returns
Previous entity.
const Dob::Typesystem::Int64 Safir::Dob::EntityProxy::GetTimestamp ( ) const

Retrieves the timestamp for the latest create, update or delete.

Note that this operation is only valid for Injectable types.

Returns
Timestamp.
const Dob::Typesystem::Int64 Safir::Dob::EntityProxy::GetTimestamp ( const Dob::Typesystem::MemberIndex  member) const

Retrieves the timestamp for the given top member.

Note that this operation is only valid for Injectable types.

Parameters
[in]memberTop level member index.
Returns
Timestamp.
const Dob::Typesystem::TypeId Safir::Dob::EntityProxy::GetTypeId ( ) const

Get type id.

Retrieves type id of the Entity.

Returns
Type id.