frepple::utils::MetaCategory Class Reference

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

#include <utils.h>

Inheritance diagram for frepple::utils::MetaCategory:

List of all members.

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 Member Functions

const MetaClassfindClass (const hashtype) const
const MetaClassfindClass (const char *) const
 MetaCategory (const string &t, const string &g, readController=NULL, writeController=NULL)
virtual ~MetaCategory ()

Static Public Member Functions

static ObjectControllerDefault (const MetaClass *, const AttributeList &)
static const MetaCategoryfindCategoryByGroupTag (const hashtype)
static const MetaCategoryfindCategoryByGroupTag (const char *)
static const MetaCategoryfindCategoryByTag (const hashtype)
static const MetaCategoryfindCategoryByTag (const char *)
static void persist (XMLOutput *)

Public Attributes

string group
const Keywordgrouptag
readController readFunction

Friends

class HasName
class MetaClass

Detailed Description

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 1370 of file utils.h.


Member Typedef Documentation

Type definition for the map of all categories.

Definition at line 1403 of file utils.h.

Type definition for the map of all registered classes.

Definition at line 1400 of file utils.h.

Type definition for the read control function.

Definition at line 1382 of file utils.h.

Type definition for the write control function.

Definition at line 1385 of file utils.h.


Constructor & Destructor Documentation

virtual frepple::utils::MetaCategory::~MetaCategory (  )  [inline, virtual]

Destructor.

Definition at line 1393 of file utils.h.

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

Constructor.

Definition at line 248 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 405 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 300 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 292 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 284 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 276 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 316 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 308 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 324 of file utils/library.cpp.


Friends And Related Function Documentation

friend class HasName [friend]

Definition at line 1373 of file utils.h.

friend class MetaClass [friend]

Definition at line 1372 of file utils.h.


Member Data Documentation

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

Definition at line 1376 of file utils.h.

A XML tag grouping objects of the category.

Definition at line 1379 of file utils.h.

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 1441 of file utils.h.


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

Documentation generated for frePPLe by  doxygen