Detailed Description
The PStore class is an interface to store an heterogeneous collection of PObject into a container (typically a database).
#include <PStore.h>
Constructor & Destructor Documentation
◆ PStore() [1/2]
PStore::PStore | ( | ) |
◆ PStore() [2/2]
PStore::PStore | ( | const PStore & | other | ) |
Constructs a shared copy of other.
◆ ~PStore()
|
virtual |
Destroys this object.
Member Function Documentation
◆ Add() [1/2]
Adds the specified object to the store and retrieve the automatically assigned entity-id (composed of store-id and object-id).
Returns PResult::C_OK if success, another result otherwise.
◆ Add() [2/2]
Adds the specified object to the store.
Returns PResult::C_OK if success, another result otherwise.
◆ AddListener()
void PStore::AddListener | ( | const PStoreEventListener & | eventListener | ) |
Adds the specified listener.
It will be notified each time a change occurs in this store.
◆ Close()
void PStore::Close | ( | ) |
Closes this store, freeing any resources acquired.
◆ Exists()
bool PStore::Exists | ( | const PGuid & | entityId | ) | const |
Returns true if this store contains the specified entity, false otherwise.
◆ Get()
Gets an object specified by its guid (entity id).
Returns PResult::C_OK if success (the object exist and cast succeeded), another result otherwise.
◆ GetAll()
Gets all objects of the specified type from this store and fill the specified list; the list is first cleared.
Returns PResult::C_OK if success (the object exist and cast succeeded), another result otherwise.
◆ GetEntity()
Gets an entity specified by its guid (entity id).
Returns PResult::C_OK if success, another result otherwise.
◆ GetStoreId()
papillon::uint64 PStore::GetStoreId | ( | ) | const |
Returns the store id (unique for each store) associated with this PStore.
◆ GetTimestampLatestUpdate()
PDateTime PStore::GetTimestampLatestUpdate | ( | ) | const |
Returns the timestamp of the latest update of this store.
For example, if you are using a memory cache for a PStore which relies on a database, this method returns the last time where database has been reloaded in memory.
◆ IsEmpty()
bool PStore::IsEmpty | ( | ) | const |
Returns true if this store is empty, false otherwise.
◆ IsValid()
bool PStore::IsValid | ( | ) | const |
Returns true if this store is valid and is ready for storage, false otherwise.
◆ Iterator()
PStoreIterator PStore::Iterator | ( | ) | const |
Returns an iterator on this store.
◆ NotifyListeners()
|
protected |
◆ operator=()
◆ Remove()
Remove the object specified by its guid (entity id).
Returns PResult::C_OK if success, another result otherwise.
◆ RemoveAllObjects()
◆ RemoveListener()
PResult PStore::RemoveListener | ( | const PStoreEventListener & | eventListener | ) |
Removes the specified listener.
Returns PResult::C_OK if success, another result otherwise.
◆ SetDeleteFlag()
Updates the "deleteFlag" status of an entity.
Use true to set the delete flag or false to unset it. Returns PResult::C_OK if success, another result otherwise.
◆ SetTimestampLatestUpdate()
void PStore::SetTimestampLatestUpdate | ( | const PDateTime & | timestamp | ) |
Sets the timestamp of the latest update of this store.
For example, if you are using a memory cache for a PStore which relies on a database, then this method should be called each time the database is reloaded in memory.
◆ Size() [1/2]
papillon::int32 PStore::Size | ( | ) | const |
Returns the number of papillon objects stored in this container.
Returns -1 if failure.
◆ Size() [2/2]
papillon::int32 PStore::Size | ( | EType | type | ) | const |
Returns the number of papillon objects of the specified type stored in this container.
Returns -1 if failure.
◆ Update()
Updates the specified object.
Returns PResult::C_OK if success, another result otherwise.