This class is used to facilitate file loading.
More...
#include <SurgSim/Framework/Asset.h>
This class is used to facilitate file loading.
It uses the static ApplicationData in SurgSim::Framework::Runtime to load file. Classes not in SurgSim::Framework::Component hierarchy should inherit this class in order to load a file.
SurgSim::Framework::Asset::Asset |
( |
| ) |
|
SurgSim::Framework::Asset::~Asset |
( |
| ) |
|
|
virtual |
virtual bool SurgSim::Framework::Asset::doLoad |
( |
const std::string & |
filePath | ) |
|
|
protectedpure virtual |
std::string SurgSim::Framework::Asset::getFileName |
( |
| ) |
const |
Return the name of file loaded by this class.
- Returns
- Name of the file loaded by this class.
Load a file with given name using 'data' as look up path(s).
If 'fileName' is not empty and the file is found, this method calls 'doLoad()' to load the file. Assertions will fail if 'fileName' is empty or file is not found or file loading is unsuccessful.
- Note
- As a side effect, the name of the file will be recorded in
-
Asset::m_fileName and can be retrieved by Asset::getFileName().
- Parameters
-
fileName | Name of the file to be loaded. |
data | ApplicationData which provides the runtime look up path(s). |
void SurgSim::Framework::Asset::load |
( |
const std::string & |
fileName | ) |
|
Derived classes (which also inherit from SurgSim::Framework::Accessible) should call this function with 'this' pointer as the parameter in their constructors to register file name property for serialization.
- Parameters
-
accessible | 'this' pointer of derived class. |
friend SurgSim::Framework::Asset::AssetTest |
|
private |
std::string SurgSim::Framework::Asset::m_fileName |
|
private |
Name of the file to be loaded.
The documentation for this class was generated from the following files: