10 #include <Atoms/Globals.h>
11 #include <AtomsCore/Metadata/MapMetadata.h>
12 #include <AtomsCore/Metadata/PoseMetadata.h>
42 AtomsPtr<AtomsCore::MapMetadata> data;
48 typedef std::map<std::string, std::map<int, FrameData>> MapType;
81 std::set<unsigned int>
ids;
115 void requestFrameHeader(
const std::string& cachePath,
const std::string& cacheName,
int frame,
bool multithread=
false);
118 void requestAgentFrame(
const std::string& cachePath,
const std::string& cacheName,
int frame,
const std::vector<int>& ids,
bool multithread =
false);
121 void requestAgentPose(
const std::string& cachePath,
const std::string& cacheName,
int frame,
const std::vector<int>& ids,
bool multithread =
false);
124 void requestAgentMetadata(
const std::string& cachePath,
const std::string& cacheName,
int frame,
const std::vector<int>& ids,
bool multithread =
false);
163 bool hasCache(
const std::string& cachePath,
const std::string& cacheName);
166 void removeCache(
const std::string& cachePath,
const std::string& cacheName);
169 void loadFullCache(
const std::string& cachePath,
const std::string& cacheName);
172 void loadCacheFrames(
const std::string& cachePath,
const std::string& cacheName,
int start,
int end);
177 void requestAgentData(
const std::string& cachePath,
const std::string& cacheName,
int frame,
const std::vector<int>& ids,
short taskType,
bool multithread=
false);
180 size_t computeMemoryUsage();
183 void cleanExtraMemory();
198 std::vector<Task> m_taskQueue;
201 MapType m_agentsMetadata;
204 MapType m_agentsPoses;
207 MapType m_frameHeaders;
210 MapType m_agentsFrames;
213 std::map<std::string, int> m_referenceCount;
216 std::map<std::string, std::list<FrameData>> m_agentsMetadataPool;
217 std::map<std::string, std::list<FrameData>> m_agentsPosesPool;
218 std::map<std::string, std::list<FrameData>> m_agentsFramesPool;
221 size_t m_currentMemorySize;
Definition: CacheManager.h:32
Task class.
Definition: CacheManager.h:52
short type
File type.
Definition: CacheManager.h:84
int frame
Cache frame.
Definition: CacheManager.h:78
bool multithread
Use multitrhead during the deserialization.
Definition: CacheManager.h:87
std::set< unsigned int > ids
Agent ids.
Definition: CacheManager.h:81
std::string cachePath
Cache path.
Definition: CacheManager.h:72
std::string cacheName
Cache name.
Definition: CacheManager.h:75
Cache manager.
Definition: CacheManager.h:28
void requestAgentFrame(const std::string &cachePath, const std::string &cacheName, int frame, const std::vector< int > &ids, bool multithread=false)
Requests a cache frame.
void requestAgentPose(const std::string &cachePath, const std::string &cacheName, int frame, const std::vector< int > &ids, bool multithread=false)
Requests a agent pose.
void getBlendAgentPose(const std::string &cachePath, const std::string &cacheName, double frame, int agentId, const AtomsCore::Skeleton &skeleton, AtomsCore::Pose &pose) const
Gets the blended agent pose.
const AtomsCore::MapMetadata * getAgentMetadata(const std::string &cachePath, const std::string &cacheName, int frame, int agentId) const
Gets the agent metadata.
void clear()
Clear all the caches.
void executeTasks(bool clearNotUsedCache=true)
Executes all the tasks in the queue.
const AtomsCore::MapMetadata * getAgentFrame(const std::string &cachePath, const std::string &cacheName, int frame, int agentId) const
Gets cache frame data.
const AtomsCore::MapMetadata * loadHeaderFrame(const std::string &cachePath, const std::string &cacheName, int frame)
Load cache frame header data.
size_t maxMemory() const
Gets the max memory the manager can use.
void removeCache(const std::string &cachePath, const std::string &cacheName)
Removes a cache from the manager.
static CacheManager & instance()
Singleton access.
size_t memoryUsage() const
Gets the memory used by the manager.
const AtomsCore::Pose * getAgentPose(const std::string &cachePath, const std::string &cacheName, int frame, int agentId) const
Gets the agent pose.
const MapType & agentsFrames() const
Get cache frames.
const MapType & agentsMetadata() const
Gets agents metadatas.
void loadFullCache(const std::string &cachePath, const std::string &cacheName)
Loads a full cache inside the manager.
void setMaxMemory(size_t value)
Sets the max memory the manager can use.
const MapType & frameHeaders() const
Gets frame headers.
void blendPose(const AtomsCore::Skeleton &skeleton, std::vector< const AtomsCore::Pose * > &posePorts, std::vector< double > &weightPorts, AtomsCore::Pose &outPose) const
Blends poses.
void getBlendAgentMetadata(const std::string &cachePath, const std::string &cacheName, double frame, int agentId, AtomsCore::MapMetadata &mapMeta) const
Gets the blended agent metadatas.
void blendMetadata(AtomsCore::MapMetadata &outMetadata, std::vector< const AtomsCore::MapMetadata * > &inMetadatas, const std::vector< double > &inputWeightVector) const
Blends mapMetadata.
const MapType & agentsPoses() const
Gets agents poses.
const AtomsCore::MapMetadata * getHeaderFrame(const std::string &cachePath, const std::string &cacheName, int frame) const
Get cache frame header data.
void requestFrameHeader(const std::string &cachePath, const std::string &cacheName, int frame, bool multithread=false)
Requests a cache frame header.
void requestAgentMetadata(const std::string &cachePath, const std::string &cacheName, int frame, const std::vector< int > &ids, bool multithread=false)
Requests a agent metadatas.
void loadCacheFrames(const std::string &cachePath, const std::string &cacheName, int start, int end)
Loads frames of a cahce inside the manager.
Pose class.
Definition: Pose.h:32
Skeleton class.
Definition: Skeleton.h:68
Atoms namespace.
Definition: Agent.h:29