Public Types | |
typedef inMemory< voxelType > | t_base |
typedef std::function < byteArray(const byteArray &)> | t_funcCompress |
![]() | |
typedef base< voxelType > | t_base |
typedef vector3int32map < typename t_base::t_utilsTile > | t_tilesMap |
![]() | |
typedef voxelType | t_config |
typedef t_config::t_data | t_voxel |
typedef voxelType::t_container::t_tile | t_tile |
typedef simple::base< t_tile > | t_base |
typedef sharedPointer< t_tile > | t_tilePtr |
typedef utils::tile< t_tile > | t_utilsTile |
typedef sharedPointer < edit::base< t_config > const > | t_editConstPtr |
typedef sharedPointer < edit::base< t_config > > | t_editPtr |
typedef t_base::t_tileId | t_tileId |
typedef hashMap< t_tileId, t_utilsTile > | t_tilesGotChangedMap |
![]() | |
typedef voxelType::t_container::t_tile | t_tile |
typedef sharedPointer< t_tile > | t_tilePtr |
typedef base< t_tile > | t_thisClass |
typedef vector3int32 | t_tileId |
typedef hashMap< t_tileId, t_tilePtr > | t_tilesGotChangedMap |
typedef std::function< t_tilePtr()> | t_createTileCallback |
typedef blub::signal< void()> | t_sigEditDone |
Public Member Functions | |
database (blub::async::dispatcher &worker, blub::database::connection &dbConn) | |
void | loadTS () |
void | loadMaster () |
byteArray | getTileHolderDatabaseMaster (const blub::vector3int32 &id) const |
t_base::t_utilsTile | getTileHolderFromDatabaseMaster (const blub::vector3int32 &id) const |
void | setWriteToDatabase (const bool &en) |
void | setCompressionCallback (const t_funcCompress &compress, const t_funcCompress &decompress) |
![]() | |
inMemory (blub::async::dispatcher &worker) | |
inMemory constructor More... | |
~inMemory () | |
~inMemory descructor | |
t_base::t_utilsTile | getTileHolder (const blub::vector3int32 &id) const override |
getTileHolder returns a utils::tileHolder setted by setTile() or by editVoxel(). Read-lock class before call. Read-lock the class before. More... | |
const t_tilesMap & | getTilesMap () const |
getTilesMap returns all tiles. More... | |
void | setTileBounds (const axisAlignedBoxInt32 &bounds) |
setTileBounds sets the size for the map. Call for optimization, if you know the tile-dimensions before editing. More... | |
const axisAlignedBoxInt32 & | getTileBounds () const |
getTileBounds returns the tile bounds. More... | |
![]() | |
base (blub::async::dispatcher &worker) | |
base constructor. More... | |
void | editVoxel (t_editConstPtr change, const transform &trans=blub::transform()) |
editVoxel edits the container. Its guranteed that the edits are getting in order of calling this method. Returns immediately. Does NOT calculate any voxel, but creates and dispatches the jobs for it. More... | |
void | setTile (const t_tileId &id, const t_utilsTile &toSet) |
editVoxel edits the container. Its guranteed that the edits are getting in order of calling this method. Returns immediately. Does NOT calculate any voxel, but creates and dispatches the jobs for it. More... | |
t_utilsTile | getTileHolderByVoxelPosition (const blub::vector3int32 &pos) const |
getTileHolderByVoxelPosition returns a utils::tileHolder setted by setTile() or by editVoxel(). Read-lock class before call. More... | |
t_voxel | getVoxel (const vector3int32 &voxelPos) const |
getVoxel returns an voxel. Read-lock the class before call. More... | |
const t_tilesGotChangedMap & | getTilesThatGotEdited () const |
![]() | |
base (blub::async::dispatcher &worker) | |
base constructor More... | |
~base () | |
~base destructor | |
void | lockForEdit () |
lockForEdit locks the class for editing/writing it. Call unlockForEdit() after work done. Method executes locks by the dispatcher master. More... | |
void | unlockForEdit () |
unlockForEdit unlocks edit/write-lock and calls signalEditDone() . Method executes unlock by the dispatcher master. More... | |
void | lockForRead () |
lockForRead locks the class for reading. | |
void | unlockRead () |
unlockRead unlocks the class after reading. | |
const t_tilesGotChangedMap & | getTilesThatGotEdited () const |
getTilesThatGotEdited returns a list of tiles which changed since the last call lockForEdit() / lockForEditMaster() More... | |
void | setCreateTileCallback (const t_createTileCallback &callback) |
setCreateTileCallback sets a callback for creating tiles. Use this method if you want to create custom tiles. More... | |
blub::async::strand & | getMaster () |
getMaster returns the master dispatcher. The master synchronises jobs for the worker-thread and writes to class member. The master calls all methods which end with *Master. More... | |
t_sigEditDone * | signalEditDone () |
signalEditDone gets called after unlockForEdit() got called. More... | |
Protected Member Functions | |
virtual void | setTileDatabaseMaster (const vector3int32 &id, const blub::byteArray &toSet, const bool &insert, const bool &update, const bool &remove) |
void | setTileToContainerMaster (const typename t_base::t_tileId id, const typename t_base::t_utilsTile &oldOne, const typename t_base::t_utilsTile &toSet) override |
setTileToContainerMaster replaces a tile. Call method by one thread at a time. Write-lock class before. More... | |
![]() | |
void | setTileMaster (const blub::vector3int32 &id, const typename t_base::t_utilsTile &toSet) override |
setTileMaster sets a tile to an id. Call by one thread at a time. More... | |
void | setTileToFullMaster (const vector3int32 &id) override |
setTileToFullMaster sets a tiles voxel to maximum - for memory optimizations. Method gets called by a single thread at a time. More... | |
void | setTileToEmtpyMaster (const vector3int32 &id) override |
setTileToFullMaster sets a tiles voxel to minimum - for memory optimizations. Method gets called by a single thread at a time. More... | |
BLUB_SERIALIZATION_ACCESS void | save (formatType &readWrite, const uint32 &version) const |
void | load (formatType &readWrite, const uint32 &version) |
void | serialize (formatType &readWrite, const uint32 &version) |
![]() | |
void | addToChangeList (const t_tileId &id, t_utilsTile toAdd) |
void | unlockForEditMaster () override |
unlockForEditMaster unlocks write. Call by master dispatcher. | |
bool | tryLockForEditMaster () override |
tryLockForEditMaster tries to lock for write. Call by master dispatcher. More... | |
void | lockForEditMaster () override |
lockForEditMaster locks for write, or waits until possible. Call by master dispatcher. | |
void | editMaster (t_editConstPtr change, const blub::transform &trans) |
editMaster saves the edit in a qeue and starts to handle it. More... | |
void | doNextEditMaster (const bool &alreadyLocked=false) |
doNextEditMaster finds out which tiles the edit affects and dispaches the change to the worker-threads. More... | |
void | editVoxelWorker (t_editConstPtr change, const t_utilsTile &holder, const blub::vector3int32 &id, const blub::transform &trans) |
editVoxelWorker affects with change holder. Method gets called paralell by various threads. Method only affects the delivered holder. More... | |
void | editVoxelDoneMaster (t_utilsTile tileHolder_, const blub::vector3int32 &id) |
editVoxelDoneMaster gets called after edit got applied on the tile. Call method only by one thread at a time. More... | |
virtual void | setTileMaster (const t_tileId &id, const t_utilsTile &toSet)=0 |
gets called by setTile. Call only by one thread at a time. Write-lock class before. More... | |
t_tilePtr | getOrCreateTile (const vector3int32 &id) |
getOrCreateTile looks up if tile already exists. If not creates one. More... | |
![]() | |
void | addToChangeList (const t_tileId &id, t_tilePtr toAdd) |
addToChangeList adds a tile to the change-list. More... | |
virtual t_tilePtr | createTile () const |
createTile creates a new Tile. Uses callback set by setCreateTileCallback() More... | |
Protected Attributes | |
blub::database::connection & | m_databaseConnection |
bool | m_loading |
bool | m_writeToDatabase |
t_funcCompress | m_funcCompress |
t_funcCompress | m_funcDecompress |
![]() | |
int32 | m_numInTilesInTask |
t_editTodoList | m_editsTodo |
t_tilesGotChangedMap | m_tilesThatGotEdited |
![]() | |
blub::async::strand | m_master |
m_master The master synchronises jobs for the worker-thread and writes to class member. The master calls all methods which end with *Master. | |
blub::async::dispatcher & | m_worker |
m_worker use it to dispatch heavy work. Don't write to class member with it. Do not use any locks. Use m_master for such tasks. | |
t_tilesGotChangedMap | m_tilesThatGotEdited |
t_createTileCallback | m_createTileCallback |
async::mutexReadWrite | m_classLocker |
t_sigEditDone | m_sigEditDone |
Additional Inherited Members | |
![]() | |
static t_tileId | calculateVoxelPosToTileId (const vector3int32 &voxelPos) |
calculateVoxelPosToTileId converts an absolute voxel-position to an relative container-id position. More... | |
static vector3int32 | calculateVoxelPosInTile (const vector3int32 &voxelPos) |
calculateVoxelPosInTile converts an absolute voxel-position to an relative container-confirm position. More... | |
![]() | |
typedef list< editTodo > | t_editTodoList |
![]() | |
static t_tilePtr | createTileFull (const bool &full) |
createTileFull creates a tile in which all voxel are maximum or minimum. More... | |
static void | calculateAffectetedTilesByAabb (const axisAlignedBoxInt32 &voxelAabb, t_tileId &startResult, t_tileId &endResult) |
calculateAffectetedTilesByAabb caluclates a list of affected tiles by an axisAlignedBox. Used to determine which tiles to recalculate for an edit. More... | |
|
inlineoverrideprotectedvirtual |
setTileToContainerMaster replaces a tile. Call method by one thread at a time. Write-lock class before.
id | TileId |
oldOne | Not used - may be interesting in derived classes. |
toSet |
Reimplemented from blub::procedural::voxel::simple::container::inMemory< voxelType >.