Select Git revision
header.html
Forked from
einsteinathome / graphicsframework
Source project has a limited visibility.
-
Oliver Bock authored
* Logos at the top * Proper stylesheet (better heading handling) * Added LSC logo
Oliver Bock authored* Logos at the top * Proper stylesheet (better heading handling) * Added LSC logo
ResourceFactory.h 2.81 KiB
#ifndef RESOURCEFACTORY_H_
#define RESOURCEFACTORY_H_
#include <string>
#include <map>
#include <iostream>
#include "Resource.h"
/**
* \brief This factory instantiates Resource objects using a given identifier
*
* During contruction of the factory object itself it loads all available resources into
* an internal cache. The user can subsequently request a copy of this resource by specifying
* it using the resource's identifier.
*
* The resource data is expected to be stored in these three externally linked arrays:
* <ul>
* <li>\ref c_ResourceIdentifiers</li>
* <li>\ref c_ResourceIndex</li>
* <li>\ref c_ResourceStorage</li>
* </ul>
* These arrays are compiled using the Open Resource Compiler (ORC) which can be found
* in the \c orc subdirectory.
*
* \see Resource
* \see ResourceCompiler
*
* \author Oliver Bock\n
* Max-Planck-Institute for Gravitational Physics\n
* Hannover, Germany
*/
class ResourceFactory
{
public:
/// Default constructor
ResourceFactory();
/// Destructor
virtual ~ResourceFactory();
/**
* \brief Creates an instance of the requested resource
*
* The identifier has to be the same as the one specified in the \c *.orc file
* used to compile the resources
*
* \param identifier The identifer of the resource to be instantiated
*
* \return A constant pointer to the newly instantiated resource
* or NULL if the specified resource could not be found
*
* \see ResourceCompiler
*/
const Resource* createInstance(const string identifier);
private:
/// Hashtable mapping identifiers to resource data
map<string, vector<unsigned char> > m_ResourceMap;
};
/**
* \brief Declaration of the external list of resource identifiers
*
* \todo Does this need to be global?
* Maybe we should wrap a class around the generated resources?
*/
extern const string c_ResourceIdentifiers[];
/**