BOSS 6.6.4.p01
BESIII Offline Software System
|
Factory for all Issues. More...
#include <IssueFactory.h>
Public Types | |
typedef Issue *(* | CreateIssueCallback) () |
typedef std::map< std::string, CreateIssueCallback > | CallbackMap |
Public Member Functions | |
bool | register_issue (const std::string &name, CreateIssueCallback creator) |
register an issue factory | |
Issue * | build (const std::string &name) const |
build an empty issue out of a name | |
Issue * | build (const std::string &name, const string_map_type *values) const |
build a issue out of name and set values | |
Issue * | build (const Issue *original) |
build a clone of an issue | |
void | write_to (std::ostream &stream) const |
writes description to stream | |
Static Public Member Functions | |
static IssueFactory * | instance () |
method to access singleton | |
static void | print_registered () |
prints all registered issue types | |
Protected Member Functions | |
IssueFactory () | |
Protected Attributes | |
CallbackMap | m_factory_map |
Static Protected Attributes | |
static IssueFactory * | s_factory = 0 |
Factory for all Issues.
This class implements the factory pattern for Issues. The main responsability of this class is to keep track of the existing types of Issues Each issue should register one factory method for instances of this class. This is needed for deserializing of Issues.
Definition at line 31 of file IssueFactory.h.
typedef std::map<std::string,CreateIssueCallback> ers::IssueFactory::CallbackMap |
Definition at line 34 of file IssueFactory.h.
typedef Issue *(* ers::IssueFactory::CreateIssueCallback) () |
Definition at line 33 of file IssueFactory.h.
|
protected |
Definition at line 21 of file IssueFactory.cxx.
ers::Issue * ers::IssueFactory::build | ( | const Issue * | original | ) |
build a clone of an issue
Clones an Issue. This method creates (using the other build methods) an new Issue with the same value table
original | the Issue to be cloned |
Definition at line 91 of file IssueFactory.cxx.
ers::Issue * ers::IssueFactory::build | ( | const std::string & | name | ) | const |
build an empty issue out of a name
Builds an issue out of the name it was registered with
name | the name used to indentify the class |
name
or DefaultIssue Definition at line 57 of file IssueFactory.cxx.
Referenced by ers::Issue::clone().
ers::Issue * ers::IssueFactory::build | ( | const std::string & | name, |
const string_map_type * | values | ||
) | const |
build a issue out of name and set values
Builds an issue out of a name and a value table
name | the name used to indentify the class |
values | the value-table containing the state for the Issue |
Definition at line 76 of file IssueFactory.cxx.
|
static |
method to access singleton
Finds the singleton instance of the factory. If the instance is not allocated yet, it is.
Definition at line 28 of file IssueFactory.cxx.
Referenced by ers::Issue::clone().
|
static |
prints all registered issue types
Definition at line 35 of file IssueFactory.cxx.
bool ers::IssueFactory::register_issue | ( | const std::string & | name, |
CreateIssueCallback | creator | ||
) |
register an issue factory
Register an issue type with the factory
name | the name that will be used to lookup new instances |
creator | a pointer to the function used to create new instance for that particular type of function |
true
if the name was already present in the table Definition at line 47 of file IssueFactory.cxx.
void ers::IssueFactory::write_to | ( | std::ostream & | stream | ) | const |
writes description to stream
Definition at line 100 of file IssueFactory.cxx.
|
protected |
Definition at line 37 of file IssueFactory.h.
|
staticprotected |
Definition at line 38 of file IssueFactory.h.