![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cUIDManagerTable.h>
Public Member Functions | |
| cUIDManagerTable (const cUIDRangeMask &mask, const char *pszTableName) | |
| ~cUIDManagerTable () | |
| HRESULT | OpenPoolCheck (cSQLDatabase *pDB, cSQLStatementQ &rs) |
| void | ClosePool (cSQLDatabasePool &dbp) |
| cString | get_StatusString () const |
| bool | IsFreeOrDeleted (UID_t uid) const |
| UIDINDEX_t | get_UIDCount () const |
| cXObjectPtr | FindObjIter (cHashIterator &e) const |
| virtual cXObjectPtr | FindUIDObj (UID_t uid) const |
| HRESULT | CreateUID (cSQLDatabasePool &db, cXObject *pObj) |
| HRESULT | LoadUID (cSQLDatabasePool &db, cXObject *pObj, UIDINDEX_t index) |
| void | DeleteUIDIndex (UID_t uid, bool bFree, bool bWasSaved) |
| void | DeleteUID (cXObject *pObj, bool bFree) |
| void | ClearDeletedUIDs (cSQLDatabasePool &db) |
| void | SaveFreeUIDs (cSQLDatabasePool &db) |
| HRESULT | RebuildFreeUIDTable (cSQLDatabasePool &db, UIDINDEX_t dwMaxQty) |
| UNITTEST_FRIEND (cUIDManagerTable) | |
Public Attributes | |
| const cUIDRangeMask | m_UIDRange |
| Mask of the range of valid UID's (allow high bits to float) More... | |
| cHashTableRef< cXObject, UID_t, 9 > | m_UsedUIDs |
| 9 bits = 512 buckets More... | |
| bool | m_bLogDelete |
| track deletes. in log More... | |
Static Public Attributes | |
| static const char | k_FreePostfix [5] = "Free" |
Manage the list of free/used UIDs in a SQL database table. Manage a range of used UID's. Have a fast way to find a free UID. Manage multi server contention by multiple requesting nodes. Must be atomic transactions!
| GrayLib::cUIDManagerTable::cUIDManagerTable | ( | const cUIDRangeMask & | mask, |
| const char * | pszTableName | ||
| ) |
| GrayLib::cUIDManagerTable::~cUIDManagerTable | ( | ) |
This table should already be unloaded by now?!
| void GrayLib::cUIDManagerTable::ClearDeletedUIDs | ( | cSQLDatabasePool & | db | ) |
Convert m_DeletedIndexes back to m_FreeIndexes So they may be used again. (internally on this node only)
| void GrayLib::cUIDManagerTable::ClosePool | ( | cSQLDatabasePool & | dbp | ) |
The app is closing or restarting.
Can't actually delete UID's without doing a proper save!
| HRESULT GrayLib::cUIDManagerTable::CreateUID | ( | cSQLDatabasePool & | db, |
| cXObject * | pObj | ||
| ) |
New Object. Try to give it a new UID. so find a free UID.
| void GrayLib::cUIDManagerTable::DeleteUID | ( | cXObject * | pObj, |
| bool | bFree | ||
| ) |
This sort of deletes the object. Should NOT be actually deleted until a save is executed. Clearing the object from the DB Called by cXObject::DisposeThis() bFree = this is legit freed, (Not just unloaded or closing app)
| void GrayLib::cUIDManagerTable::DeleteUIDIndex | ( | UID_t | uid, |
| bool | bFree, | ||
| bool | bWasSaved | ||
| ) |
Can't free up the UID until after the save ! Just put in free pool locally for now.
| cXObjectPtr GrayLib::cUIDManagerTable::FindObjIter | ( | cHashIterator & | e | ) | const |
iterate thru the objects.
|
virtual |
find a particular object.
| cString GrayLib::cUIDManagerTable::get_StatusString | ( | ) | const |
| UIDINDEX_t GrayLib::cUIDManagerTable::get_UIDCount | ( | ) | const |
| bool GrayLib::cUIDManagerTable::IsFreeOrDeleted | ( | UID_t | uid | ) | const |
Test the state of this particular UID.
| HRESULT GrayLib::cUIDManagerTable::LoadUID | ( | cSQLDatabasePool & | db, |
| cXObject * | pObj, | ||
| UIDINDEX_t | index | ||
| ) |
Loading an object that wants a specific UID. nUID = Set to this UID
| HRESULT GrayLib::cUIDManagerTable::OpenPoolCheck | ( | cSQLDatabase * | pDB, |
| cSQLStatementQ & | rs | ||
| ) |
check for essential tables in M$ db. (e.g. XXX and XXXFree)
| HRESULT GrayLib::cUIDManagerTable::RebuildFreeUIDTable | ( | cSQLDatabasePool & | db, |
| UIDINDEX_t | dwMaxQty | ||
| ) |
Wipe the free UID table and rebuild it from the current used UID table!
| void GrayLib::cUIDManagerTable::SaveFreeUIDs | ( | cSQLDatabasePool & | db | ) |
Flush all unused free UID ranges back to the database. ASSUME we are closing the app gracefully.
| GrayLib::cUIDManagerTable::UNITTEST_FRIEND | ( | cUIDManagerTable | ) |
|
static |
| bool GrayLib::cUIDManagerTable::m_bLogDelete |
track deletes. in log
| const cUIDRangeMask GrayLib::cUIDManagerTable::m_UIDRange |
Mask of the range of valid UID's (allow high bits to float)
| cHashTableRef<cXObject, UID_t, 9> GrayLib::cUIDManagerTable::m_UsedUIDs |
9 bits = 512 buckets
UIDs and the objects using them.