OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
EntityCache.h
Go to the documentation of this file.
1#pragma once
2
3class EntityBase;
4namespace ot
5{
6 namespace components
7 {
8 class ModelComponent;
9 }
10}
11
12#include "OTCore/CoreTypes.h"
13#include "OldTreeIcon.h"
14
15#include <map>
16#include <list>
17
18namespace ot
19{
20 class EntityInformation;
21}
22
23class Application;
24
26{
27public:
30
31 void setApplication(Application* app) { application = app; }
32
33 void cacheEntity(EntityBase *entity);
34 EntityBase *getEntity(ot::UID entityID, ot::UID entityVersion);
35
36 void setModelComponent(ot::components::ModelComponent *mdl) { modelComponent = mdl; }
37
38 void removeCachedEntitiesFromList(std::list<std::pair<unsigned long long, unsigned long long>> &prefetchEntities);
39
40 void shrinkCache(void);
41
42 void removeEntity(EntityBase *entity);
43
44 void prefetchEntities(std::list<ot::EntityInformation> &entityList);
45 void prefetchEntities(std::list<std::pair<unsigned long long, unsigned long long>> &prefetchEntities);
46
47private:
48 int maxNumberOfCacheItems;
49 std::map<std::pair<ot::UID, ot::UID>, EntityBase*> entityMap;
50 std::list<EntityBase*> entityList;
51
52 ot::components::ModelComponent *modelComponent;
53 Application* application;
54};
55
Definition Application.h:25
Definition EntityCache.h:26
void cacheEntity(EntityBase *entity)
Definition EntityCache.cpp:47
void removeCachedEntitiesFromList(std::list< std::pair< unsigned long long, unsigned long long > > &prefetchEntities)
Definition EntityCache.cpp:99
void removeEntity(EntityBase *entity)
Definition EntityCache.cpp:93
void prefetchEntities(std::list< ot::EntityInformation > &entityList)
Definition EntityCache.cpp:114
EntityBase * getEntity(ot::UID entityID, ot::UID entityVersion)
Definition EntityCache.cpp:64
~EntityCache()
Definition EntityCache.cpp:18
void setApplication(Application *app)
Definition EntityCache.h:31
void setModelComponent(ot::components::ModelComponent *mdl)
Definition EntityCache.h:36
EntityCache()
Definition EntityCache.cpp:11
void shrinkCache(void)
Definition EntityCache.cpp:30
Definition ModelComponent.h:42
The app namespace contains several functions that may be used to start processes.
Definition Connector.h:8
unsigned long UID
Unique identifier (32 bit unsigned integer)
Definition CoreTypes.h:27