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

 Keywords ()
 Constructor. More...
 
void add (const Keywords &keys)
 Add keywords from one keyword object to another. 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 addActionNameSuffix (const std::string &suffix)
 Add a suffix to the list of action name suffixes to test for. 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 addInputKeyword (const std::string &t, const std::string &k, const std::string &ttt, const std::string &d)
 Create the documentation for a keyword that reads arguments. More...
 
void addInputKeyword (const std::string &t, const std::string &k, const std::string &ttt, const std::string &def, const std::string &d)
 
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...
 
void addOutputComponent (const std::string &name, const std::string &key, const std::string &type, const std::string &descr)
 Add a potential component which can be output by this particular action. More...
 
bool checkArgumentType (const std::size_t &rank, const bool &hasderiv) const
 Check the documentation of the argument types. More...
 
bool componentHasCorrectType (const std::string &name, const std::size_t &rank, const bool &hasderiv) const
 Check that type for component has been documented correctly. 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...
 
bool exists (const std::string &k) const
 Check if there is a keyword with name k. More...
 
std::string get (const unsigned k) const
 Get the ith keyword. More...
 
std::string getArgumentType (const std::string &name) const
 Get the valid types that can be used as argument for this keyword. More...
 
bool getDefaultValue (const std::string &key, std::string &def) const
 Get the value of the default for the keyword named key. More...
 
std::string getDisplayName () const
 Return the name of the action that has this set of keywords. More...
 
std::string getHelpString () const
 Get the help string. More...
 
std::vector< std::string > getKeys () const
 Reference to keys. More...
 
std::string getKeyword (const unsigned i) const
 Return the ith keyword. More...
 
std::string getKeywordDescription (const std::string &name) const
 Get the description of a particular keyword. More...
 
std::string getKeywordDocs (const std::string &key) const
 Get the documentation for a particular keyword. More...
 
bool getLogicalDefault (const std::string &key, bool &def) const
 find out whether flag key is on or off by default. More...
 
const std::vector< std::string > & getNeededKeywords () const
 Get the list of keywords that are needed by this action. More...
 
std::string getOutputComponentDescription (const std::string &name) const
 Get the description of this component. More...
 
std::string getOutputComponentFlag (const std::string &name) const
 Get the flag that forces this component to be calculated. More...
 
std::vector< std::string > getOutputComponents () const
 Get the full list of output components. More...
 
std::string getOutputComponentType (const std::string &name) const
 Get the type for this output component. More...
 
std::string getStyle (const std::string &k) const
 Get the type for the keyword with string k. More...
 
std::string getTooltip (const std::string &name) const
 Get the description of a particular keyword. More...
 
void isAnalysis ()
 
void isDriver ()
 
void needsAction (const std::string &name)
 Note that another actions is required to create this shortcut. More...
 
bool numbered (const std::string &k) const
 Check if numbered keywords are allowed for this action. More...
 
bool outputComponentExists (const std::string &name) const
 Has a component with this name been added? More...
 
void print (FILE *out) const
 Print the documentation to a file (use by PLUMED::CLTool::readCommandLineArgs) More...
 
void print (Log &log) const
 Print the documentation to the log file (used by PLMD::Action::error) More...
 
void print_html () const
 Print an html version of the documentation. More...
 
void print_spelling () const
 Print a file containing the list of keywords for a particular action (used for spell checking) More...
 
void print_template (const std::string &actionname, bool include_optional) const
 Print the template version for the documentation. More...
 
void print_vim () const
 Print keywords in form readable by vim. More...
 
void remove (const std::string &k)
 Remove the keyword with name k. More...
 
void removeComponent (const std::string &name)
 Remove a component with a particular name from the keywords. More...
 
void removeOutputComponent (const std::string &name)
 Remove a component that can be output by this particular action. More...
 
void reserve (const std::string &t, const std::string &k, const std::string &d)
 Reserve a keyword. More...
 
bool reserved (const std::string &k) const
 Check the keyword k has been reserved. More...
 
void reserveFlag (const std::string &k, const bool def, const std::string &d)
 Reserve a flag. More...
 
void reset_style (const std::string &k, const std::string &style)
 Change the style of a keyword. More...
 
void setComponentsIntroduction (const std::string &instr)
 Set the text that introduces how the components for this action are introduced. More...
 
void setDisplayName (const std::string &name)
 Set the display name. More...
 
void setValueDescription (const std::string &type, const std::string &descr)
 Add the description of the value. More...
 
unsigned size () const
 Return the number of defined keywords. More...
 
bool style (const std::string &k, const std::string &t) const
 Check if the keyword with name k has style t. More...
 
void use (const std::string &k)
 Use one of the reserved keywords. More...
 

Private Member Functions

void print_html_item (const std::string &) const
 Print the documentation for the jth keyword in html. More...
 

Private Attributes

std::vector< std::string > actionNameSuffixes
 List of suffixes that can be used with this action. More...
 
std::map< std::string, bool > allowmultiple
 Do we allow stuff like key1, key2 etc. More...
 
std::map< std::string, std::string > argument_types
 The type for the arguments in this action. 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::map< std::string, bool > booldefs
 The default values for the flags (are they on or of) More...
 
std::map< std::string, std::string > cdocs
 The documentation for a particular component. More...
 
std::map< std::string, std::string > ckey
 The keyword that turns on a particular component. More...
 
std::vector< std::string > cnames
 The names of all the possible components for an action. More...
 
std::string cstring
 The string that should be printed out to describe how the components work for this particular action. More...
 
std::map< std::string, std::string > ctypes
 The type of a particular component. More...
 
std::map< std::string, std::string > documentation
 The documentation for the keywords. More...
 
bool isaction
 Is this an action or driver (this bool affects what style==atoms does in print) More...
 
bool isatoms
 This allows us to overwrite the behavior of the atoms type in analysis actions. More...
 
std::vector< std::string > keys
 The names of the allowed keywords. More...
 
std::vector< std::string > neededActions
 The list of actions that are needed by this action. More...
 
std::map< std::string, std::string > numdefs
 The default values (if there are default values) for compulsory keywords. More...
 
std::vector< std::string > reserved_keys
 The names of the reserved keywords. More...
 
std::string thisactname
 The name of the action that has this set of keywords. More...
 
std::map< std::string, KeyTypetypes
 Whether the keyword is compulsory, optional... More...
 

Friends

class Action
 
class ActionRegister
 
class ActionShortcut
 

Detailed Description

This class holds the keywords and their documentation.

Constructor & Destructor Documentation

◆ Keywords()

PLMD::Keywords::Keywords ( )
inline

Constructor.

Member Function Documentation

◆ add() [1/3]

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

Add keywords from one keyword object to another.

◆ add() [2/3]

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.

◆ add() [3/3]

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.

◆ addActionNameSuffix()

void PLMD::Keywords::addActionNameSuffix ( const std::string &  suffix)

Add a suffix to the list of action name suffixes to test for.

◆ addFlag()

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.

◆ addInputKeyword() [1/2]

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

Create the documentation for a keyword that reads arguments.

◆ addInputKeyword() [2/2]

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

◆ addOutputComponent() [1/2]

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.

◆ addOutputComponent() [2/2]

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

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

◆ checkArgumentType()

bool PLMD::Keywords::checkArgumentType ( const std::size_t &  rank,
const bool &  hasderiv 
) const

Check the documentation of the argument types.

◆ componentHasCorrectType()

bool PLMD::Keywords::componentHasCorrectType ( const std::string &  name,
const std::size_t &  rank,
const bool &  hasderiv 
) const

Check that type for component has been documented correctly.

◆ copyData()

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.

◆ destroyData()

void PLMD::Keywords::destroyData ( )

Clear everything from the keywords object.

Not actually needed if your Keywords object is going out of scope.

◆ exists()

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

Check if there is a keyword with name k.

◆ get()

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

Get the ith keyword.

◆ getArgumentType()

std::string PLMD::Keywords::getArgumentType ( const std::string &  name) const

Get the valid types that can be used as argument for this keyword.

◆ getDefaultValue()

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

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

◆ getDisplayName()

std::string PLMD::Keywords::getDisplayName ( ) const

Return the name of the action that has this set of keywords.

◆ getHelpString()

std::string PLMD::Keywords::getHelpString ( ) const

Get the help string.

◆ getKeys()

std::vector<std::string> PLMD::Keywords::getKeys ( ) const
inline

Reference to keys.

◆ getKeyword()

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

Return the ith keyword.

◆ getKeywordDescription()

std::string PLMD::Keywords::getKeywordDescription ( const std::string &  name) const

Get the description of a particular keyword.

◆ getKeywordDocs()

std::string PLMD::Keywords::getKeywordDocs ( const std::string &  key) const

Get the documentation for a particular keyword.

◆ getLogicalDefault()

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

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

◆ getNeededKeywords()

const std::vector< std::string > & PLMD::Keywords::getNeededKeywords ( ) const

Get the list of keywords that are needed by this action.

◆ getOutputComponentDescription()

std::string PLMD::Keywords::getOutputComponentDescription ( const std::string &  name) const

Get the description of this component.

◆ getOutputComponentFlag()

std::string PLMD::Keywords::getOutputComponentFlag ( const std::string &  name) const

Get the flag that forces this component to be calculated.

◆ getOutputComponents()

std::vector< std::string > PLMD::Keywords::getOutputComponents ( ) const

Get the full list of output components.

◆ getOutputComponentType()

std::string PLMD::Keywords::getOutputComponentType ( const std::string &  name) const

Get the type for this output component.

◆ getStyle()

std::string PLMD::Keywords::getStyle ( const std::string &  k) const

Get the type for the keyword with string k.

◆ getTooltip()

std::string PLMD::Keywords::getTooltip ( const std::string &  name) const

Get the description of a particular keyword.

◆ isAnalysis()

void PLMD::Keywords::isAnalysis ( )
inline

◆ isDriver()

void PLMD::Keywords::isDriver ( )
inline

◆ needsAction()

void PLMD::Keywords::needsAction ( const std::string &  name)

Note that another actions is required to create this shortcut.

◆ numbered()

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

Check if numbered keywords are allowed for this action.

◆ outputComponentExists()

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

Has a component with this name been added?

◆ print() [1/2]

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

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

◆ print() [2/2]

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

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

◆ print_html()

void PLMD::Keywords::print_html ( ) const

Print an html version of the documentation.

◆ print_html_item()

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

Print the documentation for the jth keyword in html.

◆ print_spelling()

void PLMD::Keywords::print_spelling ( ) const

Print a file containing the list of keywords for a particular action (used for spell checking)

◆ print_template()

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

Print the template version for the documentation.

◆ print_vim()

void PLMD::Keywords::print_vim ( ) const

Print keywords in form readable by vim.

◆ remove()

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

Remove the keyword with name k.

◆ removeComponent()

void PLMD::Keywords::removeComponent ( const std::string &  name)

Remove a component with a particular name from the keywords.

◆ removeOutputComponent()

void PLMD::Keywords::removeOutputComponent ( const std::string &  name)

Remove a component that can be output by this particular action.

◆ reserve()

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

Reserve a keyword.

◆ reserved()

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

Check the keyword k has been reserved.

◆ reserveFlag()

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

Reserve a flag.

◆ reset_style()

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

Change the style of a keyword.

◆ setComponentsIntroduction()

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

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

◆ setDisplayName()

void PLMD::Keywords::setDisplayName ( const std::string &  name)

Set the display name.

◆ setValueDescription()

void PLMD::Keywords::setValueDescription ( const std::string &  type,
const std::string &  descr 
)

Add the description of the value.

◆ size()

unsigned PLMD::Keywords::size ( ) const

Return the number of defined keywords.

◆ style()

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

Check if the keyword with name k has style t.

◆ use()

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

Use one of the reserved keywords.

Friends And Related Function Documentation

◆ Action

friend class Action
friend

◆ ActionRegister

friend class ActionRegister
friend

◆ ActionShortcut

friend class ActionShortcut
friend

Member Data Documentation

◆ actionNameSuffixes

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

List of suffixes that can be used with this action.

◆ allowmultiple

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

Do we allow stuff like key1, key2 etc.

◆ argument_types

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

The type for the arguments in this action.

◆ atomtags

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.

◆ booldefs

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

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

◆ cdocs

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

The documentation for a particular component.

◆ ckey

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

The keyword that turns on a particular component.

◆ cnames

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

The names of all the possible components for an action.

◆ cstring

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

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

◆ ctypes

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

The type of a particular component.

◆ documentation

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

The documentation for the keywords.

◆ isaction

bool PLMD::Keywords::isaction
private

Is this an action or driver (this bool affects what style==atoms does in print)

◆ isatoms

bool PLMD::Keywords::isatoms
private

This allows us to overwrite the behavior of the atoms type in analysis actions.

◆ keys

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

The names of the allowed keywords.

◆ neededActions

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

The list of actions that are needed by this action.

◆ numdefs

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

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

◆ reserved_keys

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

The names of the reserved keywords.

◆ thisactname

std::string PLMD::Keywords::thisactname
private

The name of the action that has this set of keywords.

◆ types

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

Whether the keyword is compulsory, optional...


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