Track::ClassLoader< T > Class Template Reference

An object which will be used to load a class from a file, when we are not sure of the exact type of the object when loading. More...

#include <ClassLoader.h>

Inheritance diagram for Track::ClassLoader< T >:

Track::ClassLoaderBase List of all members.

Public Member Functions

 ClassLoader (std::string name)
 Create a ClassLoader for a specific class.
virtual boost::shared_ptr<
Savable
create (std::istream &source) const
 Create an object by reading its info from a file.
virtual std::string get_identifier () const
 Get the unique identification string for the class.

Protected Attributes

std::string m_name
 The unique identifier for the class.

Detailed Description

template<class T>
class Track::ClassLoader< T >

An object which will be used to load a class from a file, when we are not sure of the exact type of the object when loading.

Must not be destroyed before a file is loaded, as it is required to decode it then. It registers itself with the SavableClassInstance when created, but does not unregister when destroyed.

Parameters:
T The class to create.

Definition at line 192 of file ClassLoader.h.


Constructor & Destructor Documentation

template<class T>
Track::ClassLoader< T >::ClassLoader ( std::string  name  )  [inline]

Create a ClassLoader for a specific class.

This must be a global variable, as it must not be deleted before a class is loaded.

Parameters:
name the Unique name to associate with when loading the class of a file. It is recommended to be the class name including namespace.

Definition at line 203 of file ClassLoader.h.


Member Function Documentation

template<class T>
virtual boost::shared_ptr<Savable> Track::ClassLoader< T >::create ( std::istream &  source  )  const [inline, virtual]

Create an object by reading its info from a file.

Parameters:
source The file to read from. The file will be advanced to the end of the loaded object.
Returns:
A boost shared pointer to the newly loaded object.

Implements Track::ClassLoaderBase.

Definition at line 214 of file ClassLoader.h.

template<class T>
virtual std::string Track::ClassLoader< T >::get_identifier (  )  const [inline, virtual]

Get the unique identification string for the class.

Implements Track::ClassLoaderBase.

Definition at line 221 of file ClassLoader.h.


Member Data Documentation

template<class T>
std::string Track::ClassLoader< T >::m_name [protected]

The unique identifier for the class.

Definition at line 227 of file ClassLoader.h.


The documentation for this class was generated from the following file:
Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:18 2010 by Doxygen version 1.4.7 for Racer version svn335.