PEntity Class Reference

Detailed Description

The PEntity class is used to wrap any PObject and store it into a PStore (for example, a database).

The information handled by an entity are:

  • a PObject (any Papillon object)
  • the class id of this object
  • a timestamp
  • a flag to indicate if the entity has been deleted
  • an entity id (PGuid) composed of a store id (uint64) and an object id (uint64)

Definition at line 36 of file PEntity.h.

#include <PEntity.h>

Constructor & Destructor Documentation

◆ PEntity() [1/3]

PEntity::PEntity ( )

Creates an empty (undefined) entity.

Calling IsValid() on this object will return false.

See also
IsValid()

◆ PEntity() [2/3]

PEntity::PEntity ( const papillon::PObject &  obj)

Creates a PEntity from any PObject.

◆ PEntity() [3/3]

PEntity::PEntity ( const PEntity other)

Constructs a shared copy of other.

◆ ~PEntity()

virtual PEntity::~PEntity ( )
virtual

Destroys this object.

Member Function Documentation

◆ EntityIdPropertyName()

static const PString& PEntity::EntityIdPropertyName ( )
inlinestatic

Returns the name of the PGuid property which handles entity id.

Definition at line 43 of file PEntity.h.

◆ GetEntityId()

papillon::PGuid PEntity::GetEntityId ( ) const

Returns the guid associated with this entity which is the concatenation of the store id with the object id.

◆ GetObject()

papillon::PResult PEntity::GetObject ( PObject obj) const

Gets the PObject handled by this entity.

If a sub-class of PObject is used as argument, a cast is performed and PResult::C_OK is returned if success, or bad cast error if failure.

◆ GetObjectClassId()

papillon::classid PEntity::GetObjectClassId ( ) const

Returns the class id of the object wrapped by this entity.

To change the class id, use SetObject().

◆ GetObjectId()

papillon::uint64 PEntity::GetObjectId ( ) const

Returns the object id of this entity.

◆ GetStoreId()

papillon::uint64 PEntity::GetStoreId ( ) const

Returns the store id of this entity.

◆ GetTimestamp()

papillon::PDateTime PEntity::GetTimestamp ( ) const

Returns the timestamp associated with this entity.

◆ HasDeleteFlag()

bool PEntity::HasDeleteFlag ( ) const

Returns true if this entity has delete flag, false otherwise.

◆ IsValid()

bool PEntity::IsValid ( ) const

Returns true if this entity is valid, i.e.

if the class id of the object is neither E_POBJECT nor E_UNSPECIFIED.

◆ operator=()

PEntity& PEntity::operator= ( const PEntity other)

Performs a shared copy of other to this object.

◆ SetDeleteFlag()

void PEntity::SetDeleteFlag ( bool  enabled)

Enables or disables the delete flag of this entity.

◆ SetEntityId()

void PEntity::SetEntityId ( const papillon::PGuid &  id)

Sets both the store id and the object id of this entity.

◆ SetObject()

void PEntity::SetObject ( const PObject obj)

Sets the object handled by this entity.

This method changes the type of the entity automatically.

◆ SetStoreId()

void PEntity::SetStoreId ( const papillon::uint64 &  id)

Sets the store id of this entity.

◆ SetTimestamp()

void PEntity::SetTimestamp ( const papillon::PDateTime &  t)

Sets the timestamp of this entity.