This class stores metadata on a data field of a class. More...

#include <utils.h>

Inheritance diagram for frepple::utils::MetaCategory:

Public Types

typedef map< hashtype, const
MetaCategory *, less< hashtype > > 
CategoryMap
 
typedef map< hashtype, const
MetaClass *, less< hashtype > > 
ClassMap
 
typedef Object *(* readController )(const MetaClass *, const AttributeList &)
 
typedef void(* writeController )(const MetaCategory *, XMLOutput *o)
 
- Public Types inherited from frepple::utils::MetaClass
typedef Object *(* creatorDefault )()
 
typedef Object *(* creatorString )(const string &)
 

Public Member Functions

const MetaClassfindClass (const char *) const
 
const MetaClassfindClass (const hashtype) const
 
 MetaCategory (const string &t, const string &g, readController=NULL, writeController=NULL)
 
virtual ~MetaCategory ()
 
- Public Member Functions inherited from frepple::utils::MetaClass
void connect (Functor *c, Signal a) const
 
void disconnect (Functor *c, Signal a) const
 
 MetaClass (const string &cat, const string &cls, bool def=false)
 
 MetaClass (const string &cat, const string &cls, creatorDefault f, bool def=false)
 
 MetaClass (const string &cat, const string &cls, creatorString f, bool def=false)
 
 MetaClass ()
 
bool operator!= (const MetaClass &b) const
 
bool operator< (const MetaClass &b) const
 
bool operator== (const MetaClass &b) const
 
bool raiseEvent (Object *v, Signal a) const
 
void registerClass (const string &, const string &, bool=false, creatorDefault=NULL)
 
virtual ~MetaClass ()
 

Static Public Member Functions

static ObjectControllerDefault (const MetaClass *, const AttributeList &)
 
static const MetaCategoryfindCategoryByGroupTag (const char *)
 
static const MetaCategoryfindCategoryByGroupTag (const hashtype)
 
static const MetaCategoryfindCategoryByTag (const char *)
 
static const MetaCategoryfindCategoryByTag (const hashtype)
 
static void persist (XMLOutput *)
 
- Static Public Member Functions inherited from frepple::utils::MetaClass
static Action decodeAction (const char *)
 
static Action decodeAction (const AttributeList &)
 
static const MetaClassfindClass (const char *)
 
static void printClasses ()
 

Public Attributes

string group
 
const Keywordgrouptag
 
readController readFunction
 
- Public Attributes inherited from frepple::utils::MetaClass
union {
   creatorDefault   factoryMethodDefault
 
   creatorString   factoryMethodString
 
}; 
 
const MetaCategorycategory
 
PyTypeObject * pythonClass
 
string type
 
const Keywordtypetag
 

Friends

template<class T >
class HasName
 
class MetaClass
 

Additional Inherited Members

- Protected Member Functions inherited from frepple::utils::NonCopyable
 NonCopyable ()
 
 ~NonCopyable ()
 

Detailed Description

This class stores metadata on a data field of a class.

A fieldConstructor. A MetaCategory instance represents metadata for a category of object.

A MetaClass instance represents metadata for a specific instance type. For instance, 'Resource' is a category while 'ResourceDefault' and 'ResourceInfinite' are specific classes.
A category has the following specific pieces of data:

  • A reader function for creating objects.
    The reader function creates objects for all classes registered with it.
  • A writer function for persisting objects.
    The writer function will typically iterate over all objects of the category and call the writeElement method on them.
  • A group tag used for the grouping objects of the category in the XML output stream.
    See Also
    MetaClass

Definition at line 1173 of file utils.h.

Member Typedef Documentation

Type definition for the map of all categories.

Definition at line 1206 of file utils.h.

Type definition for the map of all registered classes.

Definition at line 1203 of file utils.h.

typedef Object*(* frepple::utils::MetaCategory::readController)(const MetaClass *, const AttributeList &)

Type definition for the read control function.

Definition at line 1185 of file utils.h.

typedef void(* frepple::utils::MetaCategory::writeController)(const MetaCategory *, XMLOutput *o)

Type definition for the write control function.

Definition at line 1188 of file utils.h.

Constructor & Destructor Documentation

virtual frepple::utils::MetaCategory::~MetaCategory ( )
inlinevirtual

Destructor.

Definition at line 1196 of file utils.h.

frepple::utils::MetaCategory::MetaCategory ( const string &  t,
const string &  g,
readController  f = NULL,
writeController  w = NULL 
)

Constructor.

Definition at line 351 of file utils/library.cpp.

Member Function Documentation

Object * frepple::utils::MetaCategory::ControllerDefault ( const MetaClass cat,
const AttributeList in 
)
static

This template method is available as a object creation factory for classes without key fields and which rely on a default constructor.

Definition at line 508 of file utils/library.cpp.

const MetaCategory * frepple::utils::MetaCategory::findCategoryByGroupTag ( const char *  c)
static

Looks up a category name in the registry. If the catgory can't be located the return value is NULL.

Definition at line 395 of file utils/library.cpp.

const MetaCategory * frepple::utils::MetaCategory::findCategoryByGroupTag ( const hashtype  h)
static

Looks up a category name in the registry. If the category can't be located the return value is NULL.

Definition at line 403 of file utils/library.cpp.

const MetaCategory * frepple::utils::MetaCategory::findCategoryByTag ( const char *  c)
static

Looks up a category name in the registry. If the catgory can't be located the return value is NULL.

Definition at line 379 of file utils/library.cpp.

const MetaCategory * frepple::utils::MetaCategory::findCategoryByTag ( const hashtype  h)
static

Looks up a category name in the registry. If the catgory can't be located the return value is NULL.

Definition at line 387 of file utils/library.cpp.

const MetaClass * frepple::utils::MetaCategory::findClass ( const char *  c) const

Find a class in this category with a specified name.
If the catrgory can't be found the return value is NULL.

Definition at line 411 of file utils/library.cpp.

const MetaClass * frepple::utils::MetaCategory::findClass ( const hashtype  h) const

Find a class in this category with a specified name.
If the catrgory can't be found the return value is NULL.

Definition at line 419 of file utils/library.cpp.

void frepple::utils::MetaCategory::persist ( XMLOutput o)
static

This method takes care of the persistence of all categories. It loops through all registered categories (in the order of their registration) and calls the persistance handler.

Definition at line 427 of file utils/library.cpp.

Friends And Related Function Documentation

template<class T >
friend class HasName
friend

Definition at line 1176 of file utils.h.

friend class MetaClass
friend

Definition at line 1175 of file utils.h.

Member Data Documentation

string frepple::utils::MetaCategory::group

The name used to name a collection of objects of this category.

Definition at line 1179 of file utils.h.

const Keyword* frepple::utils::MetaCategory::grouptag

A XML tag grouping objects of the category.

Definition at line 1182 of file utils.h.

readController frepple::utils::MetaCategory::readFunction

A control function for reading objects of a category. The controller function manages the creation and destruction of objects in this category.

Definition at line 1244 of file utils.h.


The documentation for this class was generated from the following files: