Ocular Engine
Resource.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_RESOURCES_RESOURCE__H__
19 #define __H__OCULAR_RESOURCES_RESOURCE__H__
20 
21 #include "ResourceType.hpp"
22 #include "FileIO/File.hpp"
23 #include "Utilities/Types.hpp"
24 
25 #include <cstdint>
26 
27 //------------------------------------------------------------------------------------------
28 
33 namespace Ocular
34 {
39  namespace Core
40  {
41  class ResourceMetadata;
42 
46  class Resource
47  {
48  public:
49 
53  Resource(File const& source);
54  Resource();
55 
56  virtual ~Resource();
57 
58  //----------------------------------------
59  // Virtual Methods
60 
64  virtual void unload();
65 
69  virtual void forceLoad();
70 
71  //----------------------------------------
72  // Non-Virtual Methods
73 
77  File getSourceFile() const;
78 
83  void setSourceFile(File const& file);
84 
89  void setIsInMemory(bool inMemory);
90 
94  bool isInMemory() const;
95 
100  void setSize(uint64_t size);
101 
105  uint64_t getSize() const;
106 
110  ResourceType getResourceType() const;
111 
115  void setName(std::string const& name);
116 
120  std::string const& getName() const;
121 
126  std::string const& getMappingName() const;
127 
131  void setMappingName(std::string const& name);
132 
136  ResourceMetadata* getMetadata() const;
137 
146  void setMetadata(ResourceMetadata* metadata);
147 
148  protected:
149 
150  ResourceType m_Type;
151  ResourceMetadata* m_Metadata;
152 
153  File m_SourceFile;
154  bool m_IsInMemory;
155 
156  uint64_t m_SizeInMemory;
157 
158  std::string m_Name;
159  std::string m_MappingName;
160 
161  private:
162 
163  };
164  }
168 }
173 OCULAR_REGISTER_TYPE_CUSTOM(Ocular::Core::Resource, "Resource");
174 
175 //------------------------------------------------------------------------------------------
176 
177 #endif
void setSize(uint64_t size)
Definition: Resource.cpp:126
void setSourceFile(File const &file)
Definition: Resource.cpp:111
void setMetadata(ResourceMetadata *metadata)
Definition: Resource.cpp:166
ResourceType getResourceType() const
Definition: Resource.cpp:136
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
bool isInMemory() const
Definition: Resource.cpp:121
uint64_t getSize() const
Definition: Resource.cpp:131
void setIsInMemory(bool inMemory)
Definition: Resource.cpp:116
Definition: File.hpp:41
File getSourceFile() const
Definition: Resource.cpp:106
virtual void forceLoad()
Definition: Resource.cpp:101
ResourceMetadata * getMetadata() const
Definition: Resource.cpp:161
virtual void unload()
Definition: Resource.cpp:96
std::string const & getMappingName() const
Definition: Resource.cpp:151
Definition: Resource.hpp:46
Definition: ResourceMetadata.hpp:44
void setMappingName(std::string const &name)
Definition: Resource.cpp:156