23 #include "tools/Tools.h"
32 ActionRegister::~ActionRegister(){
35 for(
mIterator p=
m.begin();p!=
m.end();++p)names+=p->first+
" ";
36 std::cerr<<
"WARNING: Directive "+ names +
" has not been properly unregistered. This might lead to memory leak!!\n";
45 void ActionRegister::remove(creator_pointer f){
58 m.insert(pair<string,creator_pointer>(key,f));
62 mk.insert(pair<string,keywords_pointer>(key,k));
66 bool ActionRegister::check(
string key){
67 if(
m.count(key)>0 && mk.count(key)>0)
return true;
72 if(ao.
line.size()<1)
return NULL;
80 if( check(ao.
line[0]) ){
83 action=
m[ao.
line[0]](nao);
89 bool ActionRegister::printManual(
const std::string& action ){
99 bool ActionRegister::printTemplate(
const std::string& action,
bool include_optional ){
112 s.push_back((*it).first);
113 sort(s.begin(),s.end());
114 for(
unsigned i=0;i<s.size();i++) log<<
" "<<s[i]<<
"\n";
118 sort(s.begin(),s.end());
119 log<<
"+++++++ WARNING +++++++\n";
120 log<<
"The following keywords have been registered more than once and will be disabled:\n";
121 for(
unsigned i=0;i<s.size();i++) log<<
" - "<<s[i]<<
"\n";
122 log<<
"+++++++ END WARNING +++++++\n";
ActionRegister & actionRegister()
void add(const Value &val1, Value *val2)
void copy(const Value &val1, Value &val2)
void destroyData()
Clear everything from the keywords object.
This class holds the keywords and their documentation.
This class is used to bring the relevant information to the Action constructor.
Base class for all the input Actions.
std::map< std::string, creator_pointer > m
Map action to a function which creates the related object.
void print_template(const std::string &actionname, bool include_optional) const
Print the template version for the documenation.
std::map< std::string, creator_pointer >::iterator mIterator
Iterator over the map.
std::vector< std::string > line
Input line which sets up the action.
std::map< std::string, creator_pointer >::const_iterator const_mIterator
Iterator over the map.
void print_html(const bool isaction) const
Print an html version of the documentation.
Register holding all the allowed keywords.
std::ostream & operator<<(std::ostream &log, const ActionRegister &ar)
std::set< std::string > disabled
Set of disabled actions (which were registered more than once)