All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
PLMD::Keywords Class Reference

This class holds the keywords and their documentation. More...

#include <Keywords.h>

Classes

class  KeyType
 This class lets me pass keyword types easily. More...
 

Public Member Functions

bool getLogicalDefault (std::string key, bool &def) const
 find out whether flag key is on or off by default. More...
 
bool getDefaultValue (std::string key, std::string &def) const
 Get the value of the default for the keyword named key. More...
 
unsigned size () const
 Return the number of defined keywords. More...
 
bool numbered (const std::string &k) const
 Check if numbered keywords are allowed for this action. More...
 
std::string getKeyword (const unsigned i) const
 Return the ith keyword. More...
 
void print (Log &log) const
 Print the documentation to the log file (used by PLMD::Action::error) More...
 
void print (FILE *out) const
 Print the documentation to a file (use by PLUMED::CLTool::readCommandLineArgs) More...
 
void reserve (const std::string &t, const std::string &k, const std::string &d, const bool isvessel=false)
 Reserve a keyword. More...
 
void reserveFlag (const std::string &k, const bool def, const std::string &d, const bool isvessel=false)
 Reserve a flag. More...
 
void use (const std::string &k)
 Use one of the reserved keywords. More...
 
std::string get (const unsigned k) const
 Get the ith keyword. More...
 
void add (const std::string &t, const std::string &k, const std::string &d)
 Add a new keyword of type t with name k and description d. More...
 
void add (const std::string &t, const std::string &k, const std::string &def, const std::string &d)
 Add a new compulsory keyword (t must equal compulsory) with name k, default value def and description d. More...
 
void addFlag (const std::string &k, const bool def, const std::string &d)
 Add a falg with name k that is by default on if def is true and off if def is false. d should provide a description of the flag. More...
 
void remove (const std::string &k)
 Remove the keyword with name k. More...
 
bool exists (const std::string &k) const
 Check if there is a keyword with name k. More...
 
bool reserved (const std::string &k) const
 Check the keyword k has been reserved. More...
 
bool style (const std::string &k, const std::string &t) const
 Check if the keyword with name k has style t. More...
 
void print_html (const bool isaction) const
 Print an html version of the documentation. More...
 
void print_template (const std::string &actionname, bool include_optional) const
 Print the template version for the documenation. More...
 
void reset_style (const std::string &k, const std::string &style)
 Change the style of a keyword. More...
 
void add (const Keywords &keys)
 Add keywords from one keyword object to another. More...
 
void copyData (std::vector< std::string > &kk, std::vector< std::string > &rk, std::map< std::string, KeyType > &tt, std::map< std::string, bool > &am, std::map< std::string, std::string > &docs, std::map< std::string, bool > &bools, std::map< std::string, std::string > &nums, std::map< std::string, std::string > &atags, std::vector< std::string > &cnam, std::map< std::string, std::string > &ck, std::map< std::string, std::string > &cd) const
 Copy the keywords data. More...
 
void destroyData ()
 Clear everything from the keywords object. More...
 
void setComponentsIntroduction (const std::string &instr)
 Set the text that introduces how the components for this action are introduced. More...
 
void addOutputComponent (const std::string &name, const std::string &key, const std::string &descr)
 Add a potential component which can be output by this particular action. More...
 
bool outputComponentExists (const std::string &name, const bool &custom) const
 Has a component with this name been added? More...
 

Private Member Functions

void print_html_item (const std::string &) const
 Print the documentation for the jth keyword in html. More...
 
void printKeyword (const std::string &j, Log &log) const
 Print a particular keyword. More...
 
void printKeyword (const std::string &j, FILE *out) const
 Print a particular keyword (copy of the above that works with files) More...
 

Private Attributes

std::vector< std::string > keys
 The names of the allowed keywords. More...
 
std::vector< std::string > reserved_keys
 The names of the reserved keywords. More...
 
std::map< std::string, KeyTypetypes
 Whether the keyword is compulsory, optional... More...
 
std::map< std::string, bool > allowmultiple
 Do we allow stuff like key1, key2 etc. More...
 
std::map< std::string,
std::string > 
documentation
 The documentation for the keywords. More...
 
std::map< std::string, bool > booldefs
 The default values for the flags (are they on or of) More...
 
std::map< std::string,
std::string > 
numdefs
 The default values (if there are default values) for compulsory keywords. More...
 
std::map< std::string,
std::string > 
atomtags
 The tags for atoms - we use this so the manual can differentiate between different ways of specifying atoms. More...
 
std::string cstring
 The string that should be printed out to describe how the components work for this particular action. More...
 
std::vector< std::string > cnames
 The names of all the possible components for an action. More...
 
std::map< std::string,
std::string > 
ckey
 The keyword that turns on a particular component. More...
 
std::map< std::string,
std::string > 
cdocs
 The documentation for a particular component. More...
 

Friends

class Action
 

Detailed Description

This class holds the keywords and their documentation.

Definition at line 36 of file Keywords.h.

Member Function Documentation

void PLMD::Keywords::add ( const std::string &  t,
const std::string &  k,
const std::string &  d 
)

Add a new keyword of type t with name k and description d.

Definition at line 167 of file Keywords.cpp.

void PLMD::Keywords::add ( const std::string &  t,
const std::string &  k,
const std::string &  def,
const std::string &  d 
)

Add a new compulsory keyword (t must equal compulsory) with name k, default value def and description d.

Definition at line 184 of file Keywords.cpp.

void PLMD::Keywords::add ( const Keywords keys)

Add keywords from one keyword object to another.

Definition at line 61 of file Keywords.cpp.

void PLMD::Keywords::addFlag ( const std::string &  k,
const bool  def,
const std::string &  d 
)

Add a falg with name k that is by default on if def is true and off if def is false. d should provide a description of the flag.

Definition at line 193 of file Keywords.cpp.

void PLMD::Keywords::addOutputComponent ( const std::string &  name,
const std::string &  key,
const std::string &  descr 
)

Add a potential component which can be output by this particular action.

Definition at line 565 of file Keywords.cpp.

void PLMD::Keywords::copyData ( std::vector< std::string > &  kk,
std::vector< std::string > &  rk,
std::map< std::string, KeyType > &  tt,
std::map< std::string, bool > &  am,
std::map< std::string, std::string > &  docs,
std::map< std::string, bool > &  bools,
std::map< std::string, std::string > &  nums,
std::map< std::string, std::string > &  atags,
std::vector< std::string > &  cnam,
std::map< std::string, std::string > &  ck,
std::map< std::string, std::string > &  cd 
) const

Copy the keywords data.

Definition at line 65 of file Keywords.cpp.

void PLMD::Keywords::destroyData ( )

Clear everything from the keywords object.

Definition at line 554 of file Keywords.cpp.

bool PLMD::Keywords::exists ( const std::string &  k) const

Check if there is a keyword with name k.

Definition at line 239 of file Keywords.cpp.

std::string PLMD::Keywords::get ( const unsigned  k) const

Get the ith keyword.

Definition at line 529 of file Keywords.cpp.

bool PLMD::Keywords::getDefaultValue ( std::string  key,
std::string &  def 
) const

Get the value of the default for the keyword named key.

Definition at line 543 of file Keywords.cpp.

std::string PLMD::Keywords::getKeyword ( const unsigned  i) const

Return the ith keyword.

Definition at line 234 of file Keywords.cpp.

bool PLMD::Keywords::getLogicalDefault ( std::string  key,
bool &  def 
) const

find out whether flag key is on or off by default.

Definition at line 534 of file Keywords.cpp.

bool PLMD::Keywords::numbered ( const std::string &  k) const

Check if numbered keywords are allowed for this action.

Definition at line 217 of file Keywords.cpp.

bool PLMD::Keywords::outputComponentExists ( const std::string &  name,
const bool &  custom 
) const

Has a component with this name been added?

Definition at line 572 of file Keywords.cpp.

void PLMD::Keywords::print ( Log log) const

Print the documentation to the log file (used by PLMD::Action::error)

Definition at line 461 of file Keywords.cpp.

void PLMD::Keywords::print ( FILE *  out) const

Print the documentation to a file (use by PLUMED::CLTool::readCommandLineArgs)

Definition at line 399 of file Keywords.cpp.

void PLMD::Keywords::print_html ( const bool  isaction) const

Print an html version of the documentation.

Definition at line 294 of file Keywords.cpp.

void PLMD::Keywords::print_html_item ( const std::string &  key) const
private

Print the documentation for the jth keyword in html.

Definition at line 522 of file Keywords.cpp.

void PLMD::Keywords::print_template ( const std::string &  actionname,
bool  include_optional 
) const

Print the template version for the documenation.

Definition at line 253 of file Keywords.cpp.

void PLMD::Keywords::printKeyword ( const std::string &  j,
Log log 
) const
private

Print a particular keyword.

Definition at line 505 of file Keywords.cpp.

void PLMD::Keywords::printKeyword ( const std::string &  j,
FILE *  out 
) const
private

Print a particular keyword (copy of the above that works with files)

Definition at line 444 of file Keywords.cpp.

void PLMD::Keywords::remove ( const std::string &  k)

Remove the keyword with name k.

Definition at line 204 of file Keywords.cpp.

void PLMD::Keywords::reserve ( const std::string &  t,
const std::string &  k,
const std::string &  d,
const bool  isvessel = false 
)

Reserve a keyword.

Definition at line 110 of file Keywords.cpp.

bool PLMD::Keywords::reserved ( const std::string &  k) const

Check the keyword k has been reserved.

Definition at line 246 of file Keywords.cpp.

void PLMD::Keywords::reserveFlag ( const std::string &  k,
const bool  def,
const std::string &  d,
const bool  isvessel = false 
)

Reserve a flag.

Definition at line 140 of file Keywords.cpp.

void PLMD::Keywords::reset_style ( const std::string &  k,
const std::string &  style 
)

Change the style of a keyword.

Definition at line 161 of file Keywords.cpp.

void PLMD::Keywords::setComponentsIntroduction ( const std::string &  instr)

Set the text that introduces how the components for this action are introduced.

Definition at line 561 of file Keywords.cpp.

unsigned PLMD::Keywords::size ( ) const

Return the number of defined keywords.

Definition at line 230 of file Keywords.cpp.

bool PLMD::Keywords::style ( const std::string &  k,
const std::string &  t 
) const

Check if the keyword with name k has style t.

Definition at line 223 of file Keywords.cpp.

void PLMD::Keywords::use ( const std::string &  k)

Use one of the reserved keywords.

Definition at line 154 of file Keywords.cpp.

Friends And Related Function Documentation

friend class Action
friend

Definition at line 57 of file Keywords.h.

Member Data Documentation

std::map<std::string,bool> PLMD::Keywords::allowmultiple
private

Do we allow stuff like key1, key2 etc.

Definition at line 66 of file Keywords.h.

std::map<std::string,std::string> PLMD::Keywords::atomtags
private

The tags for atoms - we use this so the manual can differentiate between different ways of specifying atoms.

Definition at line 74 of file Keywords.h.

std::map<std::string,bool> PLMD::Keywords::booldefs
private

The default values for the flags (are they on or of)

Definition at line 70 of file Keywords.h.

std::map<std::string,std::string> PLMD::Keywords::cdocs
private

The documentation for a particular component.

Definition at line 82 of file Keywords.h.

std::map<std::string,std::string> PLMD::Keywords::ckey
private

The keyword that turns on a particular component.

Definition at line 80 of file Keywords.h.

std::vector<std::string> PLMD::Keywords::cnames
private

The names of all the possible components for an action.

Definition at line 78 of file Keywords.h.

std::string PLMD::Keywords::cstring
private

The string that should be printed out to describe how the components work for this particular action.

Definition at line 76 of file Keywords.h.

std::map<std::string,std::string> PLMD::Keywords::documentation
private

The documentation for the keywords.

Definition at line 68 of file Keywords.h.

std::vector<std::string> PLMD::Keywords::keys
private

The names of the allowed keywords.

Definition at line 60 of file Keywords.h.

std::map<std::string,std::string> PLMD::Keywords::numdefs
private

The default values (if there are default values) for compulsory keywords.

Definition at line 72 of file Keywords.h.

std::vector<std::string> PLMD::Keywords::reserved_keys
private

The names of the reserved keywords.

Definition at line 62 of file Keywords.h.

std::map<std::string,KeyType> PLMD::Keywords::types
private

Whether the keyword is compulsory, optional...

Definition at line 64 of file Keywords.h.


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