Atoms Crowd  7.0.0
FileCache.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #ifndef ATOMS_UNREAL
11 
12 #include <Atoms/Globals.h>
13 #include <string>
14 #include <map>
15 #include <Atoms/AnimationClip.h>
16 #include <AtomsCore/Skeleton.h>
17 
18 namespace Atoms
19 {
20  template <class T>
21  class ATOMS_EXPORT FileCache
22  {
23  public:
24 
25  void insert(const std::string& filePath, const std::string& filter, const T& value);
26 
27  bool contains(const std::string& filePath, const std::string& filter);
28 
29  void clear();
30 
31  bool hasChanged(const std::string& filePath);
32 
33  const T* get(const std::string& filePath, const std::string& filter);
34 
35  private:
36  std::map<std::pair<std::string, std::string>, T> m_cache;
37  std::map<std::string, std::pair<time_t, off_t>> m_dataCache;
38  };
39 
40  template<> ATOMS_EXPORT void FileCache<AnimationClip>::insert(const std::string& filePath, const std::string& filter, const AnimationClip& value);
41  template<> ATOMS_EXPORT bool FileCache<AnimationClip>::contains(const std::string& filePath, const std::string& filter);
42  template<> ATOMS_EXPORT bool FileCache<AnimationClip>::hasChanged(const std::string& filePath);
43  template<> ATOMS_EXPORT const AnimationClip* FileCache<AnimationClip>::get(const std::string& filePath, const std::string& filter);
44  template<> ATOMS_EXPORT void FileCache<AnimationClip>::clear();
45 
46  template<> ATOMS_EXPORT void FileCache<AtomsPtr<AtomsCore::MapMetadata>>::insert(const std::string& filePath, const std::string& filter, const AtomsPtr<AtomsCore::MapMetadata>& value);
47  template<> ATOMS_EXPORT bool FileCache<AtomsPtr<AtomsCore::MapMetadata>>::contains(const std::string& filePath, const std::string& filter);
48  template<> ATOMS_EXPORT bool FileCache<AtomsPtr<AtomsCore::MapMetadata>>::hasChanged(const std::string& filePath);
49  template<> ATOMS_EXPORT const AtomsPtr<AtomsCore::MapMetadata>* FileCache<AtomsPtr<AtomsCore::MapMetadata>>::get(const std::string& filePath, const std::string& filter);
50  template<> ATOMS_EXPORT void FileCache<AtomsPtr<AtomsCore::MapMetadata>>::clear();
51 
52  template<> ATOMS_EXPORT void FileCache<AtomsCore::Skeleton>::insert(const std::string& filePath, const std::string& filter, const AtomsCore::Skeleton& value);
53  template<> ATOMS_EXPORT bool FileCache<AtomsCore::Skeleton>::contains(const std::string& filePath, const std::string& filter);
54  template<> ATOMS_EXPORT bool FileCache<AtomsCore::Skeleton>::hasChanged(const std::string& filePath);
55  template<> ATOMS_EXPORT const AtomsCore::Skeleton* FileCache<AtomsCore::Skeleton>::get(const std::string& filePath, const std::string& filter);
56  template<> ATOMS_EXPORT void FileCache<AtomsCore::Skeleton>::clear();
57 
58 }
59 
60 #endif
Animation clip.
Definition: AnimationClip.h:221
Definition: FileCache.h:22
Skeleton class.
Definition: Skeleton.h:68
Atoms namespace.
Definition: Agent.h:29