Track::SaveableClassList Class Reference

Read and write objects of any class derived from Savable from/to a file. More...

#include <ClassLoader.h>

List of all members.

Public Member Functions

template<class T>
void register_class (ClassLoader< T > *loader)
 register a class so we may load data from it.
template<class T>
boost::shared_ptr< T > load_object (std::istream &source)
 Load an object from a stream.
template<class T>
void write_object (std::ostream &destination, const T &object)
 Write an object so that it can be loaded again without knowing the type.
template<class T>
void fill_vector (std::istream &source, std::vector< boost::shared_ptr< T > > &vector)
 Load many objects from a stream.
template<class Container>
void write_vector (std::ostream &destination, const Container &vector)
 Write many objects to a stream.

Static Public Member Functions

static SaveableClassListget_instance ()
 Get the instance of the class.

Private Member Functions

 SaveableClassList ()
 SaveableClassList (const SaveableClassList &source)
bool operator= (const SaveableClassList &source)

Private Attributes

std::map< std::string, ClassLoaderBase * > loaders


Detailed Description

Read and write objects of any class derived from Savable from/to a file.

This is a singleton object, you may access the single instance with get_instance(). To register a class to be loaded in this manner, make a global ClassLoader.

Definition at line 70 of file ClassLoader.h.


Constructor & Destructor Documentation

Track::SaveableClassList::SaveableClassList (  )  [private]

Definition at line 30 of file ClassLoader.cpp.

Track::SaveableClassList::SaveableClassList ( const SaveableClassList source  )  [private]


Member Function Documentation

template<class T>
void Track::SaveableClassList::fill_vector ( std::istream &  source,
std::vector< boost::shared_ptr< T > > &  vector 
) [inline]

Load many objects from a stream.

Definition at line 138 of file ClassLoader.h.

SaveableClassList * Track::SaveableClassList::get_instance (  )  [static]

Get the instance of the class.

Definition at line 34 of file ClassLoader.cpp.

template<class T>
boost::shared_ptr<T> Track::SaveableClassList::load_object ( std::istream &  source  )  [inline]

Load an object from a stream.

Definition at line 89 of file ClassLoader.h.

bool Track::SaveableClassList::operator= ( const SaveableClassList source  )  [private]

template<class T>
void Track::SaveableClassList::register_class ( ClassLoader< T > *  loader  )  [inline]

register a class so we may load data from it.

Definition at line 82 of file ClassLoader.h.

template<class T>
void Track::SaveableClassList::write_object ( std::ostream &  destination,
const T &  object 
) [inline]

Write an object so that it can be loaded again without knowing the type.

Requires the class will return the identifier it's ClassLoader uses with a function std::string get_class_identifier(), and will work with operator<< to streams.

Definition at line 128 of file ClassLoader.h.

template<class Container>
void Track::SaveableClassList::write_vector ( std::ostream &  destination,
const Container &  vector 
) [inline]

Write many objects to a stream.

Container should store boost::shared_ptrs to the type of object you wish to save. It should follow the forward container concept from the standard template library.

Definition at line 168 of file ClassLoader.h.


Member Data Documentation

std::map<std::string, ClassLoaderBase *> Track::SaveableClassList::loaders [private]

Definition at line 181 of file ClassLoader.h.


The documentation for this class was generated from the following files:
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.