Asset.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_FRAMEWORK_ASSET_H
17 #define SURGSIM_FRAMEWORK_ASSET_H
18 
19 #include <string>
20 
21 namespace SurgSim
22 {
23 namespace Framework
24 {
25 class Accessible;
26 class ApplicationData;
27 class AssetTest;
28 
33 class Asset
34 {
35  friend AssetTest;
36 public:
38  Asset();
39 
41  virtual ~Asset();
42 
50  void load(const std::string& fileName, const SurgSim::Framework::ApplicationData& data);
51 
54  void load(const std::string& fileName);
55 
58  std::string getFileName() const;
59 
60 protected:
65  virtual bool doLoad(const std::string& filePath) = 0;
66 
71 
72 private:
75 };
76 
77 } // namespace Framework
78 } // namespace SurgSim
79 
80 #endif // SURGSIM_FRAMEWORK_ASSET_H
void serializeFileName(SurgSim::Framework::Accessible *accessible)
Derived classes (which also inherit from SurgSim::Framework::Accessible) should call this function wi...
Definition: Asset.cpp:57
Definition: DriveElementFromInputBehavior.cpp:27
This class is used to facilitate file loading.
Definition: Asset.h:33
Enable searching for files in a given list of paths, give access to the current directory and wrap bo...
Definition: ApplicationData.h:39
friend AssetTest
Definition: Asset.h:35
std::string getFileName() const
Return the name of file loaded by this class.
Definition: Asset.cpp:52
void load(const std::string &fileName, const SurgSim::Framework::ApplicationData &data)
Load a file with given name using &#39;data&#39; as look up path(s).
Definition: Asset.cpp:36
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
virtual bool doLoad(const std::string &filePath)=0
Derived classes will overwrite this method to do actual loading.
Asset()
Constructor.
Definition: Asset.cpp:28
std::string m_fileName
Name of the file to be loaded.
Definition: Asset.h:74
virtual ~Asset()
Destructor.
Definition: Asset.cpp:32
Mixin class for enabling a property system on OSS classes, the instance still needs to initialize pro...
Definition: Accessible.h:36