Changes in / [b295ca:41e15b]


Ignore:
Files:
41 added
18 deleted
220 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Action.cpp

    rb295ca r41e15b  
    2020#include "Helpers/MemDebug.hpp"
    2121
     22#include <iostream>
    2223#include <string>
    2324
     
    2526#include "Actions/ActionRegistry.hpp"
    2627#include "Actions/ActionHistory.hpp"
     28#include "Actions/OptionRegistry.hpp"
     29#include "Actions/OptionTrait.hpp"
    2730#include "Exceptions/MissingValueException.hpp"
    2831#include "UIElements/Dialog.hpp"
     32#include "Helpers/Assert.hpp"
    2933#include "Helpers/MemDebug.hpp"
    3034#include "UIElements/UIFactory.hpp"
     
    4347Action::state_ptr Action::failure = getEmptyState();
    4448
    45 Action::Action(std::string _name,bool _doRegister) :
    46 name(_name)
     49Action::Action(const ActionTraits &_Traits, bool _doRegister) :
     50    Traits(_Traits)
    4751{
     52  // register with ActionRegistry
    4853  if(_doRegister){
    4954    ActionRegistry::getInstance().registerInstance(this);
     55  }
     56
     57  // register with OptionRegistry
     58  for (ActionTraits::options_const_iterator optioniter = Traits.getBeginIter();
     59      optioniter != Traits.getEndIter();
     60      ++optioniter) {
     61    // options may have been re-used by other Actions, so check beforehand whether adding is needed
     62    if (!OptionRegistry::getInstance().isOptionPresentByName((optioniter->first))) {
     63      OptionRegistry::getInstance().registerInstance(optioniter->second);
     64    } else { // if present, ASSERT that types coincide
     65      OptionTrait const * const PresentOption = OptionRegistry::getInstance().getOptionByName(optioniter->first);
     66      ASSERT(PresentOption->getType() == optioniter->second->getType(),
     67          ("Action::Action() - option to add "+
     68              std::string(optioniter->first)+
     69              " of Action "+
     70              std::string(getName())+
     71              " is already present with different type!"
     72          )
     73      );
     74    }
    5075  }
    5176}
     
    5580
    5681const string Action::getName(){
    57   return name;
     82  return Traits.getName();
    5883}
    5984
     
    104129  return true;
    105130}
     131
  • src/Actions/Action.hpp

    rb295ca r41e15b  
    1111#include <string>
    1212#include <boost/shared_ptr.hpp>
     13
     14/** Used in .def files in paramdefaults define to set that no default value exists.
     15 * We define NODEFAULT here, as it is used in .def files and needs to be present
     16 * before these are included.
     17 */
     18#define NODEFAULT std::string()
    1319
    1420// forward declaration
     
    1723class ActionSequence;
    1824class Dialog;
     25
     26#include "Actions/ActionTraits.hpp"
    1927
    2028/**
     
    294302 */
    295303
     304
    296305/**
    297306 * Base class for all actions.
     
    319328   * be registered with the ActionRegistry. If the Action is registered the name of the
    320329   * Action needs to be unique for all Actions that are registered.
    321    */
    322   Action(std::string _name,bool _doRegister=true);
     330   *
     331   * \note NO reference for \a _Traits as we do have to copy it, otherwise _Traits would have
     332   * to be present throughout the program's run.
     333   *
     334   * \param Traits information class to this action
     335   * \param _doRegister whether to register with ActionRegistry
     336   */
     337  Action(const ActionTraits &_Traits, bool _doRegister=true);
    323338  virtual ~Action();
    324339
     
    363378   * Returns the name of the Action.
    364379   */
    365   virtual const std::string getName();
     380  const std::string getName();
     381
     382  /**
     383   * Traits resemble all necessary information that "surrounds" an action, such as
     384   * its name (for ActionRegistry and as ref from string to instance and vice versa),
     385   * which menu, which position, what parameters, their types, if it is itself a
     386   * parameter and so on ...
     387   *
     388   * Note that is important that we do not use a reference here. We want to copy the
     389   * information in the Action's constructor and have it contained herein. Hence, we
     390   * also have our own copy constructor for ActionTraits. Information should be
     391   * encapsulated in the Action, no more references to the outside than absolutely
     392   * necessary.
     393   */
     394  const ActionTraits Traits;
    366395
    367396protected:
     
    440469   */
    441470  virtual state_ptr performRedo(state_ptr)=0;
    442 
    443   std::string name;
    444471};
    445472
  • src/Actions/ActionHistory.cpp

    rb295ca r41e15b  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "ActionHistory.hpp"
     22#include "Actions/ActionHistory.hpp"
    2323
    2424#include <iostream>
     
    2626#include "Patterns/Singleton_impl.hpp"
    2727#include "Helpers/Assert.hpp"
    28 #include "Helpers/MemDebug.hpp"
    29 
    30 using namespace std;
    3128
    3229ActionHistory::ActionHistory()
     
    7269  ActionHistory *hist = new ActionHistory();
    7370  setInstance(hist);
    74   new UndoAction(hist);
    75   new RedoAction(hist);
    7671}
    7772
     
    8075/****************** Contained actions *******************/
    8176
    82 const char ActionHistory::UndoAction::NAME[] = "undo";
    83 
    84 ActionHistory::UndoAction::UndoAction(ActionHistory *_hist) :
    85   Action(NAME),
    86   hist(_hist)
    87 {}
    88 
    89 ActionHistory::UndoAction::~UndoAction(){}
    90 
    91 bool ActionHistory::UndoAction::canUndo(){
    92   return false;
    93 }
    94 
    95 bool ActionHistory::UndoAction::shouldUndo(){
    96   return false;
    97 }
    98 
    99 bool ActionHistory::UndoAction::isActive(){
    100   return hist->hasUndo();
    101 }
    102 
    103 void ActionHistory::UndoAction::getParametersfromValueStorage()
    104 {}
    105 
    106 Dialog* ActionHistory::UndoAction::fillDialog(Dialog *dialog){
    107   ASSERT(dialog,"No Dialog given when filling action dialog");
    108   return dialog;
    109 }
    110 
    111 Action::state_ptr ActionHistory::UndoAction::performCall(){
    112   std::cout << "Undo" << std::endl;
    113   hist->undoLast();
    114   return Action::success;
    115 }
    116 
    117 Action::state_ptr ActionHistory::UndoAction::performUndo(Action::state_ptr){
    118   ASSERT(0,"Cannot undo an undo (should use redo for this");
    119   return Action::success;
    120 }
    121 
    122 Action::state_ptr ActionHistory::UndoAction::performRedo(Action::state_ptr){
    123   ASSERT(0,"Cannot redo an undo");
    124   return Action::success;
    125 }
    126 
    127 const char ActionHistory::RedoAction::NAME[] = "redo";
    128 
    129 ActionHistory::RedoAction::RedoAction(ActionHistory *_hist) :
    130     Action(NAME),
    131     hist(_hist)
    132 {}
    133 
    134 ActionHistory::RedoAction::~RedoAction(){}
    135 
    136 bool ActionHistory::RedoAction::canUndo(){
    137   return false;
    138 }
    139 
    140 bool ActionHistory::RedoAction::shouldUndo(){
    141   return false;
    142 }
    143 
    144 bool ActionHistory::RedoAction::isActive(){
    145   return hist->hasRedo();
    146 }
    147 
    148 void ActionHistory::RedoAction::getParametersfromValueStorage()
    149 {}
    150 
    151 Dialog* ActionHistory::RedoAction::fillDialog(Dialog *dialog){
    152   ASSERT(dialog,"No Dialog given when filling action dialog");
    153   return dialog;
    154 }
    155 
    156 Action::state_ptr ActionHistory::RedoAction::performCall(){
    157   std::cout << "Redo" << std::endl;
    158   hist->redoLast();
    159   return Action::success;
    160 }
    161 
    162 Action::state_ptr ActionHistory::RedoAction::performUndo(Action::state_ptr){
    163   ASSERT(0,"Cannot undo a redo (should use undo for this");
    164   return Action::success;
    165 }
    166 
    167 Action::state_ptr ActionHistory::RedoAction::performRedo(Action::state_ptr){
    168   ASSERT(0,"Cannot redo a redo");
    169   return Action::success;
    170 }
  • src/Actions/ActionHistory.hpp

    rb295ca r41e15b  
    1414
    1515#include "Actions/Action.hpp"
     16#include "Actions/RedoAction.hpp"
     17#include "Actions/UndoAction.hpp"
    1618
    1719
     
    2729    Action *action;
    2830    Action::state_ptr state;
    29   };
    30 
    31   class UndoAction : public Action {
    32   public:
    33     UndoAction(ActionHistory*);
    34     virtual ~UndoAction();
    35 
    36     virtual bool canUndo();
    37     virtual bool shouldUndo();
    38 
    39     virtual bool isActive();
    40   protected:
    41     virtual Dialog * fillDialog(Dialog *dialog);
    42   private:
    43     virtual void getParametersfromValueStorage();
    44   virtual Action::state_ptr performCall();
    45     virtual Action::state_ptr performUndo(Action::state_ptr);
    46     virtual Action::state_ptr performRedo(Action::state_ptr);
    47 
    48     ActionHistory *hist;
    49 
    50     static const char NAME[];
    51   };
    52 
    53   class RedoAction : public Action {
    54   public:
    55     RedoAction(ActionHistory*);
    56     virtual ~RedoAction();
    57 
    58     virtual bool canUndo();
    59     virtual bool shouldUndo();
    60 
    61     virtual bool isActive();
    62 
    63   protected:
    64     virtual Dialog * fillDialog(Dialog *dialog);
    65   private:
    66     virtual void getParametersfromValueStorage();
    67     virtual Action::state_ptr performCall();
    68     virtual Action::state_ptr performUndo(Action::state_ptr);
    69     virtual Action::state_ptr performRedo(Action::state_ptr);
    70 
    71     ActionHistory *hist;
    72 
    73     static const char NAME[];
    7431  };
    7532
  • src/Actions/ActionRegistry.cpp

    rb295ca r41e15b  
    4747 * \return true - Action instance present, false - not
    4848 */
    49 bool ActionRegistry::isActionPresentByName(const std::string name)
     49bool ActionRegistry::isActionPresentByName(const std::string name) const
    5050{
    5151  return isPresentByName(name);
    5252}
    5353
     54/** Returns the last present action position in the requested menu.
     55 * \param &token token of the menu
     56 * \return last used position
     57 */
     58int ActionRegistry::getLastPosition(const std::string &token) const
     59{
     60  int position = 0;
     61  for (const_iterator iter = getBeginIter();
     62      iter != getEndIter();
     63      ++iter) {
     64    const std::string &MenuName = (iter->second)->Traits.getMenuName();
     65    const int &MenuPosition = (iter->second)->Traits.getMenuPosition();
     66    if ((MenuName == token) && (position < MenuPosition))
     67      position = MenuPosition;
     68  }
     69  return position;
     70}
     71
     72
    5473CONSTRUCT_SINGLETON(ActionRegistry)
    5574CONSTRUCT_REGISTRY(Action)
  • src/Actions/ActionRegistry.hpp

    rb295ca r41e15b  
    3030public:
    3131  Action* getActionByName(const std::string name);
    32   bool isActionPresentByName(const std::string name);
     32  bool isActionPresentByName(const std::string name) const;
     33  int getLastPosition(const std::string &MenuName) const;
    3334
    3435private:
  • src/Actions/Action_impl_header.hpp

    rb295ca r41e15b  
    2020#include <boost/preprocessor/seq/transform.hpp>
    2121
    22 // some derived names
     22#include <iostream>
     23#include <typeinfo>
     24
     25#include "Actions/ActionTraits.hpp"
     26#include "Actions/OptionTrait.hpp"
     27#include "Actions/ValueStorage.hpp"
     28
     29// some derived names: if CATEGORY is not given, we don't prefix with it
     30#ifdef CATEGORY
    2331#define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action))
    2432#define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME)
    2533#define PARAMS BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Parameters))
    26 
     34#else
     35#define ACTION BOOST_PP_CAT(ACTIONNAME, Action)
     36#define COMMAND ACTIONNAME
     37#define PARAMS BOOST_PP_CAT(ACTIONNAME, Parameters)
     38#endif
    2739// check if no lists given
    2840#ifndef paramtypes
     
    3345
    3446// check user has given name and category
    35 #ifndef CATEGORY
    36 ERROR: No "CATEGORY" defined in: __FILE__
    37 #endif
    38 
    3947#ifndef ACTIONNAME
    4048ERROR: No "ACTIONNAME" defined in: __FILE__
     
    5058BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramreferences)),\
    5159  ERROR: There are not the same number of "paramtokens" and "paramreferences" in: __FILE__ \
     60)
     61#endif
     62#ifdef paramdescriptions
     63BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramdescriptions)),\
     64  ERROR: There are not the same number of "paramtokens" and "paramdescriptions" in: __FILE__ \
     65)
     66#endif
     67
     68// check for mandatory defines
     69#ifndef DESCRIPTION
     70BOOST_PP_ASSERT_MSG(0, \
     71    "ERROR: Description is mandatory for Actions, here for ACTION " \
     72)
     73#endif
     74
     75// check if paramdefaults is given, otherwise fill list with NODEFAULT
     76// this does not work: paramdefaults has to be completely defined before
     77// being used within option_print (used as an array there and not as
     78// some function call still to be expanded)
     79//#define paramdefaults (NODEFAULT)
     80//#define tempvalue(z,n,value)
     81//  BOOST_PP_CAT(value,(NODEFAULT))
     82//BOOST_PP_REPEAT(tempvalue, MAXPARAMTYPES, paramdefaults)
     83//#undef tempvalue
     84//#else
     85
     86// if present, check if correct number of arguments
     87#ifdef paramdefaults
     88BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramdefaults)),\
     89  ERROR: There are not the same number of "paramtokens" and "paramdefaults" in: __FILE__ \
    5290)
    5391#endif
     
    64102  BOOST_PP_SEQ_ELEM(n, TYPELIST) \
    65103  BOOST_PP_SEQ_ELEM(n, VARLIST)
     104
     105// prints Options.insert
     106#ifdef paramdefaults
     107#define option_print(z,n,unused, unused2) \
     108  tester = Options. insert (\
     109      std::pair< std::string, OptionTrait *> ( \
     110      BOOST_PP_SEQ_ELEM(n, paramtokens), \
     111      new OptionTrait(\
     112          BOOST_PP_SEQ_ELEM(n, paramtokens), \
     113          &typeid( BOOST_PP_SEQ_ELEM(n, paramtypes) ), \
     114          BOOST_PP_SEQ_ELEM(n, paramdescriptions), \
     115          BOOST_PP_SEQ_ELEM(n, paramdefaults) )\
     116      )\
     117  ); \
     118  ASSERT(tester.second, "ActionTrait<ACTION>::ActionTrait<ACTION>() option token present twice!");
     119#else
     120#define option_print(z,n,unused, unused2) \
     121  tester = Options. insert (\
     122      std::pair< std::string, OptionTrait *> ( \
     123      BOOST_PP_SEQ_ELEM(n, paramtokens), \
     124      new OptionTrait(\
     125          BOOST_PP_SEQ_ELEM(n, paramtokens), \
     126          &typeid( BOOST_PP_SEQ_ELEM(n, paramtypes) ), \
     127          BOOST_PP_SEQ_ELEM(n, paramdescriptions), \
     128          NODEFAULT )\
     129      )\
     130  ); \
     131  ASSERT(tester.second, "ActionTrait<ACTION>::ActionTrait<ACTION>() option token present twice!");
     132#endif
    66133
    67134#if defined paramtypes && defined paramreferences
     
    75142#endif
    76143
     144class ACTION;
     145
     146template <>
     147class ActionTrait<ACTION> : public ActionTraits {
     148public:
     149  ActionTrait() :
     150#ifndef SHORTFORM
     151    ActionTraits(OptionTrait(TOKEN, &typeid(void), DESCRIPTION, std::string()))
     152#else
     153    ActionTraits(OptionTrait(TOKEN, &typeid(void), DESCRIPTION, std::string(), SHORTFORM))
     154#endif /* SHORTFORM */
     155  {
     156  // initialize remainder of action info
     157#ifdef MENUNAME
     158    MenuTitle = MENUNAME;
     159#endif
     160#ifdef MENUPOSITION
     161    MenuPosition = MENUPOSITION;
     162#endif
     163
     164  // initialize action's options
     165  std::pair< ActionTraits::options_iterator, bool > tester;
     166#ifdef paramtokens
     167#define BOOST_PP_LOCAL_MACRO(n) option_print(~, n, ~, )
     168#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
     169#include BOOST_PP_LOCAL_ITERATE()
     170#endif
     171  // associate action's short form also with option
     172#ifdef SHORTFORM
     173  if (Options.find(TOKEN) != Options.end())
     174    Options[TOKEN]->setShortForm(std::string(SHORTFORM));
     175#endif /* SHORTFORM */
     176  //std::cout << "ActionTrait<ACTION>::ActionTrait() with " << getName() << ", type " << getTypeName() << " and description " << getDescription() << std::endl;
     177  }
     178
     179  ~ActionTrait() {}
     180};
     181
    77182class ACTION : public Action {
    78   friend
    79183  #if defined paramtypes && defined paramreferences
    80   void COMMAND(
     184  friend void COMMAND(
    81185  #define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, paramtypes, paramreferences)
    82186  #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
     
    94198  bool shouldUndo();
    95199
    96   virtual const std::string getName();
    97 
    98200  struct PARAMS : ActionParameters {
    99201  #if defined paramtypes && defined paramreferences
     
    111213  virtual Action::state_ptr performUndo(Action::state_ptr);
    112214  virtual Action::state_ptr performRedo(Action::state_ptr);
    113 
    114   static const char NAME[];
    115215};
    116216
     
    118218#undef paramtokens
    119219#undef paramreferences
     220#undef paramdescriptions
     221#undef paramdefaults
    120222#undef MAXPARAMTYPES
    121223#undef statetypes
     
    130232#undef ACTIONNAME
    131233#undef CATEGORY
     234#undef MENUNAME
     235#undef MENUPOSITION
    132236#undef TOKEN
     237
     238#undef DESCRIPTION
     239#undef SHORTFORM
  • src/Actions/Action_impl_pre.hpp

    rb295ca r41e15b  
    4242#include <boost/preprocessor/seq/transform.hpp>
    4343
    44 // some derived names
     44// some derived names: if CATEGORY is not given, we don't prefix with it
     45#ifdef CATEGORY
    4546#define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action))
    4647#define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME)
    4748#define STATE BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, State))
    4849#define PARAMS BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Parameters))
     50#else
     51#define ACTION BOOST_PP_CAT(ACTIONNAME, Action)
     52#define COMMAND ACTIONNAME
     53#define STATE BOOST_PP_CAT(ACTIONNAME, State)
     54#define PARAMS BOOST_PP_CAT(ACTIONNAME, Parameters)
     55#endif
     56#define INSTANCE BOOST_PP_CAT(this_, BOOST_PP_CAT(ACTIONNAME, _instance))
    4957
    5058// check if no lists given
     
    6169
    6270// check user has given name and category
    63 #ifndef CATEGORY
    64 ERROR: No "CATEGORY" defined in: __FILE__
    65 #endif
    66 
    6771#ifndef ACTIONNAME
    6872ERROR: No "ACTIONNAME" defined in: __FILE__
     
    110114  >(\
    111115  BOOST_PP_SEQ_ELEM(n, paramtokens)\
    112   , ValueStorage::getInstance().getDescription(\
    113   BOOST_PP_SEQ_ELEM(n, paramtokens)\
    114   ));
     116  , Traits.getDescription()\
     117  );
    115118
    116119// prints set/queryCurrentValue (command) for paramreferences and paramtokens
     
    125128#include "Actions/ActionRegistry.hpp"
    126129#include "UIElements/Dialog.hpp"
    127 #include "Actions/ValueStorage.hpp"
    128 
     130
     131#ifdef paramtokens
     132#define statenecessary 1
     133#endif
     134#ifndef statetokens
     135#define statenecessary 1
     136#endif
    129137
    130138// =========== memento to remember the state when undoing ===========
     139#ifdef statenecessary
    131140class STATE : public ActionState {
    132141public:
     
    154163  ACTION::PARAMS params;
    155164};
    156 
    157 // =========== name of action ===========
    158 const char ACTION::NAME[] = TOKEN;
     165#endif /* statenecessary */
     166
     167// (const) prototype to be placed into the ActionRegistry (must be deleted by registry itself)
     168const ACTION INSTANCE;
    159169
    160170// =========== constructor ===========
    161171ACTION::ACTION () :
    162   Action(NAME)
     172  Action(ActionTrait<ACTION>())
    163173{}
    164174
    165175// =========== destructor ===========
    166176ACTION::~ACTION ()
    167 {}
     177{
     178  //std::cout << "Action ACTION is being destroyed." << std::endl;
     179}
    168180
    169181// =========== fill a dialog ===========
     
    171183        ASSERT(dialog,"No Dialog given when filling actionname's dialog");
    172184#if BOOST_PP_EQUAL(MAXPARAMTYPES,0)
    173         dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
     185        dialog->queryEmpty(TOKEN, Traits.getDescription());
    174186#else
    175187#define BOOST_PP_LOCAL_MACRO(n) dialog_print(~, n, ~)
     
    192204{
    193205  ACTION::PARAMS params;
    194   Action *ToCall = ActionRegistry::getInstance().getActionByName( ACTION::NAME ); //->clone(params);
     206  Action *ToCall = ActionRegistry::getInstance().getActionByName( TOKEN ); //->clone(params);
    195207#if BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0)
    196208#define BOOST_PP_LOCAL_MACRO(n) value_print(~, n, setCurrentValue, )
     
    223235#undef PARAMS
    224236#undef STATE
     237#undef INSTANCE
    225238
    226239#undef ACTIONNAME
  • src/Actions/AnalysisAction/MolecularVolumeAction.cpp

    rb295ca r41e15b  
    8282  return true;
    8383}
    84 
    85 const string AnalysisMolecularVolumeAction::getName() {
    86   return NAME;
    87 }
    8884/** =========== end of function ====================== */
  • src/Actions/AnalysisAction/MolecularVolumeAction.def

    rb295ca r41e15b  
    1010// i.e. there is an integer with variable name Z that can be found in
    1111// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    12 // "undefine" if no parameters are required
    13 //#define paramtypes (int)
    14 //#define paramreferences (molID)
    15 //#define paramtokens (NAME)
     12// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     13#undef paramtypes
     14#undef paramreferences
     15#undef paramtokens
     16#undef paramdescriptions
     17#undef paramdefaults
    1618
    1719// some defines for all the names, you may use ACTION, STATE and PARAMS
    1820#define CATEGORY Analysis
     21#define MENUNAME "analysis"
     22#define MENUPOSITION 1
    1923#define ACTIONNAME MolecularVolume
    2024#define TOKEN "molecular-volume"
    2125
     26// finally the information stored in the ActionTrait specialization
     27#define DESCRIPTION "calculate the volume of a given molecule"
     28#undef SHORTFORM
  • src/Actions/AnalysisAction/PairCorrelationAction.cpp

    rb295ca r41e15b  
    5454
    5555  // execute action
    56   output.open(params.outputname.c_str());
    57   binoutput.open(params.binoutputname.c_str());
     56  output.open(params.outputname.string().c_str());
     57  binoutput.open(params.binoutputname.string().c_str());
    5858  PairCorrelationMap *correlationmap = NULL;
    5959  std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
     
    8787  return true;
    8888}
    89 
    90 const string AnalysisPairCorrelationAction::getName() {
    91   return NAME;
    92 }
    9389/** =========== end of function ====================== */
  • src/Actions/AnalysisAction/PairCorrelationAction.def

    rb295ca r41e15b  
    1313// i.e. there is an integer with variable name Z that can be found in
    1414// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    15 // "undefine" if no parameters are required
    16 #define paramtypes (std::vector<const element *>)(double)(double)(double)(std::string)(std::string)(bool)
     15// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     16#define paramtypes (std::vector<const element *>)(double)(double)(double)(boost::filesystem::path)(boost::filesystem::path)(bool)
    1717#define paramreferences (elements)(BinStart)(BinWidth)(BinEnd)(outputname)(binoutputname)(periodic)
    1818#define paramtokens ("elements")("bin-start")("bin-width")("bin-end")("output-file")("bin-output-file")("periodic")
     19#define paramdescriptions ("set of elements")("start of the first bin")("width of the bins")("start of the last bin")("name of the output file")("name of the bin output file")("system is constraint to periodic boundary conditions")
     20#define paramdefaults (NODEFAULT)(NODEFAULT)("0.5")(NODEFAULT)(NODEFAULT)(NODEFAULT)("0")
    1921
    2022// some defines for all the names, you may use ACTION, STATE and PARAMS
    2123#define CATEGORY Analysis
     24#define MENUNAME "analysis"
     25#define MENUPOSITION 2
    2226#define ACTIONNAME PairCorrelation
    2327#define TOKEN "pair-correlation"
     28
     29// finally the information stored in the ActionTrait specialization
     30#define DESCRIPTION "pair correlation analysis between two elements"
     31#define SHORTFORM "C"
  • src/Actions/AnalysisAction/PointCorrelationAction.cpp

    rb295ca r41e15b  
    5656
    5757  // execute action
    58   output.open(params.outputname.c_str());
    59   binoutput.open(params.binoutputname.c_str());
     58  output.open(params.outputname.string().c_str());
     59  binoutput.open(params.binoutputname.string().c_str());
    6060  cout << "Point to correlate to is  " << params.Point << endl;
    6161  CorrelationToPointMap *correlationmap = NULL;
     
    9292  return true;
    9393}
    94 
    95 const string AnalysisPointCorrelationAction::getName() {
    96   return NAME;
    97 }
    9894/** =========== end of function ====================== */
  • src/Actions/AnalysisAction/PointCorrelationAction.def

    rb295ca r41e15b  
    1515// i.e. there is an integer with variable name Z that can be found in
    1616// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    17 // "undefine" if no parameters are required
    18 #define paramtypes (std::vector<const element *>)(Vector)(double)(double)(double)(std::string)(std::string)(bool)
     17// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     18#define paramtypes (std::vector<const element *>)(Vector)(double)(double)(double)(boost::filesystem::path)(boost::filesystem::path)(bool)
    1919#define paramreferences (elements)(Point)(BinStart)(BinWidth)(BinEnd)(outputname)(binoutputname)(periodic)
    2020#define paramtokens ("elements")("position")("bin-start")("bin-width")("bin-end")("output-file")("bin-output-file")("periodic")
     21#define paramdescriptions ("set of elements")("position in R^3 space")("start of the first bin")("width of the bins")("start of the last bin")("name of the output file")("name of the bin output file")("system is constraint to periodic boundary conditions")
     22#define paramdefaults (NODEFAULT)(NODEFAULT)(NODEFAULT)("0.5")(NODEFAULT)(NODEFAULT)(NODEFAULT)("0")
    2123
    2224// some defines for all the names, you may use ACTION, STATE and PARAMS
    2325#define CATEGORY Analysis
     26#define MENUNAME "analysis"
     27#define MENUPOSITION 3
    2428#define ACTIONNAME PointCorrelation
    2529#define TOKEN "point-correlation"
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "pair correlation analysis between element and point"
     33#undef SHORTFORM
  • src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp

    rb295ca r41e15b  
    8686  return true;
    8787}
    88 
    89 const string AnalysisPrincipalAxisSystemAction::getName() {
    90   return NAME;
    91 }
    9288/** =========== end of function ====================== */
  • src/Actions/AnalysisAction/PrincipalAxisSystemAction.def

    rb295ca r41e15b  
     1#undef paramdescriptions
     2#undef paramdefaults
    13/*
    24 * PrincipalAxisSystemAction.def
     
    1012// i.e. there is an integer with variable name Z that can be found in
    1113// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    12 // "undefine" if no parameters are required
     14// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     15#undef paramtypes
     16#undef paramreferences
     17#undef paramtokens
     18#undef paramdescriptions
     19#undef paramdefaults
    1320
    1421// some defines for all the names, you may use ACTION, STATE and PARAMS
    1522#define CATEGORY Analysis
     23#define MENUNAME "analysis"
     24#define MENUPOSITION 5
    1625#define ACTIONNAME PrincipalAxisSystem
    1726#define TOKEN "principal-axis-system"
     27
     28// finally the information stored in the ActionTrait specialization
     29#define DESCRIPTION "calculate the principal axis system of the specified molecule"
     30#undef SHORTFORM
  • src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp

    rb295ca r41e15b  
    5555
    5656  // execute action
    57   output.open(params.outputname.c_str());
    58   binoutput.open(params.binoutputname.c_str());
     57  output.open(params.outputname.string().c_str());
     58  binoutput.open(params.binoutputname.string().c_str());
    5959  ASSERT(params.Boundary != NULL, "No molecule specified for SurfaceCorrelation.");
    6060  const double radius = 4.;
     
    114114  return true;
    115115}
    116 
    117 const string AnalysisSurfaceCorrelationAction::getName() {
    118   return NAME;
    119 }
    120116/** =========== end of function ====================== */
  • src/Actions/AnalysisAction/SurfaceCorrelationAction.def

    rb295ca r41e15b  
    1414// i.e. there is an integer with variable name Z that can be found in
    1515// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    16 // "undefine" if no parameters are required
    17 #define paramtypes (std::vector<const element *>)(molecule *)(double)(double)(double)(std::string)(std::string)(bool)
     16// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     17#define paramtypes (std::vector<const element *>)(const molecule *)(double)(double)(double)(boost::filesystem::path)(boost::filesystem::path)(bool)
    1818#define paramreferences (elements)(Boundary)(BinStart)(BinWidth)(BinEnd)(outputname)(binoutputname)(periodic)
    1919#define paramtokens ("elements")("molecule-by-id")("bin-start")("bin-width")("bin-end")("output-file")("bin-output-file")("periodic")
     20#define paramdescriptions ("set of elements")("index of a molecule")("start of the first bin")("width of the bins")("start of the last bin")("name of the output file")("name of the bin output file")("system is constraint to periodic boundary conditions")
     21#define paramdefaults (NODEFAULT)(NODEFAULT)(NODEFAULT)("0.5")(NODEFAULT)(NODEFAULT)(NODEFAULT)("0")
    2022
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Analysis
     25#define MENUNAME "analysis"
     26#define MENUPOSITION 4
    2327#define ACTIONNAME SurfaceCorrelation
    2428#define TOKEN "surface-correlation"
     29
     30// finally the information stored in the ActionTrait specialization
     31#define DESCRIPTION "pair correlation analysis between element and surface"
     32#undef SHORTFORM
  • src/Actions/AtomAction/AddAction.cpp

    rb295ca r41e15b  
    9393  return true;
    9494}
    95 
    96 const string AtomAddAction::getName() {
    97   return NAME;
    98 }
    9995/** =========== end of function ====================== */
  • src/Actions/AtomAction/AddAction.def

    rb295ca r41e15b  
    1313// i.e. there is an integer with variable name Z that can be found in
    1414// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    15 // "undefine" if no parameters are required
     15// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1616#define paramtypes (const element *)(BoxVector)
    17 #define paramtokens (ACTION::NAME)("position")
     17#define paramtokens ("add-atom")("domain-position")
     18#define paramdescriptions ("element of new atom")("position within current domain")
    1819#define paramreferences (elemental)(position)
     20#define paramdefaults (NODEFAULT)(NODEFAULT)
    1921
    2022#define statetypes (const atomId_t)
     
    2325// some defines for all the names, you may use ACTION, STATE and PARAMS
    2426#define CATEGORY Atom
     27#define MENUNAME "atom"
     28#define MENUPOSITION 1
    2529#define ACTIONNAME Add
    2630#define TOKEN "add-atom"
     31
     32// finally the information stored in the ActionTrait specialization
     33#define DESCRIPTION "add atom of specified element"
     34#define SHORTFORM "a"
  • src/Actions/AtomAction/ChangeElementAction.cpp

    rb295ca r41e15b  
    105105  return true;
    106106}
    107 
    108 const string AtomChangeElementAction::getName() {
    109   return NAME;
    110 }
    111107/** =========== end of function ====================== */
  • src/Actions/AtomAction/ChangeElementAction.def

    rb295ca r41e15b  
    1212// i.e. there is an integer with variable name Z that can be found in
    1313// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    14 // "undefine" if no parameters are required
     14// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1515#define paramtypes (const element *)
    16 #define paramtokens (ACTION::NAME)
     16#define paramtokens ("change-element")
     17#define paramdescriptions ("new the element of atom")
     18#undef paramdefaults
    1719#define paramreferences (elemental)
    1820
     
    2224// some defines for all the names, you may use ACTION, STATE and PARAMS
    2325#define CATEGORY Atom
     26#define MENUNAME "atom"
     27#define MENUPOSITION 2
    2428#define ACTIONNAME ChangeElement
    2529#define TOKEN "change-element"
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "change the element of an atom"
     33#define SHORTFORM "E"
  • src/Actions/AtomAction/RemoveAction.cpp

    rb295ca r41e15b  
    107107  return true;
    108108}
    109 
    110 const string AtomRemoveAction::getName() {
    111   return NAME;
    112 }
    113109/** =========== end of function ====================== */
  • src/Actions/AtomAction/RemoveAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#undef paramtypes
    1515#undef paramtokens
     16#undef paramdescriptions
     17#undef paramdefaults
    1618#undef paramreferences
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Atom
     25#define MENUNAME "atom"
     26#define MENUPOSITION 3
    2327#define ACTIONNAME Remove
    2428#define TOKEN "remove-atom"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "remove a specified atom"
     33#define SHORTFORM "r"
  • src/Actions/AtomAction/RotateAroundOriginByAngleAction.cpp

    rb295ca r41e15b  
    9898  return true;
    9999}
    100 
    101 const string AtomRotateAroundOriginByAngleAction::getName() {
    102   return NAME;
    103 }
    104100/** =========== end of function ====================== */
  • src/Actions/AtomAction/RotateAroundOriginByAngleAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (double) (Vector)
    15 #define paramtokens (AtomRotateAroundOriginByAngleAction::NAME) ("position")
    16 #define paramreferences (angle) (Axis)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (double)(Vector)
     15#define paramtokens ("rotate-origin")("position")
     16#define paramdescriptions ("rotation angle")("position in R^3 space")
     17#undef paramdefaults
     18#define paramreferences (angle)(Axis)
    1719
    1820#define statetypes (std::vector<atom*>)
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Atom
     25#define MENUNAME "atom"
     26#define MENUPOSITION 5
    2327#define ACTIONNAME RotateAroundOriginByAngle
    2428#define TOKEN "rotate-origin"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "rotate selected atoms by a specific angle around origin"
     33#undef SHORTFORM
  • src/Actions/AtomAction/TranslateAction.cpp

    rb295ca r41e15b  
    8888  return true;
    8989}
    90 
    91 const string AtomTranslateAction::getName() {
    92   return NAME;
    93 }
    9490/** =========== end of function ====================== */
  • src/Actions/AtomAction/TranslateAction.def

    rb295ca r41e15b  
    77
    88// all includes and forward declarations necessary for non-integral types below
     9#include "Actions/Values.hpp"
    910#include "LinearAlgebra/Vector.hpp"
    1011
    1112// i.e. there is an integer with variable name Z that can be found in
    1213// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (Vector) (bool)
    15 #define paramtokens (AtomTranslateAction::NAME) ("periodic")
    16 #define paramreferences (x) (periodic)
     14// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     15#define paramtypes (Vector)(bool)
     16#define paramtokens ("translate-atoms")("periodic")
     17#define paramdescriptions ("translation vector")("system is constraint to periodic boundary conditions")
     18#define paramreferences (x)(periodic)
     19#define paramdefaults (NODEFAULT)("0")
    1720
    1821#define statetypes (std::vector<atom*>)
     
    2124// some defines for all the names, you may use ACTION, STATE and PARAMS
    2225#define CATEGORY Atom
     26#define MENUNAME "atom"
     27#define MENUPOSITION 4
    2328#define ACTIONNAME Translate
    2429#define TOKEN "translate-atoms"
    2530
     31
     32// finally the information stored in the ActionTrait specialization
     33#define DESCRIPTION "translate all selected atoms by given vector"
     34#define SHORTFORM "t"
  • src/Actions/AtomsCalculation.hpp

    rb295ca r41e15b  
    1717{
    1818public:
    19   AtomsCalculation(boost::function<T(atom*)> op,std::string name,AtomDescriptor descr);
     19  AtomsCalculation(boost::function<T(atom*)> op,const ActionTraits &_trait,AtomDescriptor descr);
    2020  virtual ~AtomsCalculation();
    2121
  • src/Actions/AtomsCalculation_impl.hpp

    rb295ca r41e15b  
    1515
    1616template<typename T>
    17 AtomsCalculation<T>::AtomsCalculation(boost::function<T(atom*)> _op,std::string name,AtomDescriptor _descr) :
    18   Calculation<std::vector<T> >(0,name,false),
     17AtomsCalculation<T>::AtomsCalculation(boost::function<T(atom*)> _op,const ActionTraits &_trait,AtomDescriptor _descr) :
     18  Calculation<std::vector<T> >(0,_trait,false),
    1919  descr(_descr),
    2020  op(_op)
  • src/Actions/Calculation.hpp

    rb295ca r41e15b  
    2121{
    2222public:
    23   Calculation(int _maxSteps, std::string _name, bool _doRegister=true);
     23  Calculation(int _maxSteps, const ActionTraits &_trait, bool _doRegister=true);
    2424  virtual ~Calculation();
    2525
  • src/Actions/Calculation_impl.hpp

    rb295ca r41e15b  
    1414
    1515template<typename T>
    16 Calculation<T>::Calculation(int _maxSteps, std::string _name, bool _doRegister) :
    17   Process(_maxSteps,_name,_doRegister),
     16Calculation<T>::Calculation(int _maxSteps, const ActionTraits &_trait, bool _doRegister) :
     17  Process(_maxSteps,_trait,_doRegister),
    1818  result(0),
    1919  done(false)
  • src/Actions/CommandAction/BondLengthTableAction.cpp

    rb295ca r41e15b  
    4747  if (configuration->BG == NULL) {
    4848    configuration->BG = new BondGraph(configuration->GetIsAngstroem());
    49     if ((!params.BondGraphFileName.empty()) && (configuration->BG->LoadBondLengthTable(params.BondGraphFileName))) {
     49    if ((!params.BondGraphFileName.empty()) && (configuration->BG->LoadBondLengthTable(params.BondGraphFileName.string()))) {
    5050      DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
    5151      return Action::success;
     
    8181  return false;
    8282}
    83 
    84 const string CommandBondLengthTableAction::getName() {
    85   return NAME;
    86 }
    8783/** =========== end of function ====================== */
  • src/Actions/CommandAction/BondLengthTableAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (std::string)
    15 #define paramtokens (CommandBondLengthTableAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (boost::filesystem::path)
     15#define paramtokens ("bond-table")
     16#define paramdescriptions ("name of the bond length table file")
     17#undef paramdefaults
    1618#define paramreferences (BondGraphFileName)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Command
     25#define MENUNAME "command"
     26#define MENUPOSITION 1
    2327#define ACTIONNAME BondLengthTable
    2428#define TOKEN "bond-table"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "specifying a table file with specific bond lengths to use in bond structure analysis"
     33#define SHORTFORM "g"
  • src/Actions/CommandAction/ElementDbAction.cpp

    rb295ca r41e15b  
    4646  // TODO: Make databasepath a std::string
    4747  config *configuration = World::getInstance().getConfig();
    48   strcpy(configuration->databasepath, params.databasepath.c_str());
     48  strcpy(configuration->databasepath, params.databasepath.branch_path().string().c_str());
    4949
    5050  // load table
     
    8282  return false;
    8383}
    84 
    85 const string CommandElementDbAction::getName() {
    86   return NAME;
    87 }
    8884/** =========== end of function ====================== */
  • src/Actions/CommandAction/ElementDbAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (std::string)
    15 #define paramtokens (CommandElementDbAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (boost::filesystem::path)
     15#define paramtokens ("element-db")
     16#define paramdescriptions ("path where the element databases can be found")
     17#undef paramdefaults
    1618#define paramreferences (databasepath)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Command
     25#define MENUNAME "command"
     26#define MENUPOSITION 2
    2327#define ACTIONNAME ElementDb
    2428#define TOKEN "element-db"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "specify the path to a different element databases"
     33#define SHORTFORM "e"
  • src/Actions/CommandAction/FastParsingAction.cpp

    rb295ca r41e15b  
    8484  return true;
    8585}
    86 
    87 const string CommandFastParsingAction::getName() {
    88   return NAME;
    89 }
    9086/** =========== end of function ====================== */
  • src/Actions/CommandAction/FastParsingAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#define paramtypes (bool)
    15 #define paramtokens (CommandFastParsingAction::NAME)
     15#define paramtokens ("fastparsing")
     16#define paramdescriptions ("setting whether trajectories shall be parsed completely (n) or just first step (y)")
     17#undef paramdefaults
    1618#define paramreferences (fastparsing)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Command
     25#define MENUNAME "command"
     26#define MENUPOSITION 3
    2327#define ACTIONNAME FastParsing
    2428#define TOKEN "fastparsing"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "setting whether trajectories shall be parsed completely (n) or just first step (y)"
     33#define SHORTFORM "n"
  • src/Actions/CommandAction/HelpAction.cpp

    rb295ca r41e15b  
    1919
    2020#include "Helpers/MemDebug.hpp"
    21 
    22 #include "CommandLineParser.hpp"
    2321
    2422#include <iostream>
     
    5553  return false;
    5654}
    57 
    58 const string CommandHelpAction::getName() {
    59   return NAME;
    60 }
    6155/** =========== end of function ====================== */
  • src/Actions/CommandAction/HelpAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#undef paramtypes
    1515#undef paramtokens
     16#undef paramdescriptions
     17#undef paramdefaults
    1618#undef paramreferences
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Command
     25#define MENUNAME "command"
     26#define MENUPOSITION 4
    2327#define ACTIONNAME Help
    2428#define TOKEN "help"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "help screen"
     33#define SHORTFORM "h"
  • src/Actions/CommandAction/VerboseAction.cpp

    rb295ca r41e15b  
    7676  return true;
    7777}
    78 
    79 const string CommandVerboseAction::getName() {
    80   return NAME;
    81 }
    8278/** =========== end of function ====================== */
  • src/Actions/CommandAction/VerboseAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#define paramtypes (int)
    15 #define paramtokens (CommandVerboseAction::NAME)
     15#define paramtokens ("verbose")
     16#define paramdescriptions ("set verbosity level")
     17#undef paramdefaults
    1618#define paramreferences (verbosity)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Command
     25#define MENUNAME "command"
     26#define MENUPOSITION 5
    2327#define ACTIONNAME Verbose
    2428#define TOKEN "verbose"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "set verbosity level"
     33#define SHORTFORM "v"
  • src/Actions/CommandAction/VersionAction.cpp

    rb295ca r41e15b  
    5555  return false;
    5656}
    57 
    58 const string CommandVersionAction::getName() {
    59   return NAME;
    60 }
    6157/** =========== end of function ====================== */
  • src/Actions/CommandAction/VersionAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#undef paramtypes
    1515#undef paramtokens
     16#undef paramdescriptions
     17#undef paramdefaults
    1618#undef paramreferences
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Command
     25#define MENUNAME "command"
     26#define MENUPOSITION 6
    2327#define ACTIONNAME Version
    2428#define TOKEN "version"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "show version"
     33#define SHORTFORM "V"
  • src/Actions/CommandAction/WarrantyAction.cpp

    rb295ca r41e15b  
    1919
    2020#include "Helpers/MemDebug.hpp"
    21 
    22 #include "CommandLineParser.hpp"
    2321
    2422#include <iostream>
     
    6159  return false;
    6260}
    63 
    64 const string CommandWarrantyAction::getName() {
    65   return NAME;
    66 }
    6761/** =========== end of function ====================== */
  • src/Actions/CommandAction/WarrantyAction.def

    rb295ca r41e15b  
    1010// i.e. there is an integer with variable name Z that can be found in
    1111// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    12 // "undefine" if no parameters are required
     12// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1313#undef paramtypes
    1414#undef paramtokens
     15#undef paramdescriptions
     16#undef paramdefaults
    1517#undef paramreferences
    1618
     
    2022// some defines for all the names, you may use ACTION, STATE and PARAMS
    2123#define CATEGORY Command
     24#define MENUNAME "command"
     25#define MENUPOSITION 7
    2226#define ACTIONNAME Warranty
    2327#define TOKEN "warranty"
    2428
     29
     30// finally the information stored in the ActionTrait specialization
     31#define DESCRIPTION "statement concerning warranty of the software"
     32#undef SHORTFORM
  • src/Actions/ErrorAction.cpp

    rb295ca r41e15b  
    2929using namespace std;
    3030
    31 ErrorAction::ErrorAction(string _name,const char * _errorMsg,bool _doRegister) :
    32 Action(_name,_doRegister),
     31ErrorAction::ErrorAction(const ActionTraits &_trait,const char * _errorMsg,bool _doRegister) :
     32Action(_trait,_doRegister),
    3333errorMsg(_errorMsg)
    3434{
  • src/Actions/ErrorAction.hpp

    rb295ca r41e15b  
    1515{
    1616public:
    17   ErrorAction(std::string _name,const char * _errorMsg,bool _doRegister=true);
     17  ErrorAction(const ActionTraits &_trait,const char * _errorMsg,bool _doRegister=true);
    1818  virtual ~ErrorAction();
    1919
  • src/Actions/FragmentationAction/ConstructBondGraphAction.cpp

    rb295ca r41e15b  
    174174  return false;
    175175}
    176 
    177 const string FragmentationConstructBondGraphAction::getName() {
    178   return NAME;
    179 }
    180176/** =========== end of function ====================== */
  • src/Actions/FragmentationAction/ConstructBondGraphAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#undef paramtypes
    1515#undef paramtokens
     16#undef paramdescriptions
     17#undef paramdefaults
    1618#undef paramreferences
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Fragmentation
     25#define MENUNAME "fragmentation"
     26#define MENUPOSITION 1
    2327#define ACTIONNAME ConstructBondGraph
    2428#define TOKEN "construct-bondgraph"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "construct the bond graph of the selected atoms"
     33#undef SHORTFORM
  • src/Actions/FragmentationAction/DepthFirstSearchAction.cpp

    rb295ca r41e15b  
    9191  return true;
    9292}
    93 
    94 const string FragmentationDepthFirstSearchAction::getName() {
    95   return NAME;
    96 }
    9793/** =========== end of function ====================== */
  • src/Actions/FragmentationAction/DepthFirstSearchAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#define paramtypes (double)
    15 #define paramtokens (FragmentationDepthFirstSearchAction::NAME)
     15#define paramtokens ("depth-first-search")
     16#define paramdescriptions ("maximum distance to look for neighbors")
     17#undef paramdefaults
    1618#define paramreferences (distance)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Fragmentation
     25#define MENUNAME "fragmentation"
     26#define MENUPOSITION 2
    2327#define ACTIONNAME DepthFirstSearch
    2428#define TOKEN "depth-first-search"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "Depth-First Search analysis of the molecular system"
     33#define SHORTFORM "D"
  • src/Actions/FragmentationAction/FragmentationAction.cpp

    rb295ca r41e15b  
    8282  return true;
    8383}
    84 
    85 const string FragmentationFragmentationAction::getName() {
    86   return NAME;
    87 }
    8884/** =========== end of function ====================== */
  • src/Actions/FragmentationAction/FragmentationAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (std::string) (double) (int)
    15 #define paramtokens (FragmentationFragmentationAction::NAME) ("distance") ("order")
    16 #define paramreferences (path) (distance) (order)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (std::string)(double)(int)
     15#define paramtokens ("fragment-mol")("distance")("order")
     16#define paramdescriptions ("path to where the fragment configurations shall be stored")("distance in space")("order of a discretization, dissection, ...")
     17#undef paramdefaults
     18#define paramreferences (path)(distance)(order)
    1719
    1820#undef statetypes
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Fragmentation
     25#define MENUNAME "fragmentation"
     26#define MENUPOSITION 3
    2327#define ACTIONNAME Fragmentation
    2428#define TOKEN "fragment-mol"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "create for a given molecule into fragments up to given order"
     33#define SHORTFORM "f"
  • src/Actions/FragmentationAction/SubgraphDissectionAction.cpp

    rb295ca r41e15b  
    212212  return true;
    213213}
    214 
    215 const string FragmentationSubgraphDissectionAction::getName() {
    216   return NAME;
    217 }
    218214/** =========== end of function ====================== */
  • src/Actions/FragmentationAction/SubgraphDissectionAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#undef paramtypes
    1515#undef paramtokens
     16#undef paramdescriptions
     17#undef paramdefaults
    1618#undef paramreferences
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Fragmentation
     25#define MENUNAME "fragmentation"
     26#define MENUPOSITION 4
    2327#define ACTIONNAME SubgraphDissection
    2428#define TOKEN "subgraph-dissect"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "dissect the molecular system into molecules representing disconnected subgraphs"
     33#define SHORTFORM "I"
  • src/Actions/Makefile.am

    rb295ca r41e15b  
    1717  ${TESSELATIONACTIONSOURCE} \
    1818  ${WORLDACTIONSOURCE} \
    19   MapOfActions.cpp \
     19  RedoAction.cpp \
     20  UndoAction.cpp \
    2021  ValueStorage.cpp
    2122
     
    3031  ${TESSELATIONACTIONHEADER} \
    3132  ${WORLDACTIONHEADER} \
    32   MapOfActions.hpp \
    3333  ValueStorage.hpp \
    3434  Values.hpp
  • src/Actions/MakroAction.cpp

    rb295ca r41e15b  
    4141};
    4242
    43 MakroAction::MakroAction(string _name,ActionSequence* _actions,bool _doRegister) :
    44 Action(_name,_doRegister),
     43MakroAction::MakroAction(const ActionTraits &_trait,ActionSequence* _actions,bool _doRegister) :
     44Action(_trait,_doRegister),
    4545actions(_actions)
    4646{
  • src/Actions/MakroAction.hpp

    rb295ca r41e15b  
    2323{
    2424public:
    25   MakroAction(std::string _name,ActionSequence* _actions,bool _doRegister=true);
     25  MakroAction(const ActionTraits &_trait,ActionSequence* _actions,bool _doRegister=true);
    2626  virtual ~MakroAction();
    2727
  • src/Actions/ManipulateAtomsProcess.cpp

    rb295ca r41e15b  
    2929using namespace std;
    3030
    31 ManipulateAtomsProcess::ManipulateAtomsProcess(boost::function<void(atom*)> _operation, AtomDescriptor _descr,
    32                                                std::string _name,bool _doRegister) :
    33   Process(0,_name,_doRegister),
     31ManipulateAtomsProcess::ManipulateAtomsProcess(
     32    boost::function<void(atom*)> _operation,
     33    AtomDescriptor _descr,
     34    const ActionTraits &_trait,
     35    bool _doRegister) :
     36  Process(0,_trait,_doRegister),
    3437  descr(_descr),
    3538  operation(_operation)
  • src/Actions/ManipulateAtomsProcess.hpp

    rb295ca r41e15b  
    2020{
    2121public:
    22   ManipulateAtomsProcess(boost::function<void(atom*)> _operation, AtomDescriptor descr,std::string _name,bool _doRegister=true);
     22  ManipulateAtomsProcess(boost::function<void(atom*)> _operation, AtomDescriptor descr,const ActionTraits &_trait,bool _doRegister=true);
    2323  virtual ~ManipulateAtomsProcess();
    2424
  • src/Actions/MethodAction.cpp

    rb295ca r41e15b  
    2929using namespace std;
    3030
    31 MethodAction::MethodAction(string _name,boost::function<void()> _executeMethod,bool _doRegister) :
    32    Action(_name,_doRegister),
     31MethodAction::MethodAction(const ActionTraits &_trait,boost::function<void()> _executeMethod,bool _doRegister) :
     32   Action(_trait,_doRegister),
    3333executeMethod(_executeMethod)
    3434{
  • src/Actions/MethodAction.hpp

    rb295ca r41e15b  
    2020{
    2121public:
    22   MethodAction(std::string _name,boost::function<void()> _executeMethod,bool _doRegister=true);
     22  MethodAction(const ActionTraits &_trait,boost::function<void()> _executeMethod,bool _doRegister=true);
    2323  virtual ~MethodAction();
    2424  virtual bool canUndo();
  • src/Actions/MoleculeAction/BondFileAction.cpp

    rb295ca r41e15b  
    4646    mol = World::getInstance().beginMoleculeSelection()->second;
    4747    DoLog(0) && (Log() << Verbose(0) << "Parsing bonds from " << params.bondfile << "." << endl);
    48     ifstream input(params.bondfile.c_str());
     48    ifstream input(params.bondfile.string().c_str());
    4949    mol->CreateAdjacencyListFromDbondFile(&input);
    5050    input.close();
     
    7575  return false;
    7676}
    77 
    78 const string MoleculeBondFileAction::getName() {
    79   return NAME;
    80 }
    8177/** =========== end of function ====================== */
  • src/Actions/MoleculeAction/BondFileAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (std::string)
    15 #define paramtokens (MoleculeBondFileAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (boost::filesystem::path)
     15#define paramtokens ("bond-file")
     16#define paramdescriptions ("name of the bond file")
     17#undef paramdefaults
    1618#define paramreferences (bondfile)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Molecule
     25#define MENUNAME "molecule"
     26#define MENUPOSITION 1
    2327#define ACTIONNAME BondFile
    2428#define TOKEN "bond-file"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "parse bond structure from dbond file"
     33#define SHORTFORM "A"
  • src/Actions/MoleculeAction/ChangeNameAction.cpp

    rb295ca r41e15b  
    7171  return true;
    7272}
    73 
    74 const string MoleculeChangeNameAction::getName() {
    75   return NAME;
    76 }
    7773/** =========== end of function ====================== */
  • src/Actions/MoleculeAction/ChangeNameAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#define paramtypes (std::string)
    15 #define paramtokens (MoleculeChangeNameAction::NAME)
     15#define paramtokens ("change-molname")
     16#define paramdescriptions ("new name of molecule")
     17#undef paramdefaults
    1618#define paramreferences (name)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Molecule
     25#define MENUNAME "molecule"
     26#define MENUPOSITION 3
    2327#define ACTIONNAME ChangeName
    2428#define TOKEN "change-molname"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "change the name of a molecule"
     33#undef SHORTFORM
  • src/Actions/MoleculeAction/CopyAction.cpp

    rb295ca r41e15b  
    9191  return true;
    9292}
    93 
    94 const string MoleculeCopyAction::getName() {
    95   return NAME;
    96 }
    9793/** =========== end of function ====================== */
  • src/Actions/MoleculeAction/CopyAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (molecule *) (Vector)
    15 #define paramtokens (MoleculeCopyAction::NAME) ("position")
    16 #define paramreferences (mol) (position)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (const molecule *)(Vector)
     15#define paramtokens ("copy-molecule")("position")
     16#define paramdescriptions ("molecule to copy")("position in R^3 space")
     17#undef paramdefaults
     18#define paramreferences (mol)(position)
    1719
    1820#define statetypes (molecule *)
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Molecule
     25#define MENUNAME "molecule"
     26#define MENUPOSITION 2
    2327#define ACTIONNAME Copy
    2428#define TOKEN "copy-molecule"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "copies a molecule with all atoms and bonds"
     33#undef SHORTFORM
  • src/Actions/MoleculeAction/FillVoidWithMoleculeAction.cpp

    rb295ca r41e15b  
    5454  // construct water molecule
    5555  molecule *filler = World::getInstance().createMolecule();
    56   std::string FilenameSuffix = params.fillername.substr(params.fillername.find_last_of('.')+1, params.fillername.length());
     56  std::string FilenameSuffix = params.fillername.string().substr(params.fillername.string().find_last_of('.')+1, params.fillername.string().length());
    5757  ifstream input;
    58   input.open(params.fillername.c_str());
     58  input.open(params.fillername.string().c_str());
    5959  switch (FormatParserStorage::getInstance().getTypeFromSuffix(FilenameSuffix)) {
    6060    case mpqc:
     
    9595  for (; iter != World::getInstance().moleculeEnd(); ++iter)
    9696    filler = *iter; // get last molecule
    97   filler->SetNameFromFilename(params.fillername.c_str());
     97  filler->SetNameFromFilename(params.fillername.string().c_str());
    9898  World::getInstance().getConfig()->BG->ConstructBondGraph(filler);
    9999
     
    128128  return false;
    129129}
    130 
    131 const string MoleculeFillVoidWithMoleculeAction::getName() {
    132   return NAME;
    133 }
    134130/** =========== end of function ====================== */
  • src/Actions/MoleculeAction/FillVoidWithMoleculeAction.def

    rb295ca r41e15b  
    1212// i.e. there is an integer with variable name Z that can be found in
    1313// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    14 // "undefine" if no parameters are required
    15 #define paramtypes (std::string) (Vector) (Vector) (bool)
    16 #define paramtokens (MoleculeFillVoidWithMoleculeAction::NAME) ("distances") ("lengths") ("DoRotate")
    17 #define paramreferences (fillername) (distances) (lengths) (DoRotate)
     14// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     15#define paramtypes (boost::filesystem::path)(Vector)(Vector)(bool)
     16#define paramtokens ("fill-void")("distances")("lengths")("DoRotate")
     17#define paramdescriptions ("name of xyz file of filler molecule")("list of three of distances in space, one for each axis direction")("list of three of lengths in space, one for each axis direction")("whether to rotate or not")
     18#undef paramdefaults
     19#define paramreferences (fillername)(distances)(lengths)(DoRotate)
    1820
    1921#undef statetypes
     
    2224// some defines for all the names, you may use ACTION, STATE and PARAMS
    2325#define CATEGORY Molecule
     26#define MENUNAME "molecule"
     27#define MENUPOSITION 5
    2428#define ACTIONNAME FillVoidWithMolecule
    2529#define TOKEN "fill-void"
    2630
     31
     32// finally the information stored in the ActionTrait specialization
     33#define DESCRIPTION "fill void space of box with a filler molecule"
     34#undef SHORTFORM
  • src/Actions/MoleculeAction/FillWithMoleculeAction.cpp

    rb295ca r41e15b  
    4848  // construct water molecule
    4949  molecule *filler = World::getInstance().createMolecule();
    50   if (!filler->AddXYZFile(params.fillername)) {
     50  if (!filler->AddXYZFile(params.fillername.string())) {
    5151    DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << params.fillername << "." << endl);
    5252  }
    53   filler->SetNameFromFilename(params.fillername.c_str());
     53  filler->SetNameFromFilename(params.fillername.string().c_str());
    5454  molecule *Filling = NULL;
    5555//    atom *first = NULL, *second = NULL, *third = NULL;
     
    110110  return false;
    111111}
    112 
    113 const string MoleculeFillWithMoleculeAction::getName() {
    114   return NAME;
    115 }
    116112/** =========== end of function ====================== */
  • src/Actions/MoleculeAction/FillWithMoleculeAction.def

    rb295ca r41e15b  
    1212// i.e. there is an integer with variable name Z that can be found in
    1313// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    14 // "undefine" if no parameters are required
    15 #define paramtypes (std::string) (Vector) (Vector) (double) (bool)
    16 #define paramtokens (MoleculeFillWithMoleculeAction::NAME) ("distances") ("lengths") ("MaxDistance") ("DoRotate")
    17 #define paramreferences (fillername) (distances) (lengths) (MaxDistance) (DoRotate)
     14// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     15#define paramtypes (boost::filesystem::path)(Vector)(Vector)(double)(bool)
     16#define paramtokens ("fill-molecule")("distances")("lengths")("MaxDistance")("DoRotate")
     17#define paramdescriptions ("name of xyz file of filler molecule")("list of three of distances in space, one for each axis direction")("list of three of lengths in space, one for each axis direction")("maximum spatial distance")("whether to rotate or not")
     18#undef paramdefaults
     19#define paramreferences (fillername)(distances)(lengths)(MaxDistance)(DoRotate)
    1820
    1921#undef statetypes
     
    2224// some defines for all the names, you may use ACTION, STATE and PARAMS
    2325#define CATEGORY Molecule
     26#define MENUNAME "molecule"
     27#define MENUPOSITION 4
    2428#define ACTIONNAME FillWithMolecule
    2529#define TOKEN "fill-molecule"
    2630
     31
     32// finally the information stored in the ActionTrait specialization
     33#define DESCRIPTION "fill around molecules' surface with a filler molecule"
     34#define SHORTFORM "F"
     35
  • src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp

    rb295ca r41e15b  
    5050    if (params.IdMapping)
    5151      DoLog(1) && (Log() << Verbose(1) << "Using Identity for the permutation map." << endl);
    52     if (!mol->LinearInterpolationBetweenConfiguration(params.start, params.end, params.filename, *(World::getInstance().getConfig()), params.IdMapping))
     52    if (!mol->LinearInterpolationBetweenConfiguration(params.start, params.end, params.filename.branch_path().string(), *(World::getInstance().getConfig()), params.IdMapping))
    5353      DoLog(2) && (Log() << Verbose(2) << "Could not store " << params.filename << " files." << endl);
    5454    else
     
    7979  return false;
    8080}
    81 
    82 const string MoleculeLinearInterpolationofTrajectoriesAction::getName() {
    83   return NAME;
    84 }
    8581/** =========== end of function ====================== */
  • src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (std::string) (int) (int) (bool)
    15 #define paramtokens (MoleculeLinearInterpolationofTrajectoriesAction::NAME) ("start-step") ("end-step") ("id-mapping")
    16 #define paramreferences (filename) (start) (end) (IdMapping)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (boost::filesystem::path)(int)(int)(bool)
     15#define paramtokens ("linear-interpolate")("start-step")("end-step")("id-mapping")
     16#define paramdescriptions ("path where to store the intermediate configurations")("first or start step")("last or end step")("whether the identity shall be used in mapping atoms onto atoms or not")
     17#undef paramdefaults
     18#define paramreferences (filename)(start)(end)(IdMapping)
    1719
    1820#undef statetypes
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Molecule
     25#define MENUNAME "molecule"
     26#define MENUPOSITION 6
    2327#define ACTIONNAME LinearInterpolationofTrajectories
    2428#define TOKEN "linear-interpolate"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "linear interpolation in discrete steps between start and end position of a molecule"
     33#define SHORTFORM "L"
  • src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp

    rb295ca r41e15b  
    107107  return true;
    108108}
    109 
    110 const string MoleculeRotateAroundSelfByAngleAction::getName() {
    111   return NAME;
    112 }
    113109/** =========== end of function ====================== */
  • src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.def

    rb295ca r41e15b  
    1212// i.e. there is an integer with variable name Z that can be found in
    1313// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    14 // "undefine" if no parameters are required
    15 #define paramtypes (double) (Vector)
    16 #define paramtokens (MoleculeRotateAroundSelfByAngleAction::NAME) ("position")
    17 #define paramreferences (angle) (Axis)
     14// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     15#define paramtypes (double)(Vector)
     16#define paramtokens ("rotate-self")("position")
     17#define paramdescriptions ("rotation angle")("position in R^3 space")
     18#undef paramdefaults
     19#define paramreferences (angle)(Axis)
    1820
    1921#define statetypes (molecule * const)
     
    2224// some defines for all the names, you may use ACTION, STATE and PARAMS
    2325#define CATEGORY Molecule
     26#define MENUNAME "molecule"
     27#define MENUPOSITION 8
    2428#define ACTIONNAME RotateAroundSelfByAngle
    2529#define TOKEN "rotate-self"
    2630
     31
     32// finally the information stored in the ActionTrait specialization
     33#define DESCRIPTION "rotates molecules by a specific angle around own center of gravity"
     34#undef SHORTFORM
  • src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp

    rb295ca r41e15b  
    152152  return false;
    153153}
    154 
    155 const string MoleculeRotateToPrincipalAxisSystemAction::getName() {
    156   return NAME;
    157 }
    158154/** =========== end of function ====================== */
  • src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.def

    rb295ca r41e15b  
    77
    88// all includes and forward declarations necessary for non-integral types below
     9#include "Actions/Values.hpp"
    910#include "LinearAlgebra/Vector.hpp"
     11
    1012class MoleculeListClass;
    1113
    1214// i.e. there is an integer with variable name Z that can be found in
    1315// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    14 // "undefine" if no parameters are required
     16// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1517#define paramtypes (Vector)
    16 #define paramtokens (MoleculeRotateToPrincipalAxisSystemAction::NAME)
     18#define paramtokens ("rotate-to-pas")
     19#define paramdescriptions ("vector to which to align the biggest eigenvector with")
     20#undef paramdefaults
    1721#define paramreferences (Axis)
    1822
     
    2226// some defines for all the names, you may use ACTION, STATE and PARAMS
    2327#define CATEGORY Molecule
     28#define MENUNAME "molecule"
     29#define MENUPOSITION 9
    2430#define ACTIONNAME RotateToPrincipalAxisSystem
    2531#define TOKEN "rotate-to-pas"
    2632
     33
     34// finally the information stored in the ActionTrait specialization
     35#define DESCRIPTION "calculate the principal axis system of the specified molecule and rotate specified axis to align with main axis"
     36#define SHORTFORM "m"
  • src/Actions/MoleculeAction/SaveAdjacencyAction.cpp

    rb295ca r41e15b  
    5151    World::getInstance().getConfig()->BG->ConstructBondGraph(mol);
    5252    // TODO: sollte stream nicht filename benutzen, besser fuer unit test
    53     mol->StoreAdjacencyToFile(params.adjacencyfile);
     53    mol->StoreAdjacencyToFile(params.adjacencyfile.leaf(), params.adjacencyfile.branch_path().string());
    5454  }
    5555  return Action::success;
     
    7777  return false;
    7878}
    79 
    80 const string MoleculeSaveAdjacencyAction::getName() {
    81   return NAME;
    82 }
    8379/** =========== end of function ====================== */
  • src/Actions/MoleculeAction/SaveAdjacencyAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (std::string)
    15 #define paramtokens (MoleculeSaveAdjacencyAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (boost::filesystem::path)
     15#define paramtokens ("save-adjacency")
     16#define paramdescriptions ("name of the adjacency file to write to")
     17#undef paramdefaults
    1618#define paramreferences (adjacencyfile)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Molecule
     25#define MENUNAME "molecule"
     26#define MENUPOSITION 10
    2327#define ACTIONNAME SaveAdjacency
    2428#define TOKEN "save-adjacency"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "store adjacency of each atom to file"
     33#define SHORTFORM "J"
  • src/Actions/MoleculeAction/SaveBondsAction.cpp

    rb295ca r41e15b  
    5151    World::getInstance().getConfig()->BG->ConstructBondGraph(mol);
    5252    // TODO: sollte stream, nicht filenamen direkt nutzen, besser fuer unit tests
    53     mol->StoreBondsToFile(params.bondsfile);
     53    mol->StoreBondsToFile(params.bondsfile.leaf(), params.bondsfile.branch_path().string());
    5454  }
    5555  return Action::success;
     
    7777  return false;
    7878}
    79 
    80 const string MoleculeSaveBondsAction::getName() {
    81   return NAME;
    82 }
    8379/** =========== end of function ====================== */
  • src/Actions/MoleculeAction/SaveBondsAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (std::string)
    15 #define paramtokens (MoleculeSaveBondsAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (boost::filesystem::path)
     15#define paramtokens ("save-bonds")
     16#define paramdescriptions ("name of the bonds file to write to")
     17#undef paramdefaults
    1618#define paramreferences (bondsfile)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Molecule
     25#define MENUNAME "molecule"
     26#define MENUPOSITION 11
    2327#define ACTIONNAME SaveBonds
    2428#define TOKEN "save-bonds"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "save bonds to dbond type file"
     33#define SHORTFORM "j"
  • src/Actions/MoleculeAction/SaveTemperatureAction.cpp

    rb295ca r41e15b  
    4747    DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << params.temperaturefile << "." << endl);
    4848    ofstream output;
    49     output.open(params.temperaturefile.c_str(), ios::trunc);
     49    output.open(params.temperaturefile.string().c_str(), ios::trunc);
    5050    if (output.fail() || !mol->OutputTemperatureFromTrajectories((ofstream * const) &output, 0, mol->MDSteps))
    5151      DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl);
     
    7878  return false;
    7979}
    80 
    81 const string MoleculeSaveTemperatureAction::getName() {
    82   return NAME;
    83 }
    8480/** =========== end of function ====================== */
  • src/Actions/MoleculeAction/SaveTemperatureAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (std::string)
    15 #define paramtokens (MoleculeSaveTemperatureAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (boost::filesystem::path)
     15#define paramtokens ("save-temperature")
     16#define paramdescriptions ("name of the temperature file to write to")
     17#undef paramdefaults
    1618#define paramreferences (temperaturefile)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Molecule
     25#define MENUNAME "molecule"
     26#define MENUPOSITION 12
    2327#define ACTIONNAME SaveTemperature
    2428#define TOKEN "save-temperature"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "save the temperature per time step to file"
     33#define SHORTFORM "S"
  • src/Actions/MoleculeAction/SuspendInWaterAction.cpp

    rb295ca r41e15b  
    7777  return false;
    7878}
    79 
    80 const string MoleculeSuspendInWaterAction::getName() {
    81   return NAME;
    82 }
    8379/** =========== end of function ====================== */
  • src/Actions/MoleculeAction/SuspendInWaterAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#define paramtypes (double)
    15 #define paramtokens (MoleculeSuspendInWaterAction::NAME)
     15#define paramtokens ("suspend-in-water")
     16#define paramdescriptions ("desired final density")
     17#undef paramdefaults
    1618#define paramreferences (density)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Molecule
     25#define MENUNAME "molecule"
     26#define MENUPOSITION 13
    2327#define ACTIONNAME SuspendInWater
    2428#define TOKEN "suspend-in-water"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "suspend the given molecule in water such that in the domain the mean density is as specified"
     33#define SHORTFORM "u"
  • src/Actions/MoleculeAction/VerletIntegrationAction.cpp

    rb295ca r41e15b  
    4848    // TODO: sollte besser stream nutzen, nicht filename direkt (es sei denn, ist prefix), besser fuer unit test
    4949    char outputname[MAXSTRINGSIZE];
    50     strcpy(outputname, params.forcesfile.c_str());
     50    strcpy(outputname, params.forcesfile.string().c_str());
    5151    if (!mol->VerletForceIntegration(outputname, *(World::getInstance().getConfig()), 0))
    5252      DoLog(2) && (Log() << Verbose(2) << "File " << params.forcesfile << " not found." << endl);
     
    7878  return false;
    7979}
    80 
    81 const string MoleculeVerletIntegrationAction::getName() {
    82   return NAME;
    83 }
    8480/** =========== end of function ====================== */
  • src/Actions/MoleculeAction/VerletIntegrationAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (std::string)
    15 #define paramtokens (MoleculeVerletIntegrationAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (boost::filesystem::path)
     15#define paramtokens ("verlet-integrate")
     16#define paramdescriptions ("perform verlet integration of a given force file")
     17#undef paramdefaults
    1618#define paramreferences (forcesfile)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Molecule
     25#define MENUNAME "molecule"
     26#define MENUPOSITION 14
    2327#define ACTIONNAME VerletIntegration
    2428#define TOKEN "verlet-integrate"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "perform verlet integration of a given force file"
     33#define SHORTFORM "P"
  • src/Actions/ParserAction/LoadXyzAction.cpp

    rb295ca r41e15b  
    3838  getParametersfromValueStorage();
    3939
    40   DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl);
     40  DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file " << params.filename << " for new atoms." << endl);
    4141  // parse xyz file
    4242  ifstream input;
    43   input.open(params.filename.c_str());
     43  input.open(params.filename.string().c_str());
    4444  if (!input.fail()) {
    4545    XyzParser parser; // briefly instantiate a parser which is removed at end of focus
     
    7373  return false;
    7474}
    75 
    76 const string ParserLoadXyzAction::getName() {
    77   return NAME;
    78 }
    7975/** =========== end of function ====================== */
  • src/Actions/ParserAction/LoadXyzAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (std::string)
    15 #define paramtokens (ParserLoadXyzAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (boost::filesystem::path)
     15#define paramtokens ("parse-xyz")
     16#define paramdescriptions ("name of xyz file")
     17#undef paramdefaults
    1618#define paramreferences (filename)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Parser
     25#define MENUNAME "parser"
     26#define MENUPOSITION 1
    2327#define ACTIONNAME LoadXyz
    2428#define TOKEN "parse-xyz"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "parse xyz file into World"
     33#define SHORTFORM "p"
  • src/Actions/ParserAction/SaveXyzAction.cpp

    rb295ca r41e15b  
    2020#include "Helpers/MemDebug.hpp"
    2121
     22#include "Helpers/Log.hpp"
     23#include "Helpers/Verbose.hpp"
    2224#include "Parser/XyzParser.hpp"
    23 #include "atom.hpp"
    24 #include "molecule.hpp"
    2525
    2626#include <iostream>
     
    4141  getParametersfromValueStorage();
    4242
     43  DoLog(1) && (Log() << Verbose(1) << "Storing xyz file " << params.filename << "." << endl);
    4344  // store xyz file
    4445  ofstream output;
    45   output.open(params.filename.c_str());
    46   if (!output.fail())
     46  output.open(params.filename.string().c_str());
     47  if (!output.fail()) {
    4748    parser.save(&output);
     49  } else {
     50    DoeLog(1) && (eLog() << Verbose(1) << "Could not open file " << params.filename << "." << endl);
     51  }
    4852  output.close();
    4953  return Action::failure;
     
    7377  return false;
    7478}
    75 
    76 const string ParserSaveXyzAction::getName() {
    77   return NAME;
    78 }
    7979/** =========== end of function ====================== */
  • src/Actions/ParserAction/SaveXyzAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (std::string)
    15 #define paramtokens (ParserSaveXyzAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (boost::filesystem::path)
     15#define paramtokens ("store-xyz")
     16#define paramdescriptions ("file name of xyz file")
     17#undef paramdefaults
    1618#define paramreferences (filename)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Parser
     25#define MENUNAME "parser"
     26#define MENUPOSITION 2
    2327#define ACTIONNAME SaveXyz
    24 #define TOKEN "SaveXyz"
     28#define TOKEN "store-xyz"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "save world as xyz file"
     33#undef SHORTFORM
  • src/Actions/Process.cpp

    rb295ca r41e15b  
    2424using namespace std;
    2525
    26 Process::Process(int _maxSteps, std::string _name, bool _doRegister) :
    27   Action(_name,_doRegister),
     26Process::Process(int _maxSteps, const ActionTraits &_trait, bool _doRegister) :
     27  Action(_trait,_doRegister),
    2828  Observable("Process"),
    2929  maxSteps(_maxSteps),
  • src/Actions/Process.hpp

    rb295ca r41e15b  
    4040{
    4141public:
    42   Process(int _maxSteps, std::string _name, bool _doRegister=true);
     42  Process(int _maxSteps, const ActionTraits &_trait, bool _doRegister=true);
    4343  virtual ~Process();
    4444
  • src/Actions/SelectionAction/AllAtomsAction.cpp

    rb295ca r41e15b  
    7272  return true;
    7373}
    74 
    75 const string SelectionAllAtomsAction::getName() {
    76   return NAME;
    77 }
    7874/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AllAtomsAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#undef paramtypes
    1515#undef paramtokens
     16#undef paramdescriptions
     17#undef paramdefaults
    1618#undef paramreferences
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 3
    2327#define ACTIONNAME AllAtoms
    2428#define TOKEN "select-all-atoms"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "select all atoms"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/AllAtomsInsideCuboidAction.cpp

    rb295ca r41e15b  
    8686  return true;
    8787}
    88 
    89 const string SelectionAllAtomsInsideCuboidAction::getName() {
    90   return NAME;
    91 }
    9288/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AllAtomsInsideCuboidAction.def

    rb295ca r41e15b  
    77
    88// all includes and forward declarations necessary for non-integral types below
     9#include "Actions/Values.hpp"
     10
    911class Vector;
    1012
    1113// i.e. there is an integer with variable name Z that can be found in
    1214// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (Vector) (Vector) (double) (double) (double)
    15 #define paramtokens (SelectionAllAtomsInsideCuboidAction::NAME) ("position") ("angle-x") ("angle-y") ("angle-z")
    16 #define paramreferences (extension) (position) (Xangle) (Yangle) (Zangle)
     15// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     16#define paramtypes (Vector)(Vector)(double)(double)(double)
     17#define paramtokens ("select-atoms-inside-cuboid")("position")("angle-x")("angle-y")("angle-z")
     18#define paramdescriptions ("dimensions of cuboid")("position in R^3 space")("angle of a rotation around x axis")("angle of a rotation around y axis")("angle of a rotation around z axis")
     19#undef paramdefaults
     20#define paramreferences (extension)(position)(Xangle)(Yangle)(Zangle)
    1721
    1822#define statetypes (std::vector<atom*>)
     
    2125// some defines for all the names, you may use ACTION, STATE and PARAMS
    2226#define CATEGORY Selection
     27#define MENUNAME "selection"
     28#define MENUPOSITION 7
    2329#define ACTIONNAME AllAtomsInsideCuboid
    2430#define TOKEN "select-atoms-inside-cuboid"
    2531
     32
     33// finally the information stored in the ActionTrait specialization
     34#define DESCRIPTION "select all atoms inside a cuboid"
     35#undef SHORTFORM
  • src/Actions/SelectionAction/AllAtomsInsideSphereAction.cpp

    rb295ca r41e15b  
    8080  return true;
    8181}
    82 
    83 const string SelectionAllAtomsInsideSphereAction::getName() {
    84   return NAME;
    85 }
    8682/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AllAtomsInsideSphereAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (double) (Vector)
    15 #define paramtokens (SelectionAllAtomsInsideSphereAction::NAME) ("position")
    16 #define paramreferences (radius) (position)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (double)(Vector)
     15#define paramtokens ("select-atoms-inside-sphere")("position")
     16#define paramdescriptions ("sphere radius")("position in R^3 space")
     17#undef paramdefaults
     18#define paramreferences (radius)(position)
    1719
    1820#define statetypes (std::vector<atom*>)
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 8
    2327#define ACTIONNAME AllAtomsInsideSphere
    2428#define TOKEN "select-atoms-inside-sphere"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "select all atoms inside a sphere"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/AllAtomsOfMoleculeAction.cpp

    rb295ca r41e15b  
    7474  return true;
    7575}
    76 
    77 const string SelectionAllAtomsOfMoleculeAction::getName() {
    78   return NAME;
    79 }
    8076/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AllAtomsOfMoleculeAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (molecule *)
    15 #define paramtokens (SelectionAllAtomsOfMoleculeAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (const molecule *)
     15#define paramtokens ("select-molecules-atoms")
     16#define paramdescriptions ("molecule to select")
     17#undef paramdefaults
    1618#define paramreferences (mol)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 12
    2327#define ACTIONNAME AllAtomsOfMolecule
    2428#define TOKEN "select-molecules-atoms"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "select all atoms of a molecule"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/AllMoleculesAction.cpp

    rb295ca r41e15b  
    7272  return true;
    7373}
    74 
    75 const string SelectionAllMoleculesAction::getName() {
    76   return NAME;
    77 }
    7874/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AllMoleculesAction.def

    rb295ca r41e15b  
    1010// i.e. there is an integer with variable name Z that can be found in
    1111// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    12 // "undefine" if no parameters are required
     12// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1313#undef paramtypes
    1414#undef paramtokens
     15#undef paramdescriptions
     16#undef paramdefaults
    1517#undef paramreferences
    1618
     
    2022// some defines for all the names, you may use ACTION, STATE and PARAMS
    2123#define CATEGORY Selection
     24#define MENUNAME "selection"
     25#define MENUPOSITION 4
    2226#define ACTIONNAME AllMolecules
    2327#define TOKEN "select-all-molecules"
    2428
     29
     30// finally the information stored in the ActionTrait specialization
     31#define DESCRIPTION "select all molecules"
     32#undef SHORTFORM
  • src/Actions/SelectionAction/AtomByElementAction.cpp

    rb295ca r41e15b  
    7474  return true;
    7575}
    76 
    77 const string SelectionAtomByElementAction::getName() {
    78   return NAME;
    79 }
    8076/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AtomByElementAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#define paramtypes (const element*)
    15 #define paramtokens (SelectionAtomByElementAction::NAME)
     15#define paramtokens ("select-atom-by-element")
     16#define paramdescriptions ("element")
     17#undef paramdefaults
    1618#define paramreferences (elemental)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 5
    2327#define ACTIONNAME AtomByElement
    2428#define TOKEN "select-atom-by-element"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "select an atom by element"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/AtomByIdAction.cpp

    rb295ca r41e15b  
    7474  return true;
    7575}
    76 
    77 const string SelectionAtomByIdAction::getName() {
    78   return NAME;
    79 }
    8076/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AtomByIdAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (atom*)
    15 #define paramtokens (SelectionAtomByIdAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (const atom*)
     15#define paramtokens ("select-atom-by-id")
     16#define paramdescriptions ("atom index")
     17#undef paramdefaults
    1618#define paramreferences (Walker)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 6
    2327#define ACTIONNAME AtomById
    2428#define TOKEN "select-atom-by-id"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "select an atom by index"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/ClearAllAtomsAction.cpp

    rb295ca r41e15b  
    7272  return true;
    7373}
    74 
    75 const string SelectionClearAllAtomsAction::getName() {
    76   return NAME;
    77 }
    7874/** =========== end of function ====================== */
  • src/Actions/SelectionAction/ClearAllAtomsAction.def

    rb295ca r41e15b  
    1010// i.e. there is an integer with variable name Z that can be found in
    1111// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    12 // "undefine" if no parameters are required
     12// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1313#undef paramtypes
    1414#undef paramtokens
     15#undef paramdescriptions
     16#undef paramdefaults
    1517#undef paramreferences
    1618
     
    2022// some defines for all the names, you may use ACTION, STATE and PARAMS
    2123#define CATEGORY Selection
     24#define MENUNAME "selection"
     25#define MENUPOSITION 1
    2226#define ACTIONNAME ClearAllAtoms
    2327#define TOKEN "clear-atom-selection"
    2428
     29
     30// finally the information stored in the ActionTrait specialization
     31#define DESCRIPTION "clear the atom selection"
     32#undef SHORTFORM
  • src/Actions/SelectionAction/ClearAllMoleculesAction.cpp

    rb295ca r41e15b  
    7272  return true;
    7373}
    74 
    75 const string SelectionClearAllMoleculesAction::getName() {
    76   return NAME;
    77 }
    7874/** =========== end of function ====================== */
  • src/Actions/SelectionAction/ClearAllMoleculesAction.def

    rb295ca r41e15b  
    1010// i.e. there is an integer with variable name Z that can be found in
    1111// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    12 // "undefine" if no parameters are required
     12// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1313#undef paramtypes
    1414#undef paramtokens
     15#undef paramdescriptions
     16#undef paramdefaults
    1517#undef paramreferences
    1618
     
    2022// some defines for all the names, you may use ACTION, STATE and PARAMS
    2123#define CATEGORY Selection
     24#define MENUNAME "selection"
     25#define MENUPOSITION 2
    2226#define ACTIONNAME ClearAllMolecules
    2327#define TOKEN "clear-molecule-selection"
    2428
     29
     30// finally the information stored in the ActionTrait specialization
     31#define DESCRIPTION "clear the molecule selection"
     32#undef SHORTFORM
  • src/Actions/SelectionAction/MoleculeByFormulaAction.cpp

    rb295ca r41e15b  
    7777  return true;
    7878}
    79 
    80 const string SelectionMoleculeByFormulaAction::getName() {
    81   return NAME;
    82 }
    8379/** =========== end of function ====================== */
  • src/Actions/SelectionAction/MoleculeByFormulaAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#define paramtypes (std::string)
    15 #define paramtokens (SelectionMoleculeByFormulaAction::NAME)
     15#define paramtokens ("select-molecule-by-formula")
     16#define paramdescriptions ("chemical formula")
     17#undef paramdefaults
    1618#define paramreferences (formula)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 10
    2327#define ACTIONNAME MoleculeByFormula
    2428#define TOKEN "select-molecule-by-formula"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "select a molecule by chemical formula"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/MoleculeByIdAction.cpp

    rb295ca r41e15b  
    7474  return true;
    7575}
    76 
    77 const string SelectionMoleculeByIdAction::getName() {
    78   return NAME;
    79 }
    8076/** =========== end of function ====================== */
  • src/Actions/SelectionAction/MoleculeByIdAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (molecule*)
    15 #define paramtokens (SelectionMoleculeByIdAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (const molecule*)
     15#define paramtokens ("select-molecule-by-id")
     16#define paramdescriptions ("molecule index")
     17#undef paramdefaults
    1618#define paramreferences (mol)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 9
    2327#define ACTIONNAME MoleculeById
    2428#define TOKEN "select-molecule-by-id"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "select a molecule by index"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/MoleculeOfAtomAction.cpp

    rb295ca r41e15b  
    7272  return true;
    7373}
    74 
    75 const string SelectionMoleculeOfAtomAction::getName() {
    76   return NAME;
    77 }
    7874/** =========== end of function ====================== */
  • src/Actions/SelectionAction/MoleculeOfAtomAction.def

    rb295ca r41e15b  
    1010// i.e. there is an integer with variable name Z that can be found in
    1111// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    12 // "undefine" if no parameters are required
    13 #define paramtypes (atom*)
    14 #define paramtokens (SelectionMoleculeOfAtomAction::NAME)
     12// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     13#define paramtypes (const atom*)
     14#define paramtokens ("select-molecule-of-atom")
     15#define paramdescriptions ("one atom of desired molecule")
     16#undef paramdefaults
    1517#define paramreferences (Walker)
    1618
     
    2022// some defines for all the names, you may use ACTION, STATE and PARAMS
    2123#define CATEGORY Selection
     24#define MENUNAME "selection"
     25#define MENUPOSITION 11
    2226#define ACTIONNAME MoleculeOfAtom
    2327#define TOKEN "select-molecule-of-atom"
    2428
     29
     30// finally the information stored in the ActionTrait specialization
     31#define DESCRIPTION "select a molecule to which a given atom belongs"
     32#undef SHORTFORM
  • src/Actions/SelectionAction/NotAllAtomsAction.cpp

    rb295ca r41e15b  
    7272  return true;
    7373}
    74 
    75 const string SelectionNotAllAtomsAction::getName() {
    76   return NAME;
    77 }
    7874/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAllAtomsAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#undef paramtypes
    1515#undef paramtokens
     16#undef paramdescriptions
     17#undef paramdefaults
    1618#undef paramreferences
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 13
    2327#define ACTIONNAME NotAllAtoms
    2428#define TOKEN "unselect-all-atoms"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "unselect all atoms"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.cpp

    rb295ca r41e15b  
    8686  return true;
    8787}
    88 
    89 const string SelectionNotAllAtomsInsideCuboidAction::getName() {
    90   return NAME;
    91 }
    9288/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.def

    rb295ca r41e15b  
    77
    88// all includes and forward declarations necessary for non-integral types below
     9#include "Actions/Values.hpp"
     10
    911class Vector;
    1012
    1113// i.e. there is an integer with variable name Z that can be found in
    1214// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (Vector) (Vector) (double) (double) (double)
    15 #define paramtokens (SelectionNotAllAtomsInsideCuboidAction::NAME) ("position") ("angle-x") ("angle-y") ("angle-z")
    16 #define paramreferences (extension) (position) (Xangle) (Yangle) (Zangle)
     15// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     16#define paramtypes (Vector)(Vector)(double)(double)(double)
     17#define paramtokens ("unselect-atoms-inside-cuboid")("position")("angle-x")("angle-y")("angle-z")
     18#define paramdescriptions ("dimension of cuboid")("position in R^3 space")("angle of a rotation around x axis")("angle of a rotation around y axis")("angle of a rotation around z axis")
     19#undef paramdefaults
     20#define paramreferences (extension)(position)(Xangle)(Yangle)(Zangle)
    1721
    1822#define statetypes (std::vector<atom*>)
     
    2125// some defines for all the names, you may use ACTION, STATE and PARAMS
    2226#define CATEGORY Selection
     27#define MENUNAME "selection"
     28#define MENUPOSITION 17
    2329#define ACTIONNAME NotAllAtomsInsideCuboid
    2430#define TOKEN "unselect-atoms-inside-cuboid"
    2531
     32
     33// finally the information stored in the ActionTrait specialization
     34#define DESCRIPTION "unselect all atoms inside a cuboid"
     35#undef SHORTFORM
  • src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.cpp

    rb295ca r41e15b  
    8080  return true;
    8181}
    82 
    83 const string SelectionNotAllAtomsInsideSphereAction::getName() {
    84   return NAME;
    85 }
    8682/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (double) (Vector)
    15 #define paramtokens (SelectionNotAllAtomsInsideSphereAction::NAME) ("position")
    16 #define paramreferences (radius) (position)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (double)(Vector)
     15#define paramtokens ("unselect-atoms-inside-sphere")("position")
     16#define paramdescriptions ("radius of sphere")("position in R^3 space")
     17#undef paramdefaults
     18#define paramreferences (radius)(position)
    1719
    1820#define statetypes (std::vector<atom*>)
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 18
    2327#define ACTIONNAME NotAllAtomsInsideSphere
    2428#define TOKEN "unselect-atoms-inside-sphere"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "unselect all atoms inside a sphere"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.cpp

    rb295ca r41e15b  
    7474  return true;
    7575}
    76 
    77 const string SelectionNotAllAtomsOfMoleculeAction::getName() {
    78   return NAME;
    79 }
    8076/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (molecule*)
    15 #define paramtokens (SelectionNotAllAtomsOfMoleculeAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (const molecule*)
     15#define paramtokens ("unselect-molecules-atoms")
     16#define paramdescriptions ("molecule")
     17#undef paramdefaults
    1618#define paramreferences (mol)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 22
    2327#define ACTIONNAME NotAllAtomsOfMolecule
    2428#define TOKEN "unselect-molecules-atoms"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "unselect all atoms of a molecule"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/NotAllMoleculesAction.cpp

    rb295ca r41e15b  
    7272  return true;
    7373}
    74 
    75 const string SelectionNotAllMoleculesAction::getName() {
    76   return NAME;
    77 }
    7874/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAllMoleculesAction.def

    rb295ca r41e15b  
    1010// i.e. there is an integer with variable name Z that can be found in
    1111// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    12 // "undefine" if no parameters are required
     12// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1313#undef paramtypes
    1414#undef paramtokens
     15#undef paramdescriptions
     16#undef paramdefaults
    1517#undef paramreferences
    1618
     
    2022// some defines for all the names, you may use ACTION, STATE and PARAMS
    2123#define CATEGORY Selection
     24#define MENUNAME "selection"
     25#define MENUPOSITION 14
    2226#define ACTIONNAME NotAllMolecules
    2327#define TOKEN "unselect-all-molecules"
    2428
     29
     30// finally the information stored in the ActionTrait specialization
     31#define DESCRIPTION "unselect all molecules"
     32#undef SHORTFORM
  • src/Actions/SelectionAction/NotAtomByElementAction.cpp

    rb295ca r41e15b  
    7474  return true;
    7575}
    76 
    77 const string SelectionNotAtomByElementAction::getName() {
    78   return NAME;
    79 }
    8076/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAtomByElementAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#define paramtypes (const element*)
    15 #define paramtokens (SelectionNotAtomByElementAction::NAME)
     15#define paramtokens ("unselect-atom-by-element")
     16#define paramdescriptions ("element")
     17#undef paramdefaults
    1618#define paramreferences (elemental)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 15
    2327#define ACTIONNAME NotAtomByElement
    2428#define TOKEN "unselect-atom-by-element"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "unselect an atom by element"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/NotAtomByIdAction.cpp

    rb295ca r41e15b  
    7474  return true;
    7575}
    76 
    77 const string SelectionNotAtomByIdAction::getName() {
    78   return NAME;
    79 }
    8076/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAtomByIdAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (atom*)
    15 #define paramtokens (SelectionNotAtomByIdAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (const atom*)
     15#define paramtokens ("unselect-atom-by-id")
     16#define paramdescriptions ("atom index")
     17#undef paramdefaults
    1618#define paramreferences (Walker)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 16
    2327#define ACTIONNAME NotAtomById
    2428#define TOKEN "unselect-atom-by-id"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "unselect an atom by index"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/NotMoleculeByFormulaAction.cpp

    rb295ca r41e15b  
    7777  return true;
    7878}
    79 
    80 const string SelectionNotMoleculeByFormulaAction::getName() {
    81   return NAME;
    82 }
    8379/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotMoleculeByFormulaAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#define paramtypes (std::string)
    15 #define paramtokens (SelectionNotMoleculeByFormulaAction::NAME)
     15#define paramtokens ("unselect-molecule-by-formula")
     16#define paramdescriptions ("chemical formula")
     17#undef paramdefaults
    1618#define paramreferences (formula)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 19
    2327#define ACTIONNAME NotMoleculeByFormula
    2428#define TOKEN "unselect-molecule-by-formula"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "unselect a molecule by chemical formula"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/NotMoleculeByIdAction.cpp

    rb295ca r41e15b  
    7474  return true;
    7575}
    76 
    77 const string SelectionNotMoleculeByIdAction::getName() {
    78   return NAME;
    79 }
    8076/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotMoleculeByIdAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (molecule*)
    15 #define paramtokens (SelectionNotMoleculeByIdAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (const molecule*)
     15#define paramtokens ("unselect-molecule-by-id")
     16#define paramdescriptions ("molecule index")
     17#undef paramdefaults
    1618#define paramreferences (mol)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Selection
     25#define MENUNAME "selection"
     26#define MENUPOSITION 20
    2327#define ACTIONNAME NotMoleculeById
    2428#define TOKEN "unselect-molecule-by-id"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "unselect a molecule by index"
     33#undef SHORTFORM
  • src/Actions/SelectionAction/NotMoleculeOfAtomAction.cpp

    rb295ca r41e15b  
    7272  return true;
    7373}
    74 
    75 const string SelectionNotMoleculeOfAtomAction::getName() {
    76   return NAME;
    77 }
    7874/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotMoleculeOfAtomAction.def

    rb295ca r41e15b  
    1010// i.e. there is an integer with variable name Z that can be found in
    1111// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    12 // "undefine" if no parameters are required
    13 #define paramtypes (atom*)
    14 #define paramtokens (SelectionNotMoleculeOfAtomAction::NAME)
     12// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     13#define paramtypes (const atom*)
     14#define paramtokens ("unselect-molecule-of-atom")
     15#define paramdescriptions ("one atom of desired molecule")
     16#undef paramdefaults
    1517#define paramreferences (Walker)
    1618
     
    2022// some defines for all the names, you may use ACTION, STATE and PARAMS
    2123#define CATEGORY Selection
     24#define MENUNAME "selection"
     25#define MENUPOSITION 21
    2226#define ACTIONNAME NotMoleculeOfAtom
    2327#define TOKEN "unselect-molecule-of-atom"
    2428
     29
     30// finally the information stored in the ActionTrait specialization
     31#define DESCRIPTION "unselect a molecule to which a given atom belongs"
     32#undef SHORTFORM
  • src/Actions/TesselationAction/ConvexEnvelopeAction.cpp

    rb295ca r41e15b  
    5959    //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]);
    6060    // TODO: Beide Funktionen sollten streams anstelle des Filenamen benutzen, besser fuer unit tests
    61     FindNonConvexBorder(mol, TesselStruct, LCList, 50., params.filenameNonConvex.c_str());
     61    FindNonConvexBorder(mol, TesselStruct, LCList, 50., params.filenameNonConvex.string().c_str());
    6262    //RemoveAllBoundaryPoints(TesselStruct, mol, argv[argptr]);
    63     const double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, params.filenameConvex.c_str());
     63    const double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, params.filenameConvex.string().c_str());
    6464    const double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration);
    6565    DoLog(0) && (Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration->GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl);
     
    9595  return false;
    9696}
    97 
    98 const string TesselationConvexEnvelopeAction::getName() {
    99   return NAME;
    100 }
    10197/** =========== end of function ====================== */
  • src/Actions/TesselationAction/ConvexEnvelopeAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (std::string) (std::string)
    15 #define paramtokens ("convex-file") ("nonconvex-file")
    16 #define paramreferences (filenameConvex) (filenameNonConvex)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (boost::filesystem::path)(boost::filesystem::path)
     15#define paramtokens ("convex-file")("nonconvex-file")
     16#define paramdescriptions ("filename of the convex envelope")("filename of the non-convex envelope")
     17#undef paramdefaults
     18#define paramreferences (filenameConvex)(filenameNonConvex)
    1719
    1820#undef statetypes
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Tesselation
     25#define MENUNAME "tesselation"
     26#define MENUPOSITION 1
    2327#define ACTIONNAME ConvexEnvelope
    2428#define TOKEN "convex-envelope"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "create the convex envelope for a molecule"
     33#define SHORTFORM "x"
  • src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp

    rb295ca r41e15b  
    5656    start = clock();
    5757    LCList = new LinkedCell(*Boundary, params.SphereRadius*2.);
    58     Success = FindNonConvexBorder(Boundary, T, LCList, params.SphereRadius, params.filename.c_str());
     58    Success = FindNonConvexBorder(Boundary, T, LCList, params.SphereRadius, params.filename.string().c_str());
    5959    //FindDistributionOfEllipsoids(T, &LCList, N, number, params.filename.c_str());
    6060    end = clock();
     
    9090  return false;
    9191}
    92 
    93 const string TesselationNonConvexEnvelopeAction::getName() {
    94   return NAME;
    95 }
    9692/** =========== end of function ====================== */
  • src/Actions/TesselationAction/NonConvexEnvelopeAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (double) (std::string)
    15 #define paramtokens (TesselationNonConvexEnvelopeAction::NAME) ("nonconvex-file")
    16 #define paramreferences (SphereRadius) (filename)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (double)(boost::filesystem::path)
     15#define paramtokens ("nonconvex-envelope")("nonconvex-file")
     16#define paramdescriptions ("radius of the rolling sphere")("filename of the non-convex envelope")
     17#undef paramdefaults
     18#define paramreferences (SphereRadius)(filename)
    1719
    1820#undef statetypes
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY Tesselation
     25#define MENUNAME "tesselation"
     26#define MENUPOSITION 2
    2327#define ACTIONNAME NonConvexEnvelope
    2428#define TOKEN "nonconvex-envelope"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "create the non-convex envelope for a molecule"
     33#define SHORTFORM "N"
  • src/Actions/ValueStorage.cpp

    rb295ca r41e15b  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "ValueStorage.hpp"
    2322#include "Patterns/Singleton_impl.hpp"
    2423
     24#include "Actions/OptionTrait.hpp"
     25#include "Actions/OptionRegistry.hpp"
     26#include "Actions/Values.hpp"
     27#include "Actions/ValueStorage.hpp"
     28#include "Descriptors/AtomIdDescriptor.hpp"
     29#include "Descriptors/MoleculeIdDescriptor.hpp"
     30#include "Helpers/Log.hpp"
     31#include "Helpers/Verbose.hpp"
     32#include "LinearAlgebra/BoxVector.hpp"
     33#include "LinearAlgebra/Matrix.hpp"
     34#include "LinearAlgebra/Vector.hpp"
     35#include "atom.hpp"
     36#include "Box.hpp"
     37#include "element.hpp"
     38#include "molecule.hpp"
     39#include "periodentafel.hpp"
     40#include "World.hpp"
     41
    2542ValueStorage::ValueStorage() :
    26   MapOfActions_instance(MapOfActions::getInstance())
     43OptionRegistry_instance(OptionRegistry::getInstance())
    2744{};
    2845
    2946ValueStorage::~ValueStorage() {};
    3047
    31 std::string ValueStorage::getDescription(std::string actionname) {
    32   return MapOfActions::getInstance().getDescription(actionname);
     48
     49bool ValueStorage::isCurrentValuePresent(const char *name) const
     50{
     51  return (CurrentValueMap.find(name) != CurrentValueMap.end());
     52}
     53
     54void ValueStorage::queryCurrentValue(const char * name, const atom * &_T)
     55{
     56  int atomID = -1;
     57  if (typeid( atom *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     58    if (CurrentValueMap.find(name) == CurrentValueMap.end())
     59      throw MissingValueException(__FILE__, __LINE__);
     60    atomID = lexical_cast<int>(CurrentValueMap[name].c_str());
     61    CurrentValueMap.erase(name);
     62  } else if (typeid( const atom *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     63    if (CurrentValueMap.find(name) == CurrentValueMap.end())
     64      throw MissingValueException(__FILE__, __LINE__);
     65    atomID = lexical_cast<int>(CurrentValueMap[name].c_str());
     66    CurrentValueMap.erase(name);
     67  } else
     68    throw IllegalTypeException(__FILE__,__LINE__);
     69  _T = World::getInstance().getAtom(AtomById(atomID));
     70}
     71
     72void ValueStorage::queryCurrentValue(const char * name, const element * &_T)  {
     73  int Z = -1;
     74  if (typeid(const element *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     75    if (CurrentValueMap.find(name) == CurrentValueMap.end())
     76      throw MissingValueException(__FILE__, __LINE__);
     77    Z = lexical_cast<int>(CurrentValueMap[name].c_str());
     78    CurrentValueMap.erase(name);
     79  } else
     80    throw IllegalTypeException(__FILE__,__LINE__);
     81  _T = World::getInstance().getPeriode()->FindElement(Z);
     82}
     83
     84void ValueStorage::queryCurrentValue(const char * name, const molecule * &_T) {
     85  int molID = -1;
     86  if (typeid( const molecule *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     87    if (CurrentValueMap.find(name) == CurrentValueMap.end())
     88      throw MissingValueException(__FILE__, __LINE__);
     89    molID = lexical_cast<int>(CurrentValueMap[name].c_str());
     90    CurrentValueMap.erase(name);
     91  } else
     92    throw IllegalTypeException(__FILE__,__LINE__);
     93  _T = World::getInstance().getMolecule(MoleculeById(molID));
     94}
     95
     96void ValueStorage::queryCurrentValue(const char * name, class Box &_T) {
     97  Matrix M;
     98  double tmp;
     99  if (typeid( Box ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     100    if (CurrentValueMap.find(name) == CurrentValueMap.end())
     101      throw MissingValueException(__FILE__, __LINE__);
     102    std::istringstream stream(CurrentValueMap[name]);
     103    stream >> tmp;
     104    M.set(0,0,tmp);
     105    stream >> tmp;
     106    M.set(0,1,tmp);
     107    M.set(1,0,tmp);
     108    stream >> tmp;
     109    M.set(0,2,tmp);
     110    M.set(2,0,tmp);
     111    stream >> tmp;
     112    M.set(1,1,tmp);
     113    stream >> tmp;
     114    M.set(1,2,tmp);
     115    M.set(2,1,tmp);
     116    stream >> tmp;
     117    M.set(2,2,tmp);
     118    _T = M;
     119    CurrentValueMap.erase(name);
     120  } else
     121    throw IllegalTypeException(__FILE__,__LINE__);
     122}
     123
     124void ValueStorage::queryCurrentValue(const char * name, class Vector &_T) {
     125  if (typeid( Vector ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     126    std::istringstream stream(CurrentValueMap[name]);
     127    CurrentValueMap.erase(name);
     128    stream >> _T[0];
     129    stream >> _T[1];
     130    stream >> _T[2];
     131  } else
     132    throw IllegalTypeException(__FILE__,__LINE__);
     133}
     134
     135void ValueStorage::queryCurrentValue(const char * name, class BoxVector &_T) {
     136  if (typeid( BoxVector ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     137    std::istringstream stream(CurrentValueMap[name]);
     138    CurrentValueMap.erase(name);
     139    stream >> _T[0];
     140    stream >> _T[1];
     141    stream >> _T[2];
     142  } else
     143    throw IllegalTypeException(__FILE__,__LINE__);
     144}
     145
     146void ValueStorage::queryCurrentValue(const char * name, std::vector<const atom *>&_T)
     147{
     148  int atomID = -1;
     149  atom *Walker = NULL;
     150  if (typeid( std::vector<const atom *> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     151    if (CurrentValueMap.find(name) == CurrentValueMap.end())
     152      throw MissingValueException(__FILE__, __LINE__);
     153    std::istringstream stream(CurrentValueMap[name]);
     154    CurrentValueMap.erase(name);
     155    while (!stream.fail()) {
     156      stream >> atomID >> ws;
     157      Walker = World::getInstance().getAtom(AtomById(atomID));
     158      if (Walker != NULL)
     159        _T.push_back(Walker);
     160      atomID = -1;
     161      Walker = NULL;
     162    }
     163  } else
     164    throw IllegalTypeException(__FILE__,__LINE__);
     165}
     166
     167void ValueStorage::queryCurrentValue(const char * name, std::vector<const element *>&_T)
     168{
     169  int Z = -1;
     170  const element *elemental = NULL;
     171  if (typeid( std::vector<const element *> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     172    if (CurrentValueMap.find(name) == CurrentValueMap.end())
     173      throw MissingValueException(__FILE__, __LINE__);
     174    std::istringstream stream(CurrentValueMap[name]);
     175    CurrentValueMap.erase(name);
     176    while (!stream.fail()) {
     177      stream >> Z >> ws;
     178      elemental = World::getInstance().getPeriode()->FindElement(Z);
     179      if (elemental != NULL)
     180        _T.push_back(elemental);
     181      Z = -1;
     182    }
     183  } else
     184    throw IllegalTypeException(__FILE__,__LINE__);
     185}
     186
     187void ValueStorage::queryCurrentValue(const char * name, std::vector<const molecule *>&_T)
     188{
     189  int molID = -1;
     190  molecule *mol = NULL;
     191  if (typeid( std::vector<const molecule *> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     192    if (CurrentValueMap.find(name) == CurrentValueMap.end())
     193      throw MissingValueException(__FILE__, __LINE__);
     194    std::istringstream stream(CurrentValueMap[name]);
     195    CurrentValueMap.erase(name);
     196    while (!stream.fail()) {
     197      stream >> molID >> ws;
     198      mol = World::getInstance().getMolecule(MoleculeById(molID));
     199      if (mol != NULL)
     200        _T.push_back(mol);
     201      molID = -1;
     202      mol = NULL;
     203    }
     204  } else
     205    throw IllegalTypeException(__FILE__,__LINE__);
     206}
     207
     208void ValueStorage::queryCurrentValue(const char * name, boost::filesystem::path&_T)
     209{
     210  std::string tmp;
     211  if (typeid( boost::filesystem::path ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     212    if (CurrentValueMap.find(name) == CurrentValueMap.end())
     213      throw MissingValueException(__FILE__, __LINE__);
     214    std::istringstream stream(CurrentValueMap[name]);
     215    CurrentValueMap.erase(name);
     216    if (!stream.fail()) {
     217      stream >> tmp >> ws;
     218      _T = tmp;
     219    }
     220  } else
     221    throw IllegalTypeException(__FILE__,__LINE__);
     222}
     223
     224void ValueStorage::setCurrentValue(const char * name, const atom * &_T)
     225{
     226  if (typeid( const atom *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     227    std::ostringstream stream;
     228    stream << _T->getId();
     229    CurrentValueMap[name] = stream.str();
     230  } else
     231    throw IllegalTypeException(__FILE__,__LINE__);
     232}
     233
     234void ValueStorage::setCurrentValue(const char * name, const element * &_T)
     235{
     236  if (typeid( const element *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     237    std::ostringstream stream;
     238    stream << _T->getAtomicNumber();
     239    CurrentValueMap[name] = stream.str();
     240  } else
     241    throw IllegalTypeException(__FILE__,__LINE__);
     242}
     243
     244void ValueStorage::setCurrentValue(const char * name, const molecule * &_T)
     245{
     246  if (typeid( const molecule *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     247    std::ostringstream stream;
     248    stream << _T->getId();
     249    CurrentValueMap[name] = stream.str();
     250  } else
     251    throw IllegalTypeException(__FILE__,__LINE__);
     252}
     253
     254void ValueStorage::setCurrentValue(const char * name, class Box &_T)
     255{
     256  const Matrix &M = _T.getM();
     257  if (typeid( Box ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     258    std::ostringstream stream;
     259    stream << M.at(0,0) << " ";
     260    stream << M.at(0,1) << " ";
     261    stream << M.at(0,2) << " ";
     262    stream << M.at(1,1) << " ";
     263    stream << M.at(1,2) << " ";
     264    stream << M.at(2,2) << " ";
     265    CurrentValueMap[name] = stream.str();
     266  } else
     267    throw IllegalTypeException(__FILE__,__LINE__);
     268}
     269
     270void ValueStorage::setCurrentValue(const char * name, class Vector &_T)
     271{
     272  if (typeid( Vector ) == *(OptionRegistry_instance.getOptionByName(name)->getType())){
     273    std::ostringstream stream;
     274    stream << _T[0] << " ";
     275    stream << _T[1] << " ";
     276    stream << _T[2] << " ";
     277    CurrentValueMap[name] = stream.str();
     278  } else  if (typeid( BoxVector ) == *(OptionRegistry_instance.getOptionByName(name)->getType())){
     279    std::ostringstream stream;
     280    stream << _T[0] << " ";
     281    stream << _T[1] << " ";
     282    stream << _T[2] << " ";
     283    CurrentValueMap[name] = stream.str();
     284  } else
     285    throw IllegalTypeException(__FILE__,__LINE__);
     286}
     287
     288void ValueStorage::setCurrentValue(const char * name, std::vector<const atom *>&_T)
     289{
     290  if (typeid( std::vector<const atom *> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     291    std::ostringstream stream;
     292    for (std::vector<const atom *>::const_iterator iter = _T.begin(); iter != _T.end(); ++iter) {
     293      stream << (*iter)->getId() << " ";
     294    }
     295    CurrentValueMap[name] = stream.str();
     296  } else
     297    throw IllegalTypeException(__FILE__,__LINE__);
     298}
     299
     300void ValueStorage::setCurrentValue(const char * name, std::vector<const element *>&_T)
     301{
     302  if (typeid( std::vector<const element *> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     303    std::ostringstream stream;
     304    for (std::vector<const element *>::const_iterator iter = _T.begin(); iter != _T.end(); ++iter) {
     305      stream << (*iter)->getAtomicNumber() << " ";
     306    }
     307    CurrentValueMap[name] = stream.str();
     308  } else
     309    throw IllegalTypeException(__FILE__,__LINE__);
     310}
     311
     312void ValueStorage::setCurrentValue(const char * name, std::vector<const molecule *>&_T)
     313{
     314  if (typeid( std::vector<const molecule *> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     315    std::ostringstream stream;
     316    for (std::vector<const molecule *>::const_iterator iter = _T.begin(); iter != _T.end(); ++iter) {
     317      stream << (*iter)->getId() << " ";
     318    }
     319    CurrentValueMap[name] = stream.str();
     320  } else
     321    throw IllegalTypeException(__FILE__,__LINE__);
     322}
     323
     324void ValueStorage::setCurrentValue(const char * name, boost::filesystem::path &_T)
     325{
     326  if (typeid( boost::filesystem::path ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {
     327    std::ostringstream stream;
     328    stream << _T.string();
     329    CurrentValueMap[name] = stream.str();
     330  } else
     331    throw IllegalTypeException(__FILE__,__LINE__);
     332}
     333
     334const std::string ValueStorage::getCurrentValue(std::string actionname) {
     335  return CurrentValueMap[actionname];
    33336}
    34337
  • src/Actions/ValueStorage.hpp

    rb295ca r41e15b  
    99#define VALUESTORAGE_HPP_
    1010
    11 #include "Actions/MapOfActions.hpp"
     11#include <boost/filesystem.hpp>
     12#include <boost/lexical_cast.hpp>
     13#include <boost/program_options.hpp>
     14
     15#include <map>
     16#include <set>
     17#include <vector>
     18#include <typeinfo>
     19
     20#include "Actions/OptionTrait.hpp"
     21#include "Actions/OptionRegistry.hpp"
     22#include "Exceptions/IllegalTypeException.hpp"
     23#include "Exceptions/MissingValueException.hpp"
     24#include "Helpers/Assert.hpp"
     25#include "Patterns/Singleton.hpp"
     26
     27class MapOfActionsTest;
     28
     29class Box;
     30class atom;
     31class element;
     32class molecule;
     33class Vector;
     34
     35namespace po = boost::program_options;
     36
     37using boost::lexical_cast;
     38
    1239#include "Patterns/Singleton.hpp"
    1340
     
    2148
    2249public:
     50
     51  bool isCurrentValuePresent(const char *name) const;
     52  void queryCurrentValue(const char * name, const atom * &_T);
     53  void queryCurrentValue(const char * name, const element * &_T);
     54  void queryCurrentValue(const char * name, const molecule * &_T);
     55  void queryCurrentValue(const char * name, class Box &_T);
     56  void queryCurrentValue(const char * name, class Vector &_T);
     57  void queryCurrentValue(const char * name, class BoxVector &_T);
     58  void queryCurrentValue(const char * name, std::vector<const atom *>&_T);
     59  void queryCurrentValue(const char * name, std::vector<const element *>&_T);
     60  void queryCurrentValue(const char * name, std::vector<const molecule *>&_T);
     61  void queryCurrentValue(const char * name, boost::filesystem::path&_T);
     62
    2363  /** Gets a value from the storage
    2464   * If the value is not present, an ASSERT is thrown unless optional is set to true.
     
    2767   * \return true - value present, false - value not present (only given when optional set to true)
    2868   */
    29   template <typename T> bool queryCurrentValue(const char *name, T &_T, const bool optional = false) {
    30     if (optional) {
    31       if (!MapOfActions_instance.isCurrentValuePresent(name))
    32         return false;
    33     }
    34     MapOfActions_instance.queryCurrentValue(name, _T);
    35     return true;
     69  template<typename T> void queryCurrentValue(const char * name, T &_T)
     70  {
     71    if (typeid( T ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { // constructor of type_info is private, hence can only store by ref or ptr
     72      if (CurrentValueMap.find(name) == CurrentValueMap.end())
     73        throw MissingValueException(__FILE__, __LINE__);
     74      _T = lexical_cast<T>(CurrentValueMap[name].c_str());
     75      CurrentValueMap.erase(name);
     76    } else
     77      throw IllegalTypeException(__FILE__,__LINE__);
    3678  }
     79  template<typename T> void queryCurrentValue(const char * name, std::vector<T> &_T)
     80  {
     81    T temp;
     82    if (typeid( std::vector<T> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { // constructor of type_info is private, hence can only store by ref or ptr
     83      if (CurrentValueMap.find(name) == CurrentValueMap.end())
     84        throw MissingValueException(__FILE__, __LINE__);
     85      std::istringstream stream(CurrentValueMap[name]);
     86      CurrentValueMap.erase(name);
     87      while (!stream.fail()) {
     88        stream >> temp >> std::ws;
     89        _T.push_back(temp);
     90      }
     91    } else
     92      throw IllegalTypeException(__FILE__,__LINE__);
     93  }
     94
     95  void setCurrentValue(const char * name, const atom * &_T);
     96  void setCurrentValue(const char * name, const element * &_T);
     97  void setCurrentValue(const char * name, const molecule * &_T);
     98  void setCurrentValue(const char * name, class Box &_T);
     99  void setCurrentValue(const char * name, class Vector &_T);
     100  void setCurrentValue(const char * name, std::vector<const atom *>&_T);
     101  void setCurrentValue(const char * name, std::vector<const element *>&_T);
     102  void setCurrentValue(const char * name, std::vector<const molecule *>&_T);
     103  void setCurrentValue(const char * name, boost::filesystem::path&_T);
    37104
    38105  /** Sets a value in the storage.
     
    40107   * \param _T value
    41108   */
    42   template <typename T> void setCurrentValue(const char *name, T &_T) {
    43     MapOfActions_instance.setCurrentValue(name, _T);
     109  template<class T> void setCurrentValue(const char * name, T &_T)
     110  {
     111    std::ostringstream stream;
     112    if (typeid( T ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {  // constructor of type_info is private, hence can only store by ref or ptr
     113      stream << _T;
     114      CurrentValueMap[name] = stream.str();
     115    } else
     116      throw IllegalTypeException(__FILE__,__LINE__);
     117  }
     118  /** Sets a value in the storage.
     119   * \param name key of value
     120   * \param _T value
     121   */
     122  template<class T> void setCurrentValue(const char * name, std::vector<T> &_T)
     123  {
     124    std::ostringstream stream;
     125    if (typeid( std::vector<T> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) {  // constructor of type_info is private, hence can only store by ref or ptr
     126      std::ostringstream stream;
     127      for (typename std::vector<T>::const_iterator iter = _T.begin(); iter != _T.end(); ++iter) {
     128        stream << (*iter) << " ";
     129      }
     130      CurrentValueMap[name] = stream.str();
     131    } else
     132      throw IllegalTypeException(__FILE__,__LINE__);
    44133  }
    45134
    46   /** Obtain a descriptive text for a given key.
    47    * \param actionname key
    48    * \return text describing the key's contents
    49    */
    50   std::string getDescription(std::string actionname);
     135  const std::string getCurrentValue(std::string actionname);
    51136
    52137protected:
     
    54139  ~ValueStorage();
    55140
    56   MapOfActions &MapOfActions_instance;
     141  std::map<std::string, std::string> CurrentValueMap;
     142
     143  OptionRegistry &OptionRegistry_instance;
    57144};
    58145
  • src/Actions/WorldAction/AddEmptyBoundaryAction.cpp

    rb295ca r41e15b  
    9898  return false;
    9999}
    100 
    101 const string WorldAddEmptyBoundaryAction::getName() {
    102   return NAME;
    103 }
    104100/** =========== end of function ====================== */
  • src/Actions/WorldAction/AddEmptyBoundaryAction.def

    rb295ca r41e15b  
    77
    88// all includes and forward declarations necessary for non-integral types below
     9#include "Actions/Values.hpp"
    910#include "LinearAlgebra/Vector.hpp"
    1011
    1112// i.e. there is an integer with variable name Z that can be found in
    1213// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     14// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1415#define paramtypes (Vector)
    15 #define paramtokens (WorldAddEmptyBoundaryAction::NAME)
     16#define paramtokens ("boundary")
     17#define paramdescriptions ("desired minimum distance to boundary for each axis over all atoms")
     18#undef paramdefaults
    1619#define paramreferences (boundary)
    1720
     
    2124// some defines for all the names, you may use ACTION, STATE and PARAMS
    2225#define CATEGORY World
     26#define MENUNAME "world"
     27#define MENUPOSITION 1
    2328#define ACTIONNAME AddEmptyBoundary
    2429#define TOKEN "boundary"
    2530
     31
     32// finally the information stored in the ActionTrait specialization
     33#define DESCRIPTION "change box to add an empty boundary around all atoms"
     34#define SHORTFORM "c"
  • src/Actions/WorldAction/BoundInBoxAction.cpp

    rb295ca r41e15b  
    6969  return false;
    7070}
    71 
    72 const string WorldBoundInBoxAction::getName() {
    73   return NAME;
    74 }
    7571/** =========== end of function ====================== */
  • src/Actions/WorldAction/BoundInBoxAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#undef paramtypes
    1515#undef paramtokens
     16#undef paramdescriptions
     17#undef paramdefaults
    1618#undef paramreferences
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY World
     25#define MENUNAME "world"
     26#define MENUPOSITION 2
    2327#define ACTIONNAME BoundInBox
    2428#define TOKEN "bound-in-box"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "bound all atoms in the domain"
     33#undef SHORTFORM
  • src/Actions/WorldAction/CenterInBoxAction.cpp

    rb295ca r41e15b  
    7171  return false;
    7272}
    73 
    74 const string WorldCenterInBoxAction::getName() {
    75   return NAME;
    76 }
    7773/** =========== end of function ====================== */
  • src/Actions/WorldAction/CenterInBoxAction.def

    rb295ca r41e15b  
    77
    88// all includes and forward declarations necessary for non-integral types below
     9#include "Actions/Values.hpp"
    910#include "Box.hpp"
    1011
    1112// i.e. there is an integer with variable name Z that can be found in
    1213// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     14// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1415#define paramtypes (Box)
    15 #define paramtokens (WorldCenterInBoxAction::NAME)
     16#define paramtokens ("center-in-box")
     17#define paramdescriptions ("symmetric matrix of new domain")
     18#undef paramdefaults
    1619#define paramreferences (cell_size)
    1720
     
    2124// some defines for all the names, you may use ACTION, STATE and PARAMS
    2225#define CATEGORY World
     26#define MENUNAME "world"
     27#define MENUPOSITION 3
    2328#define ACTIONNAME CenterInBox
    2429#define TOKEN "center-in-box"
    2530
     31
     32// finally the information stored in the ActionTrait specialization
     33#define DESCRIPTION "center all atoms in the domain"
     34#define SHORTFORM "b"
  • src/Actions/WorldAction/CenterOnEdgeAction.cpp

    rb295ca r41e15b  
    9494  return false;
    9595}
    96 
    97 const string WorldCenterOnEdgeAction::getName() {
    98   return NAME;
    99 }
    10096/** =========== end of function ====================== */
  • src/Actions/WorldAction/CenterOnEdgeAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#undef paramtypes
    1515#undef paramtokens
     16#undef paramdescriptions
     17#undef paramdefaults
    1618#undef paramreferences
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY World
     25#define MENUNAME "world"
     26#define MENUPOSITION 4
    2327#define ACTIONNAME CenterOnEdge
    2428#define TOKEN "center-edge"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "center edge of all atoms on (0,0,0)"
     33#define SHORTFORM "O"
  • src/Actions/WorldAction/ChangeBoxAction.cpp

    rb295ca r41e15b  
    6868  return false;
    6969}
    70 
    71 const string WorldChangeBoxAction::getName() {
    72   return NAME;
    73 }
    7470/** =========== end of function ====================== */
  • src/Actions/WorldAction/ChangeBoxAction.def

    rb295ca r41e15b  
    77
    88// all includes and forward declarations necessary for non-integral types below
     9#include "Actions/Values.hpp"
    910#include "Box.hpp"
    1011
    1112// i.e. there is an integer with variable name Z that can be found in
    1213// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     14// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1415#define paramtypes (Box)
    15 #define paramtokens (WorldChangeBoxAction::NAME)
     16#define paramtokens ("change-box")
     17#define paramdescriptions ("symmetrc matrix of the new simulation domain")
     18#undef paramdefaults
    1619#define paramreferences (cell_size)
    1720
     
    2124// some defines for all the names, you may use ACTION, STATE and PARAMS
    2225#define CATEGORY World
     26#define MENUNAME "world"
     27#define MENUPOSITION 5
    2328#define ACTIONNAME ChangeBox
    2429#define TOKEN "change-box"
    2530
     31
     32// finally the information stored in the ActionTrait specialization
     33#define DESCRIPTION "change the symmetrc matrix of the simulation domain"
     34#define SHORTFORM "B"
  • src/Actions/WorldAction/InputAction.cpp

    rb295ca r41e15b  
    104104  return false;
    105105}
    106 
    107 const string WorldInputAction::getName() {
    108   return NAME;
    109 }
    110106/** =========== end of function ====================== */
  • src/Actions/WorldAction/InputAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#define paramtypes (boost::filesystem::path)
    15 #define paramtokens (WorldInputAction::NAME)
     15#define paramtokens ("input")
     16#define paramdescriptions ("name of input files")
     17#undef paramdefaults
    1618#define paramreferences (filename)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY World
     25#define MENUNAME "world"
     26#define MENUPOSITION 6
    2327#define ACTIONNAME Input
    2428#define TOKEN "input"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "specify input files"
     33#define SHORTFORM "i"
  • src/Actions/WorldAction/OutputAction.cpp

    rb295ca r41e15b  
    6666  return false;
    6767}
    68 
    69 const string WorldOutputAction::getName() {
    70   return NAME;
    71 }
    7268/** =========== end of function ====================== */
  • src/Actions/WorldAction/OutputAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#undef paramtypes
    1515#undef paramtokens
     16#undef paramdescriptions
     17#undef paramdefaults
    1618#undef paramreferences
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY World
     25#define MENUNAME "world"
     26#define MENUPOSITION 7
    2327#define ACTIONNAME Output
    2428#define TOKEN "output"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "write output files"
     33#undef SHORTFORM
  • src/Actions/WorldAction/RepeatBoxAction.cpp

    rb295ca r41e15b  
    148148  return false;
    149149}
    150 
    151 const string WorldRepeatBoxAction::getName() {
    152   return NAME;
    153 }
    154150/** =========== end of function ====================== */
  • src/Actions/WorldAction/RepeatBoxAction.def

    rb295ca r41e15b  
    77
    88// all includes and forward declarations necessary for non-integral types below
     9#include "Actions/Values.hpp"
    910#include "LinearAlgebra/Vector.hpp"
    1011
    1112// i.e. there is an integer with variable name Z that can be found in
    1213// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     14// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1415#define paramtypes (Vector)
    15 #define paramtokens (WorldRepeatBoxAction::NAME)
     16#define paramtokens ("repeat-box")
     17#define paramdescriptions ("number of copies to create per axis")
     18#undef paramdefaults
    1619#define paramreferences (Repeater)
    1720
     
    2124// some defines for all the names, you may use ACTION, STATE and PARAMS
    2225#define CATEGORY World
     26#define MENUNAME "world"
     27#define MENUPOSITION 8
    2328#define ACTIONNAME RepeatBox
    2429#define TOKEN "repeat-box"
    2530
     31
     32// finally the information stored in the ActionTrait specialization
     33#define DESCRIPTION "create periodic copies of the simulation box per axis"
     34#define SHORTFORM "d"
  • src/Actions/WorldAction/ScaleBoxAction.cpp

    rb295ca r41e15b  
    8686  return false;
    8787}
    88 
    89 const string WorldScaleBoxAction::getName() {
    90   return NAME;
    91 }
    9288/** =========== end of function ====================== */
  • src/Actions/WorldAction/ScaleBoxAction.def

    rb295ca r41e15b  
    77
    88// all includes and forward declarations necessary for non-integral types below
     9#include "Actions/Values.hpp"
    910#include "LinearAlgebra/Vector.hpp"
    1011
    1112// i.e. there is an integer with variable name Z that can be found in
    1213// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     14// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1415#define paramtypes (Vector)
    15 #define paramtokens (WorldScaleBoxAction::NAME)
     16#define paramtokens ("scale-box")
     17#define paramdescriptions ("scaling factor for each axis")
     18#undef paramdefaults
    1619#define paramreferences (Scaler)
    1720
     
    2124// some defines for all the names, you may use ACTION, STATE and PARAMS
    2225#define CATEGORY World
     26#define MENUNAME "world"
     27#define MENUPOSITION 9
    2328#define ACTIONNAME ScaleBox
    2429#define TOKEN "scale-box"
    2530
     31
     32// finally the information stored in the ActionTrait specialization
     33#define DESCRIPTION "scale box and atomic positions inside"
     34#define SHORTFORM "s"
  • src/Actions/WorldAction/SetDefaultNameAction.cpp

    rb295ca r41e15b  
    7373  return true;
    7474}
    75 
    76 const string WorldSetDefaultNameAction::getName() {
    77   return NAME;
    78 }
    7975/** =========== end of function ====================== */
  • src/Actions/WorldAction/SetDefaultNameAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#define paramtypes (std::string)
    15 #define paramtokens (WorldSetDefaultNameAction::NAME)
     15#define paramtokens ("default-molname")
     16#define paramdescriptions ("new default name of new molecules")
     17#undef paramdefaults
    1618#define paramreferences (newname)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY World
     25#define MENUNAME "world"
     26#define MENUPOSITION 10
    2327#define ACTIONNAME SetDefaultName
    2428#define TOKEN "default-molname"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "set the default name of new molecules"
     33#define SHORTFORM "X"
  • src/Actions/WorldAction/SetGaussianBasisAction.cpp

    rb295ca r41e15b  
    7373  return true;
    7474}
    75 
    76 const string WorldSetGaussianBasisAction::getName() {
    77   return NAME;
    78 }
    7975/** =========== end of function ====================== */
  • src/Actions/WorldAction/SetGaussianBasisAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    1414#define paramtypes (std::string)
    15 #define paramtokens (WorldSetGaussianBasisAction::NAME)
     15#define paramtokens ("set-basis")
     16#define paramdescriptions ("name of the gaussian basis set for MPQC")
     17#undef paramdefaults
    1618#define paramreferences (newname)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY World
     25#define MENUNAME "world"
     26#define MENUPOSITION 11
    2327#define ACTIONNAME SetGaussianBasis
    2428#define TOKEN "set-basis"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "set the name of the gaussian basis set for MPQC"
     33#define SHORTFORM "M"
  • src/Actions/WorldAction/SetOutputFormatsAction.cpp

    rb295ca r41e15b  
    7171  return false;
    7272}
    73 
    74 const string WorldSetOutputFormatsAction::getName() {
    75   return NAME;
    76 }
    7773/** =========== end of function ====================== */
  • src/Actions/WorldAction/SetOutputFormatsAction.def

    rb295ca r41e15b  
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    13 // "undefine" if no parameters are required
    14 #define paramtypes (vector<std::string>)
    15 #define paramtokens (WorldSetOutputFormatsAction::NAME)
     13// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
     14#define paramtypes (std::vector<std::string>)
     15#define paramtokens ("set-output")
     16#define paramdescriptions ("specify output formats")
     17#undef paramdefaults
    1618#define paramreferences (FormatList)
    1719
     
    2123// some defines for all the names, you may use ACTION, STATE and PARAMS
    2224#define CATEGORY World
     25#define MENUNAME "world"
     26#define MENUPOSITION 12
    2327#define ACTIONNAME SetOutputFormats
    2428#define TOKEN "set-output"
    2529
     30
     31// finally the information stored in the ActionTrait specialization
     32#define DESCRIPTION "specify output formats"
     33#define SHORTFORM "o"
  • src/Helpers/Assert.cpp

    rb295ca r41e15b  
    7474
    7575bool Assert::_my_assert::check(const char* condition,
    76                                const char* message,
     76                               std::string message,
    7777                               const char* filename,
    7878                               const int line,
  • src/Helpers/Assert.hpp

    rb295ca r41e15b  
    180180 *
    181181 * <ul>
     182 * <li> <H4> How can I add values to the failure message of ASSERT(), e.g. I want to say that above "i"
     183 *      failed to be zero, with i == ...?</H4>
     184 * This can be done in the following way:
     185 * @code
     186 * ASSERT(!i,"i was not zero but "+std::string(i)+"after incrementing");
     187 * @endcode
     188 * Note that this works because std::string() in the middle requires the const char arrays on both ends
     189 * to be converted to string and eventually, the whole text is again cast to const char * form.
    182190 * <li> <H4> ASSERT() is broken. When I abort the program it says something about an
    183191 * "Illegal instruction"</H4>
     
    300308    public:
    301309      static bool check(const char* condition,
    302                         const char* message,
     310                        std::string message,
    303311                        const char* filename,
    304312                        const int line,
  • src/Makefile.am

    rb295ca r41e15b  
    3939  Actions/ActionRegistry.cpp \
    4040  Actions/ActionSequence.cpp \
     41  Actions/ActionTraits.cpp \
    4142  Actions/ErrorAction.cpp \
    4243  Actions/MakroAction.cpp \
    4344  Actions/ManipulateAtomsProcess.cpp \
    4445  Actions/MethodAction.cpp \
     46        Actions/OptionRegistry.cpp \
     47        Actions/OptionTrait.cpp \
    4548  Actions/Process.cpp
    4649
     
    5053  Actions/ActionRegistry.hpp \
    5154  Actions/ActionSequence.hpp \
     55  Actions/ActionTraits.hpp \
    5256  Actions/Calculation.hpp \
    5357  Actions/Calculation_impl.hpp \
     
    5559  Actions/MakroAction.hpp \
    5660  Actions/ManipulateAtomsProcess.hpp \
    57   Actions/MapOfActions.hpp \
    5861  Actions/MethodAction.hpp \
     62        Actions/OptionRegistry.hpp \
     63        Actions/OptionTrait.hpp \
    5964  Actions/Process.hpp
    6065
     
    123128        UIElements/Qt4/QtMainWindow.hpp \
    124129        UIElements/Menu/Qt4/QtMenu.hpp \
     130        UIElements/Menu/Qt4/QtMenuPipe.hpp \
    125131        UIElements/Views/Qt4/QtWorldView.hpp \
    126132        UIElements/Views/Qt4/GLMoleculeView.hpp \
     
    165171        UIElements/Qt4/QtDialog.cpp \
    166172        UIElements/Qt4/QtUIFactory.cpp \
    167         UIElements/Menu/Qt4/QtMenu.cpp \
     173        UIElements/Menu/Qt4/QtMenuPipe.cpp \
    168174        UIElements/Views/Qt4/QtWorldView.cpp \
    169175        UIElements/Views/Qt4/GLMoleculeView.cpp \
     
    213219  boundary.cpp \
    214220  Box.cpp \
    215   CommandLineParser.cpp \
    216221  config.cpp \
    217222  ConfigFileBuffer.cpp \
     
    251256  boundary.hpp \
    252257  Box.hpp \
    253   CommandLineParser.hpp \
    254258  config.hpp \
    255259  ConfigFileBuffer.hpp \
  • src/Patterns/Registry.hpp

    rb295ca r41e15b  
    22 * Registry.hpp
    33 *
    4  *  Based on Registry<Action> by Till Crueger.
     4 *  Based on initial ActionRegistry code by Till Crueger.
    55 *
    66 *  The registry pattern is basically just a singleton map, wherein instantiations
     
    2121 * <h1> Registry Howto </h1>
    2222 *
    23  * The registry is a class where instances of other classes are stored and be retrieved
    24  * when desired. For this purpose a registry should always be a singleton (i.e. use both
    25  * this registry and the singleton pattern to declare a registry class). It basically
    26  * is simply a singleton container of a map, where the pointers to the class instances are
    27  * stored by a string key and can be retrieved thereby.
     23 * The Registry is a class where instances of other classes are stored and be retrieved
     24 * by a string token when desired. For this purpose a Registry should always be a singleton
     25 * (i.e. use both this Registry and the Singleton pattern to declare a Registry class). It
     26 * basically is simply a singleton container of a map, where the pointers to the class
     27 * instances are stored by a string key and can be retrieved thereby.
    2828 *
    29  * The available functions are, if your class to be stored in registry is foo :
     29 * The available functions are as follows if your class instances to be stored in Registry
     30 * are of type 'foo':
    3031 *
    3132 * - <code>foo* Registry<foo>::getByName()</code> : returns the instance of a specific
     
    5859  ~Registry();
    5960
    60   T* getByName(const std::string name);
    61   bool isPresentByName(const std::string name);
     61  typedef typename std::map<const std::string,T*> instance_map;
     62  typedef typename std::map<const std::string,T*>::iterator                  iterator;
     63  typedef typename std::map<const std::string,T*>::const_iterator            const_iterator;
     64
     65  T* getByName(const std::string name) const;
     66  bool isPresentByName(const std::string name) const;
    6267  void registerInstance(T*);
    6368  void unregisterInstance(T*);
     69  void cleanup();
    6470
    65   typename std::map<const std::string,T*>::iterator getBeginIter();
    66   typename std::map<const std::string,T*>::const_iterator getBeginIter() const;
    67   typename std::map<const std::string,T*>::iterator getEndIter();
    68   typename std::map<const std::string,T*>::const_iterator getEndIter() const;
     71  iterator getBeginIter();
     72  const_iterator getBeginIter() const;
     73  iterator getEndIter();
     74  const_iterator getEndIter() const;
    6975
    7076private:
    71   typename std::map<const std::string,T*> InstanceMap;
     77  instance_map InstanceMap;
    7278};
    7379
  • src/Patterns/Registry_impl.hpp

    rb295ca r41e15b  
    1515
    1616#include "Helpers/Assert.hpp"
    17 #include <iosfwd>
     17#include <iostream>
    1818
    1919/** Constructor for class Registry.
     
    2525 */
    2626template <class T> Registry<T>::~Registry()
    27 {
    28   typename std::map<const std::string,T*>::iterator iter;
    29   for(iter=InstanceMap.begin();iter!=InstanceMap.end();++iter) {
    30     delete iter->second;
    31   }
    32   InstanceMap.clear();
    33 }
     27{}
    3428
    3529/** Returns pointer to an instance named by \a name.
     
    3731 * \return pointer to instance
    3832 */
    39 template <class T> T* Registry<T>::getByName(const std::string name){
    40   typename std::map<const std::string,T*>::iterator iter;
     33template <class T> T* Registry<T>::getByName(const std::string name) const
     34{
     35  typename std::map<const std::string,T*>::const_iterator iter;
    4136  iter = InstanceMap.find(name);
    42   ASSERT(iter!=InstanceMap.end(),"Query for an instance not stored in registry");
     37  ASSERT(iter!=InstanceMap.end(),"Query for an instance "+name+" not stored in registry");
    4338  return iter->second;
    4439}
     
    4742 * \note This is needed as Registry<T>::getByName() ASSERT()s that instance is in std::map.
    4843 * \param name name of instance
    49  * \return true - v present, false - instance absent
     44 * \return true - present, false - instance absent
    5045 */
    51 template <class T>bool Registry<T>::isPresentByName(const std::string name){
    52   typename std::map<const std::string,T*>::iterator iter;
     46template <class T>bool Registry<T>::isPresentByName(const std::string name) const
     47{
     48  typename std::map<const std::string,T*>::const_iterator iter;
    5349  iter = InstanceMap.find(name);
    5450  return iter!=InstanceMap.end();
     
    6056template <class T>void Registry<T>::registerInstance(T* instance){
    6157  std::pair<typename std::map<const std::string,T*>::iterator,bool> ret;
    62   //cout << "Trying to register instance with name " << instance->getName() << "." << endl;
     58  //std::cout << "Trying to register instance of type " << typeid(T).name() << " with name " << instance->getName() << "." << std::endl;
    6359  ret = InstanceMap.insert(typename std::pair<const std::string,T*>(instance->getName(),instance));
    64   ASSERT(ret.second,"Two instances with the same name added to registry");
     60  ASSERT(ret.second,"Two instances with the same name "+instance->getName()+" added to registry");
    6561}
    6662
     
    6965 */
    7066template <class T>void Registry<T>::unregisterInstance(T* instance){
    71   //cout << "Unregistering instance with name " << instance->getName() << "." << endl;
     67  //std::cout << "Unregistering instance of type " << typeid(T).name() << " with name " << instance->getName() << "." << std::endl;
    7268  InstanceMap.erase(instance->getName());
    7369}
     70
     71/** Removes every instance from the registry.
     72 */
     73template <class T>void Registry<T>::cleanup()
     74{
     75  typename std::map<const std::string,T*>::iterator iter;
     76  for(iter=InstanceMap.begin();iter!=InstanceMap.end();++iter) {
     77    delete iter->second;
     78  }
     79  InstanceMap.clear();
     80}
     81
    7482
    7583/** Returns an iterator pointing to the start of the std::map of instance's.
     
    128136 * at a chosen place.
    129137 */
    130 #define CONSTRUCT_REGISTRY(name) \
    131     template name* Registry<name>::getByName(const std::string name); \
    132     template bool Registry<name>::isPresentByName(const std::string name); \
    133     template void Registry<name>::registerInstance(name*); \
    134     template void Registry<name>::unregisterInstance(name*); \
    135     template std::map<const std::string,name*>::iterator Registry<name>::getBeginIter(); \
    136     template std::map<const std::string,name*>::const_iterator Registry<name>::getBeginIter() const; \
    137     template std::map<const std::string,name*>::iterator Registry<name>::getEndIter(); \
    138     template std::map<const std::string,name*>::const_iterator Registry<name>::getEndIter() const;
     138#define CONSTRUCT_REGISTRY(InstanceType) \
     139    template InstanceType* Registry<InstanceType>::getByName(const std::string) const; \
     140    template bool Registry<InstanceType>::isPresentByName(const std::string) const; \
     141    template void Registry<InstanceType>::registerInstance(InstanceType*); \
     142    template void Registry<InstanceType>::unregisterInstance(InstanceType*); \
     143    template std::map<const std::string,InstanceType*>::iterator Registry<InstanceType>::getBeginIter(); \
     144    template std::map<const std::string,InstanceType*>::const_iterator Registry<InstanceType>::getBeginIter() const; \
     145    template std::map<const std::string,InstanceType*>::iterator Registry<InstanceType>::getEndIter(); \
     146    template std::map<const std::string,InstanceType*>::const_iterator Registry<InstanceType>::getEndIter() const;
    139147
    140148
  • src/UIElements/CommandLineUI/CommandLineWindow.cpp

    rb295ca r41e15b  
    2626
    2727#include "Actions/Action.hpp"
    28 #include "Actions/MapOfActions.hpp"
    2928#include "Actions/ActionRegistry.hpp"
    3029
    31 #include "CommandLineParser.hpp"
     30#include "UIElements/CommandLineUI/CommandLineParser.hpp"
    3231
    3332#include <iostream>
     
    3837CommandLineWindow::CommandLineWindow()
    3938{
    40   // create and register all command line callable actions
    41   MapOfActions::getInstance().populateActions();
    42 
    4339  // Add status indicators etc...
    4440  statusIndicator = new CommandLineStatusIndicator();
  • src/UIElements/CommandLineUI/Query/AtomCommandLineQuery.cpp

    rb295ca r41e15b  
    2626#include "CommandLineUI/CommandLineDialog.hpp"
    2727
    28 #include "CommandLineParser.hpp"
     28#include "CommandLineUI/CommandLineParser.hpp"
    2929#include "Helpers/Log.hpp"
    3030#include "Helpers/Verbose.hpp"
  • src/UIElements/CommandLineUI/Query/AtomsCommandLineQuery.cpp

    rb295ca r41e15b  
    2424#include "CommandLineUI/CommandLineDialog.hpp"
    2525
     26#include "CommandLineUI/CommandLineParser.hpp"
    2627#include "Helpers/Log.hpp"
    2728#include "Helpers/Verbose.hpp"
    28 #include "CommandLineParser.hpp"
    2929#include "World.hpp"
    3030
  • src/UIElements/CommandLineUI/Query/BooleanCommandLineQuery.cpp

    rb295ca r41e15b  
    2222#include "CommandLineUI/CommandLineDialog.hpp"
    2323
     24#include "CommandLineUI/CommandLineParser.hpp"
    2425#include "Helpers/Log.hpp"
    2526#include "Helpers/Verbose.hpp"
    26 #include "CommandLineParser.hpp"
    2727
    2828CommandLineDialog::BooleanCommandLineQuery::BooleanCommandLineQuery(string title, string _description) :
  • src/UIElements/CommandLineUI/Query/BoxCommandLineQuery.cpp

    rb295ca r41e15b  
    2323
    2424#include "Actions/Values.hpp"
     25#include "CommandLineUI/CommandLineParser.hpp"
    2526#include "Helpers/Log.hpp"
    2627#include "Helpers/Verbose.hpp"
    2728#include "LinearAlgebra/Matrix.hpp"
    28 #include "CommandLineParser.hpp"
    2929
    3030CommandLineDialog::BoxCommandLineQuery::BoxCommandLineQuery(string title, string _description) :
  • src/UIElements/CommandLineUI/Query/DoubleCommandLineQuery.cpp

    rb295ca r41e15b  
    2222#include "CommandLineUI/CommandLineDialog.hpp"
    2323
     24#include "CommandLineUI/CommandLineParser.hpp"
    2425#include "Helpers/Log.hpp"
    2526#include "Helpers/Verbose.hpp"
    26 #include "CommandLineParser.hpp"
    2727
    2828
  • src/UIElements/CommandLineUI/Query/DoublesCommandLineQuery.cpp

    rb295ca r41e15b  
    2222#include "CommandLineUI/CommandLineDialog.hpp"
    2323
     24#include "CommandLineUI/CommandLineParser.hpp"
    2425#include "Helpers/Log.hpp"
    2526#include "Helpers/Verbose.hpp"
    26 #include "CommandLineParser.hpp"
    2727
    2828CommandLineDialog::DoublesCommandLineQuery::DoublesCommandLineQuery(string title, string _description) :
  • src/UIElements/CommandLineUI/Query/ElementCommandLineQuery.cpp

    rb295ca r41e15b  
    2222#include "CommandLineUI/CommandLineDialog.hpp"
    2323
     24#include "CommandLineUI/CommandLineParser.hpp"
    2425#include "Helpers/Log.hpp"
    2526#include "Helpers/Verbose.hpp"
    26 #include "CommandLineParser.hpp"
    2727#include "element.hpp"
    2828#include "periodentafel.hpp"
  • src/UIElements/CommandLineUI/Query/ElementsCommandLineQuery.cpp

    rb295ca r41e15b  
    2222#include "CommandLineUI/CommandLineDialog.hpp"
    2323
     24#include "CommandLineUI/CommandLineParser.hpp"
    2425#include "Helpers/Log.hpp"
    2526#include "Helpers/Verbose.hpp"
    26 #include "CommandLineParser.hpp"
    2727#include "element.hpp"
    2828#include "periodentafel.hpp"
  • src/UIElements/CommandLineUI/Query/EmptyCommandLineQuery.cpp

    rb295ca r41e15b  
    2424#include "CommandLineUI/CommandLineDialog.hpp"
    2525
     26#include "CommandLineUI/CommandLineParser.hpp"
    2627#include "Helpers/Log.hpp"
    2728#include "Helpers/Verbose.hpp"
    28 #include "CommandLineParser.hpp"
    2929
    3030CommandLineDialog::EmptyCommandLineQuery::EmptyCommandLineQuery(string title, string _description) :
  • src/UIElements/CommandLineUI/Query/FileCommandLineQuery.cpp

    rb295ca r41e15b  
    2222#include "CommandLineUI/CommandLineDialog.hpp"
    2323
     24#include "CommandLineUI/CommandLineParser.hpp"
    2425#include "Helpers/Log.hpp"
    2526#include "Helpers/Verbose.hpp"
    26 #include "CommandLineParser.hpp"
    2727
    2828CommandLineDialog::FileCommandLineQuery::FileCommandLineQuery(string title, string _description) :
  • src/UIElements/CommandLineUI/Query/IntCommandLineQuery.cpp

    rb295ca r41e15b  
    2222#include "CommandLineUI/CommandLineDialog.hpp"
    2323
     24#include "CommandLineUI/CommandLineParser.hpp"
    2425#include "Helpers/Log.hpp"
    2526#include "Helpers/Verbose.hpp"
    26 #include "CommandLineParser.hpp"
    2727
    2828CommandLineDialog::IntCommandLineQuery::IntCommandLineQuery(string title, string _description) :
  • src/UIElements/CommandLineUI/Query/IntsCommandLineQuery.cpp

    rb295ca r41e15b  
    2222#include "CommandLineUI/CommandLineDialog.hpp"
    2323
     24#include "CommandLineUI/CommandLineParser.hpp"
    2425#include "Helpers/Log.hpp"
    2526#include "Helpers/Verbose.hpp"
    26 #include "CommandLineParser.hpp"
    2727
    2828CommandLineDialog::IntsCommandLineQuery::IntsCommandLineQuery(string title, string _description) :
  • src/UIElements/CommandLineUI/Query/MoleculeCommandLineQuery.cpp

    rb295ca r41e15b  
    2424#include "CommandLineUI/CommandLineDialog.hpp"
    2525
     26#include "CommandLineUI/CommandLineParser.hpp"
    2627#include "Helpers/Log.hpp"
    2728#include "Helpers/Verbose.hpp"
    28 #include "CommandLineParser.hpp"
    2929
    3030CommandLineDialog::MoleculeCommandLineQuery::MoleculeCommandLineQuery(string title, string _description) :
  • src/UIElements/CommandLineUI/Query/MoleculesCommandLineQuery.cpp

    rb295ca r41e15b  
    2424#include "CommandLineUI/CommandLineDialog.hpp"
    2525
     26#include "CommandLineUI/CommandLineParser.hpp"
    2627#include "Helpers/Log.hpp"
    2728#include "Helpers/Verbose.hpp"
    28 #include "CommandLineParser.hpp"
    2929#include "World.hpp"
    3030
  • src/UIElements/CommandLineUI/Query/StringCommandLineQuery.cpp

    rb295ca r41e15b  
    2222#include "CommandLineUI/CommandLineDialog.hpp"
    2323
     24#include "CommandLineUI/CommandLineParser.hpp"
    2425#include "Helpers/Log.hpp"
    2526#include "Helpers/Verbose.hpp"
    26 #include "CommandLineParser.hpp"
    2727
    2828CommandLineDialog::StringCommandLineQuery::StringCommandLineQuery(string title, string _description) :
  • src/UIElements/CommandLineUI/Query/StringsCommandLineQuery.cpp

    rb295ca r41e15b  
    2222#include "CommandLineUI/CommandLineDialog.hpp"
    2323
     24#include "CommandLineUI/CommandLineParser.hpp"
    2425#include "Helpers/Log.hpp"
    2526#include "Helpers/Verbose.hpp"
    26 #include "CommandLineParser.hpp"
    2727
    2828CommandLineDialog::StringsCommandLineQuery::StringsCommandLineQuery(string title, string _description) :
     
    3434bool CommandLineDialog::StringsCommandLineQuery::handle() {
    3535  if (CommandLineParser::getInstance().vm.count(getTitle())) {
    36     tmp = CommandLineParser::getInstance().vm[getTitle()].as< vector<string> >();
     36    tmp = CommandLineParser::getInstance().vm[getTitle()].as< std::vector<std::string> >();
    3737    return true;
    3838  } else {
  • src/UIElements/CommandLineUI/Query/VectorCommandLineQuery.cpp

    rb295ca r41e15b  
    2323
    2424#include "Actions/Values.hpp"
     25#include "CommandLineUI/CommandLineParser.hpp"
    2526#include "Helpers/Log.hpp"
    2627#include "Helpers/Verbose.hpp"
    27 #include "CommandLineParser.hpp"
    2828#include "LinearAlgebra/Vector.hpp"
    2929#include "Box.hpp"
  • src/UIElements/CommandLineUI/Query/VectorsCommandLineQuery.cpp

    rb295ca r41e15b  
    2525
    2626#include "Actions/Values.hpp"
     27#include "CommandLineUI/CommandLineParser.hpp"
    2728#include "Helpers/Log.hpp"
    2829#include "Helpers/Verbose.hpp"
    29 #include "CommandLineParser.hpp"
    3030#include "World.hpp"
    3131
  • src/UIElements/Dialog.cpp

    rb295ca r41e15b  
    126126}
    127127
    128 template <> void Dialog::query<atom *>(const char *token, std::string description)
     128template <> void Dialog::query<const atom *>(const char *token, std::string description)
    129129{
    130130  queryAtom(token, description);
    131131}
    132132
    133 template <> void Dialog::query< std::vector<atom *> >(const char *token, std::string description)
     133template <> void Dialog::query< std::vector<const atom *> >(const char *token, std::string description)
    134134{
    135135  queryAtoms(token, description);
    136136}
    137137
    138 template <> void Dialog::query<molecule *>(const char *token, std::string description)
     138template <> void Dialog::query<const molecule *>(const char *token, std::string description)
    139139{
    140140  queryMolecule(token, description);
    141141}
    142142
    143 template <> void Dialog::query< std::vector<molecule *> >(const char *token, std::string description)
     143template <> void Dialog::query< std::vector<const molecule *> >(const char *token, std::string description)
    144144{
    145145  queryMolecules(token, description);
  • src/UIElements/Dialog.hpp

    rb295ca r41e15b  
    3333 * string, but also advanced types such as element, molecule or Vector. There
    3434 * is also an empty query for displaying text.
     35 *
     36 * Note that the templatization of Dialog::query() allows for easy implementation
     37 * of new types that correspond to/are derived from old ones.
     38 *
     39 * <H3>How do Dialogs operate?</H3>
     40 *
     41 * Dialogs are initiated by Action::FillDialog() function calls. Within Action::Call()
     42 * a dialog is created and passed on to FillDialog(), which is specialized in each
     43 * specific Action to ask for the specific parameter it needs.
     44 *
     45 * Dialogs are derived for each of the UI types
     46 *  -# CommandLineDialog
     47 *  -# QtDialog
     48 *  -# TextDialog
     49 *
     50 * This "asking" for parameters is done via the Query class.  There are four types
     51 * of Query types:
     52 *  -# Query, members in class Dialog
     53 *  -# CommandLineQuery, members in class CommandLineDialog
     54 *  -# QtQuery, members in class QtDialog
     55 *  -# TextQuery, members in class TextDialog
     56 * Each embodies a certain way of asking the user for the specific type of parameter
     57 * needed, e.g. a file via the TextMenu interface would be done in member functions of
     58 * TextDialog::FileTextQuery.
     59 *
     60 *
     61 * Generally, the sequence of events is as follows:
     62 *  -# Action::fillDialog() calls upon Dialog::query<T> for some type T, let's say T
     63 *     stands for double
     64 *  -# Dialog::query<double> call a function queryDouble()
     65 *  -# depending on the currently used UIFactory, the Dialog above is actually either
     66 *     of the three specialized types, let's say CommandLine. And we see that within
     67 *     CommandLineDialog we have the respective method ueryDouble() that registers
     68 *     a new instance of the class CommandLineDialog::DoubleCommandLineQuery.
     69 *  -# The Query's are first registered, as multiple parameters may be needed for
     70 *     a single Action and we don't want the popping up of a dialog window for each
     71 *     alone. Rather, we want to merge the Query's into a single Dialog. Therefore,
     72 *     they are first registered and then executed in sequence. This is done in
     73 *     Dialog::display(), i.e. when the dialog is finally shown to the user.
     74 *  -# Then each of the registered Query's, here our CommandLineDialog::
     75 *     DoubleCommandLineQuery, constructor is called.
     76 *     -# This will call the constructor of its base class, where the actual value
     77 *        is stored and later stored into the ValueStorage class by
     78 *        Dialog::Query::setResult().
     79 *     -# Also, e.g. for the Qt interface, the buttons, labels and so forth are
     80 *        created and added to the dialog.
     81 *  -# Now the users enters information for each UI something different happens:
     82 *    -# CommandLine: The actual value retrieval is done by the CommandLineParser and
     83 *       the boost::program_options library, the value is stored therein for the moment.
     84 *       (see here: http://www.boost.org/doc/libs/1_44_0/doc/html/program_options/)
     85 *    -# TextMenu: The value is requested via std::cin from the user.
     86 *    -# QtMenu: The users enters the value in a Dialog. Due to Qt necessities a
     87 *       Pipe class obtains the value from the Dialog with Qt's signal/slot mechanism
     88 *       and put it into Dialog::...Query value.
     89 *  -# in our case DoubleCommandLineQuery::handle() will be called. The value is
     90 *     retrieved and put into Dialog::DoubleQuery::tmp
     91 *  -# Finally, for each Query, also Dialog::DoubleQuery, setResult() is called which
     92 *     puts the value as a string into the ValueStorage under a given token that is
     93 *     associated with a type (and thereby we assure type-safety).
     94 *
     95 * <H3>Regarding derived types of types with already present queries</H3>
     96 *
     97 * Example: We have got a derived Vector class, called BoxVector, that is by any means
     98 * a Vector but with one difference: it is always bound to lie within the current domain.
     99 * With regards to type-casting it to and from a string however, nothing is different
     100 * between Vector and BoxVector.
     101 *
     102 * So, do we need a new Query for this?
     103 * No.
     104 *
     105 * We just have to do this:
     106 *  -# add a specialization of Dialog::query<BoxVector> where queryVector()is used.
     107 *     @code
     108 *     template <> void Dialog::query<BoxVector>(const char *token, std::string description) {
     109 *        queryVector(token, false, description);
     110 *     }
     111 *     @endcode
     112 *  -# make sure that
     113 *     -# ValueStorage::setCurrentValue() the specialization for class Vector has an
     114 *     if case also for BoxVector and does something appropriate.
     115 *     -# ValueStorage::queryCurrentValue() has another specialization doing the same
     116 *     as for Vector but for BoxVector in its signature.
     117 *
     118 * And that's all.
     119 *
     120 *
     121 * <H3>Adding new queries</H3>
     122 *
     123 * Check first whether you really need a new query or whether we can derive it and re-use
     124 * one of the present ones.
     125 *
     126 * Due to the three present UI interfaces we have to add a specific Query for each, here
     127 * is a list:
     128 *   -# add ValueStorage::setCurrentValue() and ValueStorage::queryCurrentValue() for
     129 *      both types
     130 *   -# add Dialog::query...()
     131 *   -# add Dialog::query<>() specialization calling the above function
     132 *   -# add CommandLineDialog::query...(), TextDialog::query...(), and QtDialog::query...(),
     133 *      i.e. for each of the three interface
     134 *   -# add Dialog::...Query class with tmp value of desired type
     135 *   -# add CommandLineDialog::...Query, TextDialog::...Query, QtDialog::...Query
     136 *   -# you probably also need a QtDialog::...QueryPipe() to handle the signal/slot stuff,
     137 *      Qt's moc does not like nested classes. Hence, this has to go extra.
     138 *
    35139 */
    36140class Dialog
     
    210314    virtual void setResult();
    211315  protected:
    212     molecule *tmp;
     316    const molecule *tmp;
    213317  };
    214318
     
    220324    virtual void setResult();
    221325  protected:
    222     molecule * temp;
    223     std::vector<molecule *> tmp;
     326    const molecule * temp;
     327    std::vector<const molecule *> tmp;
    224328  };
    225329
     
    231335    virtual void setResult();
    232336  protected:
    233     atom *tmp;
     337    const atom *tmp;
    234338  };
    235339
     
    241345    virtual void setResult();
    242346  protected:
    243     atom *temp;
    244     std::vector<atom *> tmp;
     347    const atom *temp;
     348    std::vector<const atom *> tmp;
    245349  };
    246350
  • src/UIElements/Makefile.am

    rb295ca r41e15b  
    1919MENUSOURCE = \
    2020  Menu/Menu.cpp \
    21   Menu/TextMenu.cpp \
    22   Menu/MenuItem.cpp \
    23   Menu/SubMenuItem.cpp \
    24   Menu/ActionMenuItem.cpp \
    25   Menu/SeperatorItem.cpp \
    26   Menu/DisplayMenuItem.cpp
    27  
     21  Menu/MenuDescription.cpp \
     22  Menu/MenuInterface.cpp
     23
    2824MENUHEADER = \
    2925  Menu/Menu.hpp \
    30   Menu/TextMenu.hpp \
    31   Menu/MenuItem.hpp \
    32   Menu/SubMenuItem.hpp \
    33   Menu/ActionMenuItem.hpp \
    34   Menu/SeperatorItem.hpp \
    35   Menu/DisplayMenuItem.hpp
     26  Menu/MenuDescription.hpp \
     27  Menu/MenuInterface.hpp
     28 
     29TEXTMENUSOURCE = \
     30  Menu/TextMenu/TxMenu.cpp \
     31  Menu/TextMenu/MenuItem.cpp \
     32  Menu/TextMenu/SubMenuItem.cpp \
     33  Menu/TextMenu/ActionMenuItem.cpp \
     34  Menu/TextMenu/SeperatorItem.cpp \
     35  Menu/TextMenu/DisplayMenuItem.cpp
     36 
     37TEXTMENUHEADER = \
     38  Menu/TextMenu/TextMenu.hpp \
     39  Menu/TextMenu/TxMenu.hpp \
     40  Menu/TextMenu/MenuItem.hpp \
     41  Menu/TextMenu/SubMenuItem.hpp \
     42  Menu/TextMenu/ActionMenuItem.hpp \
     43  Menu/TextMenu/SeperatorItem.hpp \
     44  Menu/TextMenu/DisplayMenuItem.hpp
    3645
    3746UISOURCE = \
     
    3948  ${COMMANDLINEUISOURCE} \
    4049  ${MENUSOURCE} \
     50  ${TEXTMENUSOURCE} \
    4151  ${TEXTUISOURCE} \
    4252  ${VIEWSOURCE} \
     
    6777  ${COMMANDLINEUIHEADER} \
    6878  ${MENUHEADER} \
     79  ${TEXTMENUHEADER} \
    6980  ${TEXTUIHEADER} \
    7081  ${VIEWHEADER} \
     
    121132  CommandLineUI/Query/VectorsCommandLineQuery.cpp \
    122133  CommandLineUI/CommandLineDialog.cpp \
     134  CommandLineUI/CommandLineParser.cpp \
    123135  CommandLineUI/CommandLineStatusIndicator.cpp \
    124136  CommandLineUI/CommandLineUIFactory.cpp \
    125   CommandLineUI/CommandLineWindow.cpp
     137  CommandLineUI/CommandLineWindow.cpp \
     138  CommandLineUI/TypeEnumContainer.cpp
     139 
    126140COMMANDLINEUIHEADER = \
    127141  CommandLineUI/CommandLineDialog.hpp \
     142  CommandLineUI/CommandLineParser.hpp \
    128143  CommandLineUI/CommandLineStatusIndicator.hpp \
    129144  CommandLineUI/CommandLineUIFactory.hpp \
    130   CommandLineUI/CommandLineWindow.hpp
     145  CommandLineUI/CommandLineWindow.hpp \
     146  CommandLineUI/TypeEnumContainer.cpp
    131147
    132148lib_LTLIBRARIES = libMolecuilderUI-@MOLECUILDER_API_VERSION@.la
  • src/UIElements/Menu/Menu.cpp

    rb295ca r41e15b  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Menu.hpp"
     22#include <iostream>
    2323
    24 Menu::Menu()
     24#include "Actions/ActionRegistry.hpp"
     25#include "Actions/Action.hpp"
     26#include "Actions/ActionTraits.hpp"
     27#include "Menu/Menu.hpp"
     28
     29/** Constructor of class Menu.
     30 * \param &_name name of menu
     31 */
     32Menu::Menu(const std::string &_name) :
     33  MenuInterface(_name),
     34  name(_name),
     35  TopPosition(0),
     36  LastItem(NoItem)
     37{}
     38
     39/** Destructor of class Menu.
     40 *
     41 */
     42Menu::~Menu()
     43{}
     44
     45/** Initialiser for class Menu.
     46 * Fills menus with items.
     47 */
     48void Menu::init()
    2549{
    26   // TODO Auto-generated constructor stub
    27 
     50  populate();
     51  populateActions();
    2852}
    2953
    30 Menu::~Menu()
     54/** Initializing function.
     55 * Inserts Menus and Actions obtained from MenuDescription and
     56 * ActionRegistry.
     57 */
     58void Menu::populate()
    3159{
    32   // TODO Auto-generated destructor stub
     60  // go through all menus and create them
     61
     62  bool CompleteFlag = false;  // indicates whether all menus have been added
     63  bool PossibleMissingFlag = false; // indicates whether a separator is missing
     64  while (!CompleteFlag) {
     65    CompleteFlag = true;
     66    PossibleMissingFlag = false;
     67    for(MenuDescription::const_iterator iter = menudescriptions.getBeginIter();
     68        iter != menudescriptions.getEndIter();
     69        ++iter) {
     70      // skip when already present
     71      if (!isPresent(iter->first)) {
     72        // have some short refs to infos
     73        const std::string &MenuName = iter->first;
     74        const std::string &TopName = iter->second.first;
     75        const int &MenuPosition = iter->second.second;
     76        std::cout << "MenuName is " << MenuName
     77            << ", TopName is " << TopName
     78            << " and Position is " << MenuPosition
     79            << std::endl;
     80
     81        // does it belong to us?
     82        if (TopName == name) {
     83          if (MenuPosition-1 == TopPosition) {
     84            Menu::addSubmenu(MenuName, MenuPosition);
     85            CompleteFlag = false;
     86          }
     87          // is there a menuposition specified that we have not reached yet?
     88          if (MenuPosition-1 > TopPosition)
     89            PossibleMissingFlag = true;
     90        }
     91      }
     92    }
     93    if (PossibleMissingFlag && (CompleteFlag)) {
     94      Menu::addSeparator();
     95      CompleteFlag = false; // pass once more as there should be a menu to come
     96    }
     97  }
    3398}
     99
     100/** Fills this menu with all Actions that belong to it.
     101 */
     102void Menu::populateActions()
     103{
     104  // go through all actions and add those beloning to this menu
     105  ActionRegistry &AR = ActionRegistry::getInstance();
     106  for (ActionRegistry::const_iterator iter = AR.getBeginIter();
     107      iter != AR.getEndIter();
     108      ++iter) {
     109    const std::string &MenuName = iter->second->Traits.getMenuName();
     110    if (MenuName == name) {
     111      const std::string &ActionName = iter->first;
     112      Menu::addAction(ActionName);
     113    }
     114  }
     115}
     116
     117void Menu::addAction(const std::string &ActionName)
     118{
     119  LastItem = ActionItem;
     120  addActionItem(ActionName, ActionName);
     121}
     122
     123void Menu::addSeparator()
     124{
     125  std::cout << "Creating separator at position " << TopPosition << std::endl;
     126  ASSERT( LastItem != SeparatorItem,
     127      "Menu::populate() - adding another separator after a separator!");
     128  LastItem = SeparatorItem;
     129  addSeparatorItem();
     130  TopPosition++;
     131}
     132
     133void Menu::addSubmenu(const std::string &MenuName, const int MenuPosition)
     134{
     135  std::cout << "Creating top-level menu " << MenuName
     136      << " at position " << TopPosition << std::endl;
     137  ASSERT (!isPresent(MenuName),
     138      "Menu::addSubmenu() - trying to add menu "+MenuName+" with already present token!");
     139  addSubmenuItem(MenuName, menudescriptions.getDescription(MenuName));
     140  DuplicatesList.insert(MenuName);
     141  LastItem = MenuItem;
     142  TopPosition = MenuPosition;
     143}
     144
     145bool Menu::isPresent(const std::string &token)
     146{
     147  return (DuplicatesList.find(token) != DuplicatesList.end());
     148}
  • src/UIElements/Menu/Menu.hpp

    rb295ca r41e15b  
    99#define MENU_MENU_H_
    1010
    11 using namespace std;
     11#include <set>
     12#include <string>
    1213
    13 class MenuItem;
     14#include "Menu/MenuInterface.hpp"
     15#include "Menu/MenuDescription.hpp"
    1416
    15 /**
    16  * Base class for all Types of menus
    17  * contains basic abstract functionality to add Items, remove Items and display the menu
     17/** Base class for all Types of menus.
     18 * Here, we simply initialize the menus. Via the MenuInterface wrapper we may
     19 * access the adding of items for each specific menu in a uniform manner.
    1820 *
    19  * TODO: Make sure all items are only added once.
     21 * Note that this Class is never to be used directly but only via derived
     22 * specializations.
    2023 */
    21 class Menu
     24class Menu : virtual public MenuInterface
    2225{
    2326public:
    24   Menu();
     27  explicit Menu(const std::string &name);
    2528  virtual ~Menu();
    2629
     30  void init();
    2731
    28   /**
    29    * Adding and removing should be handled by the items.
    30    */
    31   virtual void addItem(MenuItem*)=0;
    32   /**
    33    * Adding and removing should be handled by the items.
    34    */
    35   virtual void removeItem(MenuItem*)=0;
    36   virtual void display()=0;
     32protected:
     33  // Unique name of the menu for identification.
     34  const std::string name;
     35
     36  // populater function that adds all menu items
     37  void populate();
     38  void populateActions();
    3739
    3840private:
     41  void addAction(const std::string &ActionName);
     42  void addSeparator();
     43  void addSubmenu(const std::string &MenuName, const int MenuPosition);
     44  bool isPresent(const std::string &token);
     45
     46  enum ItemType {ActionItem, MenuItem, SeparatorItem, NoItem};
     47
     48  int TopPosition;  // current position to add
     49  MenuDescription menudescriptions; // contains the menu tree and description to each item
     50  enum ItemType LastItem;  // check whether separator followed separator
     51  std::set <std::string> DuplicatesList;  // is used to check for duplicates
    3952};
    4053
  • src/UIElements/Menu/Qt4/QtMenu.hpp

    rb295ca r41e15b  
    22 * QtMenu.hpp
    33 *
    4  *  Created on: Jan 15, 2010
    5  *      Author: crueger
     4 *  Created on: Nov 5, 2010
     5 *      Author: heber
    66 */
    77
    8 #ifndef QTMENU_HPP_
    9 #define QTMENU_HPP_
     8#ifndef MENUINTERFACEQT_HPP_
     9#define MENUINTERFACEQT_HPP_
    1010
     11#include <Qt/qaction.h>
     12
     13#include <iostream>
    1114#include <list>
    12 
    13 #include <QtGui/QMenu>
    14 #include <QtCore/QObject>
     15#include <map>
     16#include <string>
    1517
    1618#include "Menu/Menu.hpp"
     19#include "Menu/MenuInterface.hpp"
     20#include "Menu/Qt4/QtMenuPipe.hpp"
    1721
    18 class QtMenuPipe;
     22/** QtMenu is a specialization of MenuInterface to Qt-like menus.
     23 * I.e. with this interface we can access QMenu and QMenuBar.
     24 * (The latter is the reason why we have to add this additional wrapping layer).
     25 */
     26template <class T>
     27class QtMenu : virtual public MenuInterface, public Menu
     28{
     29public:
     30  explicit QtMenu(const std::string &_token) :
     31    MenuInterface(_token),
     32    Menu(_token),
     33    MenuInstance(new T(QString(getNameWithAccelerator(_token).c_str()))),
     34    deleteMenu(true)
     35  {}
    1936
    20 class QtMenu : public QMenu, public Menu
    21 {
    22   Q_OBJECT
     37  QtMenu(T *_Menu, const std::string &_token) :
     38    MenuInterface(_token),
     39    Menu(_token),
     40    MenuInstance(_Menu),
     41    deleteMenu(false)
     42  {}
    2343
    24 public:
    25   QtMenu(const char *);
    26   virtual ~QtMenu();
     44  virtual ~QtMenu()
     45  {
     46    for(std::list<QtMenuPipe*>::iterator it=plumbing.begin(); it != plumbing.end(); it++)
     47      delete (*it);
    2748
    28   virtual void addItem(MenuItem*);
    29   virtual void removeItem(MenuItem*);
    30   virtual void display();
     49    if (deleteMenu)
     50      delete MenuInstance;
     51  }
     52
     53  T * const getMenuInstance()
     54  {
     55    return MenuInstance;
     56  }
     57
     58protected:
     59  // We need to have a reference of the Menu, as Qt returns reference to added menu as well
     60  T *MenuInstance;
     61
     62  /** Puts Qt's token, the ampersand, in front of the accelerator char in the menu name.
     63   * \param ActionName Action of menu
     64   * \return name with ampersand added at the right place
     65   */
     66  std::string getNameWithAccelerator(const std::string &ActionName)
     67  {
     68    std::string newname;
     69    bool Inserted = false;
     70    std::pair < MenuShortcutMap::iterator, bool > Inserter;
     71    for (std::string::const_iterator CharRunner = ActionName.begin();
     72        CharRunner != ActionName.end();
     73        ++CharRunner) {
     74      std::cout << "Current char is " << *CharRunner << std::endl;
     75      if (!Inserted) {
     76        Inserter = ShortcutMap.insert(
     77            std::pair<char, std::string > (*CharRunner, ActionName)
     78            );
     79        if (Inserter.second) {
     80          std::cout << "Accelerator is " << *CharRunner << std::endl;
     81          newname += '&';
     82          Inserted = true;
     83        }
     84      }
     85      newname += *CharRunner;
     86    }
     87    return newname;
     88  }
     89
    3190private:
    32   list<QtMenuPipe*> plumbing;
     91  bool deleteMenu;
     92  std::list<QtMenuPipe*> plumbing;
     93
     94  typedef std::map <char, std::string> MenuShortcutMap;
     95  MenuShortcutMap ShortcutMap;
     96
     97  virtual void addActionItem(const std::string &token, const std::string &description)
     98  {
     99    QAction *action = MenuInstance->addAction(QString(getNameWithAccelerator(description).c_str()));
     100    QtMenuPipe *pipe = new QtMenuPipe(token,action);
     101    QObject::connect(action, SIGNAL(triggered()),pipe,SLOT(called()));
     102    plumbing.push_back(pipe);
     103  }
     104
     105  virtual void addSeparatorItem()
     106  {
     107    MenuInstance->addSeparator();
     108  }
     109
     110  virtual void addSubmenuItem(const std::string &token, const std::string &description)
     111  {
     112    QMenu *Menu = MenuInstance->addMenu(QString(token.c_str()));
     113    QtMenu<QMenu> *NewMenu = new QtMenu<QMenu>(Menu, token);
     114    NewMenu->init();
     115  }
     116
    33117};
    34118
    35 // This handles the plumbing from QT to internal Items
    36 // Slots from QT are redirected to internal methods.
    37 // This way methods can be used where no QT is available
    38 class QtMenuPipe : public QObject {
    39   Q_OBJECT
    40 public:
    41   QtMenuPipe(MenuItem*,QAction*);
    42   virtual ~QtMenuPipe();
    43 public slots:
    44   void called();
    45 private:
    46   MenuItem *theItem;
    47   QAction *theAction;
    48 };
    49 
    50 #endif /* QTMENU_HPP_ */
     119#endif /* MENUINTERFACEQT_HPP_ */
  • src/UIElements/Qt4/Pipe/AtomQtQueryPipe.cpp

    rb295ca r41e15b  
    2727
    2828
    29 AtomQtQueryPipe::AtomQtQueryPipe(atom **_content, QtDialog *_dialog, QComboBox *_theBox) :
     29AtomQtQueryPipe::AtomQtQueryPipe(const atom **_content, QtDialog *_dialog, QComboBox *_theBox) :
    3030  content(_content),
    3131  dialog(_dialog),
  • src/UIElements/Qt4/Pipe/AtomsQtQueryPipe.cpp

    rb295ca r41e15b  
    2929
    3030
    31 AtomsQtQueryPipe::AtomsQtQueryPipe(std::vector<atom *>*_content, QtDialog *_dialog, QListWidget *_theList) :
     31AtomsQtQueryPipe::AtomsQtQueryPipe(std::vector<const atom *>*_content, QtDialog *_dialog, QListWidget *_theList) :
    3232  content(_content),
    3333  dialog(_dialog),
     
    4141  // clear target and put all atoms therein
    4242  (*content).clear();
    43   for (std::set<atom *>::iterator iter = currentList.begin(); iter != currentList.end(); ++iter)
     43  for (std::set<const atom *>::iterator iter = currentList.begin(); iter != currentList.end(); ++iter)
    4444    (*content).push_back(*iter);
    4545  dialog->update();
  • src/UIElements/Qt4/Pipe/MoleculeQtQueryPipe.cpp

    rb295ca r41e15b  
    2626
    2727
    28 MoleculeQtQueryPipe::MoleculeQtQueryPipe(molecule **_content, QtDialog *_dialog, QComboBox *_theBox) :
     28MoleculeQtQueryPipe::MoleculeQtQueryPipe(const molecule **_content, QtDialog *_dialog, QComboBox *_theBox) :
    2929  content(_content),
    3030  dialog(_dialog),
  • src/UIElements/Qt4/Pipe/MoleculesQtQueryPipe.cpp

    rb295ca r41e15b  
    2828
    2929
    30 MoleculesQtQueryPipe::MoleculesQtQueryPipe(std::vector<molecule *>*_content, QtDialog *_dialog, QComboBox *_theBox) :
     30MoleculesQtQueryPipe::MoleculesQtQueryPipe(std::vector<const molecule *>*_content, QtDialog *_dialog, QComboBox *_theBox) :
    3131  content(_content),
    3232  dialog(_dialog),
  • src/UIElements/Qt4/QtDialog.hpp

    rb295ca r41e15b  
    445445  Q_OBJECT
    446446public:
    447   AtomQtQueryPipe(atom **_content, QtDialog *_dialog, QComboBox *_theBox);
     447  AtomQtQueryPipe(const atom **_content, QtDialog *_dialog, QComboBox *_theBox);
    448448  virtual ~AtomQtQueryPipe();
    449449
     
    452452
    453453private:
    454   atom **content;
     454  const atom **content;
    455455  QtDialog *dialog;
    456456  QComboBox *theBox;
     
    462462  Q_OBJECT
    463463public:
    464   AtomsQtQueryPipe(std::vector<atom *>*_content, QtDialog *_dialog, QListWidget *_theList);
     464  AtomsQtQueryPipe(std::vector<const atom *>*_content, QtDialog *_dialog, QListWidget *_theList);
    465465  virtual ~AtomsQtQueryPipe();
    466466
     
    471471
    472472private:
    473   std::vector<atom *>*content;
    474   std::map<int, atom *> lookup;
    475   std::set<atom *> currentList;
     473  std::vector<const atom *>*content;
     474  std::map<int, const atom *> lookup;
     475  std::set<const atom *> currentList;
    476476  QtDialog *dialog;
    477477  QListWidget *theList;
     
    482482  Q_OBJECT
    483483public:
    484   MoleculeQtQueryPipe(molecule **_content, QtDialog *_dialog, QComboBox *_theBox);
     484  MoleculeQtQueryPipe(const molecule **_content, QtDialog *_dialog, QComboBox *_theBox);
    485485  virtual ~MoleculeQtQueryPipe();
    486486
     
    489489
    490490private:
    491   molecule **content;
     491  const molecule **content;
    492492  QtDialog *dialog;
    493493  QComboBox *theBox;
     
    498498  Q_OBJECT
    499499public:
    500   MoleculesQtQueryPipe(std::vector<molecule *>*_content, QtDialog *_dialog, QComboBox *_theBox);
     500  MoleculesQtQueryPipe(std::vector<const molecule *>*_content, QtDialog *_dialog, QComboBox *_theBox);
    501501  virtual ~MoleculesQtQueryPipe();
    502502
     
    505505
    506506private:
    507   std::vector<molecule *>*content;
     507  std::vector<const molecule *>*content;
    508508  QtDialog *dialog;
    509509  QComboBox *theBox;
  • src/UIElements/Qt4/QtMainWindow.cpp

    rb295ca r41e15b  
    3838#include "Actions/Action.hpp"
    3939#include "Actions/ActionRegistry.hpp"
    40 #include "Actions/MapOfActions.hpp"
    41 #include "Menu/Menu.hpp"
     40#include "Actions/ValueStorage.hpp"
    4241#include "Menu/Qt4/QtMenu.hpp"
    43 #include "Menu/ActionMenuItem.hpp"
    4442#include "Views/Qt4/QtWorldView.hpp"
    4543#include "Views/Qt4/GLMoleculeView.hpp"
    4644#include "Views/Qt4/QtMoleculeView.hpp"
    4745#include "Views/Qt4/QtStatusBar.hpp"
    48 
    49 using namespace std;
    5046
    5147QtMainWindow::QtMainWindow(QApplication *_theApp) :
     
    6056  molecule3dDisplay = new GLMoleculeView();
    6157
    62   MenuBar = menuBar();
    63 
    64   std::map <std::string, QtMenu *> NametoTextMenuMap;
    65   // go through all menus and create them
    66   QtMenu *Menu = NULL;
    67   for(std::map<std::string, std::pair<std::string,std::string> >::iterator iter = MapOfActions::getInstance().MenuDescription.begin(); iter != MapOfActions::getInstance().MenuDescription.end(); ++iter) {
    68     cout << "Creating menu " << iter->first << endl;
    69     Menu = new QtMenu(iter->first.c_str());
    70     MenuBar->addMenu(Menu);
    71     NametoTextMenuMap.insert( pair <std::string, QtMenu *> (iter->first, Menu) );
    72     //new SubMenuItem(getSuitableShortForm(iter->first),iter->second.first,main_menu,Menu);
    73   }
    74 
    75   // populate all actions
    76   MapOfActions::getInstance().populateActions();
    77 
    78   // go through all actions and add them to its menu
    79   for (std::map <std::string, QtMenu *>::iterator MenuRunner = NametoTextMenuMap.begin(); MenuRunner != NametoTextMenuMap.end(); ++MenuRunner) {
    80     cout << "Creating Action " << MenuRunner->first << " in menu " << MenuRunner->second << endl;
    81     populateMenu(MenuRunner->second, MenuRunner->first);
    82   }
     58  MainMenu = new QtMenu<QMenuBar>(menuBar(), "");
     59  MainMenu->init();
    8360
    8461  setCentralWidget(splitter1);
     
    9875{
    9976  menuBar()->clear();
    100   delete editMoleculesMenu;
    10177}
    10278
     
    10682}
    10783
    108 char QtMainWindow::getSuitableShortForm(set <char> &ShortcutList, const std::string name) const
    109 {
    110   for (std::string::const_iterator CharRunner = name.begin(); CharRunner != name.end(); ++CharRunner) {
    111     if (ShortcutList.find(*CharRunner) == ShortcutList.end())
    112       return *CharRunner;
    113   }
    114   DoeLog(1) && (eLog() << Verbose(1) << "Could not find a suitable shortform for TextWindow::getSuitableShortForm()." << endl);
    115   return ((char)(ShortcutList.size() % 10) + '0');
    116 }
    117 
    118 void QtMainWindow::populateMenu(QtMenu* Menu, const  std::string &MenuName)
    119 {
    120   Action *ActionItem = NULL;
    121   set <char> ShortcutList;
    122   // through all actions for this menu
    123   std::pair < std::multimap <std::string, std::string>::iterator, std::multimap <std::string, std::string>::iterator > MenuActions = MapOfActions::getInstance().MenuContainsActionMap.equal_range(MenuName);
    124   for (std::multimap <std::string, std::string>::const_iterator MenuRunner = MenuActions.first; MenuRunner != MenuActions.second; ++MenuRunner) {
    125     cout << " Adding " << MenuRunner->second << " to submenu " << MenuName << endl;
    126     ActionItem = ActionRegistry::getInstance().getActionByName(MenuRunner->second);
    127     new ActionMenuItem(getSuitableShortForm(ShortcutList, MenuRunner->second),MapOfActions::getInstance().getDescription(MenuRunner->second).c_str(),Menu,ActionItem);
    128   }
    129   // finally add default quit item
    130   //Action *returnFromAction = new TextMenu::LeaveAction(Menu);
    131   //MenuItem *returnFromItem = new ActionMenuItem('q',"return to Main menu",Menu,returnFromAction);
    132   //Menu->addDefault(returnFromItem);
    133 }
  • src/UIElements/Qt4/QtMainWindow.hpp

    rb295ca r41e15b  
    1212#include <QtGui/QMainWindow>
    1313
     14#include <map>
    1415#include <set>
     16
     17#include "Menu/Qt4/QtMenu.hpp"
    1518
    1619class QtWorldView;
    1720class StringView;
    18 class QtMenu;
    1921class GLMoleculeView;
    2022class QtMoleculeView;
     
    3133  virtual void display();
    3234
    33   char getSuitableShortForm(std::set <char> &ShortcutList, const std::string name) const;
    34   void populateMenu(QtMenu* Menu, const  std::string &MenuName);
    3535
    3636private:
     
    3838  QApplication *theApp;
    3939  QtWorldView *worldDisplay;
    40   QtMenu *editMoleculesMenu;
    4140  GLMoleculeView *molecule3dDisplay;
    4241  QtMoleculeView *moleculeDisplay;
    4342  QtStatusBar *statusBar;
    44   QMenuBar *MenuBar;
     43  QtMenu<QMenuBar> *MainMenu;
    4544
    4645};
  • src/UIElements/TextUI/TextWindow.cpp

    rb295ca r41e15b  
    2121
    2222#include <boost/bind.hpp>
     23#include <boost/shared_ptr.hpp>
    2324
    24 #include "Menu/Menu.hpp"
    25 #include "Menu/TextMenu.hpp"
    26 #include "Menu/ActionMenuItem.hpp"
    27 #include "Menu/SeperatorItem.hpp"
    28 #include "Menu/DisplayMenuItem.hpp"
    29 #include "Menu/SubMenuItem.hpp"
     25#include "Menu/TextMenu/TextMenu.hpp"
     26#include "Menu/TextMenu/TxMenu.hpp"
     27#include "Menu/TextMenu/ActionMenuItem.hpp"
     28#include "Menu/TextMenu/SeperatorItem.hpp"
     29#include "Menu/TextMenu/DisplayMenuItem.hpp"
     30#include "Menu/TextMenu/SubMenuItem.hpp"
    3031#include "TextUI/TextStatusIndicator.hpp"
    3132#include "TextUI/TextWindow.hpp"
    32 #include "Actions/MapOfActions.hpp"
    3333#include "Actions/MethodAction.hpp"
    3434#include "Actions/ErrorAction.hpp"
    3535#include "Actions/ActionRegistry.hpp"
     36#include "Actions/ActionTraits.hpp"
    3637#include "Parser/ChangeTracker.hpp"
    3738#include "Views/StreamStringView.hpp"
     
    5556TextWindow::TextWindow()
    5657{
    57   map <std::string, TextMenu *> NametoTextMenuMap;
    58   std::set <char> ShortcutList;
     58  // build the main menu
     59  main_menu = new TextMenu<TxMenu>(std::cout, "");
    5960  // reserve s for save and q for quite
    60   ShortcutList.insert('s');
    61   ShortcutList.insert('q');
    62 
    63   // populate all actions
    64   MapOfActions::getInstance().populateActions();
    65 
    66   // build the main menu
    67   main_menu = new TextMenu(Log() << Verbose(0), "Main Menu");
     61  main_menu->reserveShortcut('s', "output");
     62  main_menu->reserveShortcut('q', "quit");
    6863
    6964  moleculeView = new StreamStringView(boost::bind(&MoleculeListClass::Enumerate,World::getInstance().getMolecules(),_1));
    70   new DisplayMenuItem(main_menu,moleculeView,"Molecule List");
     65  new DisplayMenuItem(main_menu->getMenuInstance(),moleculeView,"Molecule List");
    7166
    72   new SeperatorItem(main_menu);
     67  new SeperatorItem(main_menu->getMenuInstance());
    7368
    74   Action* undoAction = ActionRegistry::getInstance().getActionByName("undo");
    75   new ActionMenuItem(getSuitableShortForm(ShortcutList,"Undo last operation"),"Undo last operation",main_menu,undoAction);
     69  main_menu->init();
    7670
    77   Action* redoAction = ActionRegistry::getInstance().getActionByName("redo");
    78   new ActionMenuItem(getSuitableShortForm(ShortcutList,"Redo last operation"),"Redo last operation",main_menu,redoAction);
    79 
    80   new SeperatorItem(main_menu);
    81 
    82   for(map<std::string, pair<std::string,std::string> >::iterator iter = MapOfActions::getInstance().MenuDescription.begin(); iter != MapOfActions::getInstance().MenuDescription.end(); ++iter) {
    83     TextMenu *Menu = new TextMenu(Log() << Verbose(0), iter->second.second);
    84     NametoTextMenuMap.insert( pair <std::string, TextMenu *> (iter->first, Menu) );
    85     new SubMenuItem(getSuitableShortForm(ShortcutList,iter->first),iter->second.first.c_str(),main_menu,Menu);
    86   }
    87 
    88   new SeperatorItem(main_menu);
     71  new SeperatorItem(main_menu->getMenuInstance());
    8972
    9073  // save has reserved key 's'
    91   Action *saveConfigAction = ActionRegistry::getInstance().getActionByName("output");
    92   new ActionMenuItem('s',"save current setup to config files",main_menu,saveConfigAction);
     74//  Action *saveConfigAction = ActionRegistry::getInstance().getActionByName("output");
     75  new ActionMenuItem('s',"save current setup to config files",main_menu->getMenuInstance(),"output");
    9376
    94   quitAction = new MethodAction("quitAction",boost::bind(&TextMenu::doQuit,main_menu),false);
    95   new ActionMenuItem('q',"quit",main_menu,quitAction);
    96 
    97   // quit has reserved key 'q'
    98   // go through all menus and create them
    99   for (map <std::string, TextMenu *>::iterator MenuRunner = NametoTextMenuMap.begin(); MenuRunner != NametoTextMenuMap.end(); ++MenuRunner)
    100     populateMenu(MenuRunner->second, MenuRunner->first);
     77  // create a specific quit action for this UI and store in registry
     78  ActionTraits quitTrait(OptionTrait("quit", &typeid(void), "quits the program"));
     79  quitAction = new MethodAction(quitTrait,boost::bind(&TxMenu::doQuit,main_menu->getMenuInstance()),true);
     80  new ActionMenuItem('q',"quit",main_menu->getMenuInstance(),"quit");
    10181
    10282  // Add status indicators etc...
    103 
    10483  statusIndicator = new TextStatusIndicator();
    10584}
     
    10786TextWindow::~TextWindow()
    10887{
    109   delete quitAction;
     88  for (std::list<Action *>::iterator iter = returnFromActions.begin(); !returnFromActions.empty(); ++iter)
     89    delete (*iter);
     90  returnFromActions.clear();
    11091  delete moleculeView;
    11192  delete statusIndicator;
     
    11798}
    11899
    119 char TextWindow::getSuitableShortForm(std::set <char> &ShortcutList, const std::string name) const
    120 {
    121   for (std::string::const_iterator CharRunner = name.begin(); CharRunner != name.end(); ++CharRunner) {
    122     if (ShortcutList.find(*CharRunner) == ShortcutList.end()) {
    123       ShortcutList.insert(*CharRunner);
    124       return *CharRunner;
    125     }
    126   }
    127   // if no letter matches, take digits
    128   int i=0;
    129   for (;i<10;++i) {
    130     if (ShortcutList.find((char)i + '0') == ShortcutList.end())
    131       break;
    132   }
    133   if (i != 10) {
    134     ShortcutList.insert((char)i + '0');
    135     return ((char)i + '0');
    136   } else {
    137     DoeLog(1) && (eLog() << Verbose(1) << "Could not find a suitable shortform for " << name << "." << endl);
    138     return '#';
    139   }
    140 }
    141 
    142 void TextWindow::populateMenu(TextMenu* Menu, const  std::string &MenuName)
    143 {
    144   Action *ActionItem = NULL;
    145   set <char> ShortcutList;
    146   // reserve 'q' for quit
    147   ShortcutList.insert('q');
    148   // through all actions for this menu
    149   pair < multimap <std::string, std::string>::iterator, multimap <std::string, std::string>::iterator > MenuActions = MapOfActions::getInstance().MenuContainsActionMap.equal_range(MenuName);
    150   for (multimap <std::string, std::string>::const_iterator MenuRunner = MenuActions.first; MenuRunner != MenuActions.second; ++MenuRunner) {
    151     ActionItem = ActionRegistry::getInstance().getActionByName(MenuRunner->second);
    152     new ActionMenuItem(getSuitableShortForm(ShortcutList, MenuRunner->second),MapOfActions::getInstance().getDescription(MenuRunner->second).c_str(),Menu,ActionItem);
    153   }
    154   // finally add default quit item
    155   Action *returnFromAction = new TextMenu::LeaveAction(Menu);
    156   MenuItem *returnFromItem = new ActionMenuItem('q',"return to Main menu",Menu,returnFromAction);
    157   Menu->addDefault(returnFromItem);
    158 }
  • src/UIElements/TextUI/TextWindow.hpp

    rb295ca r41e15b  
    1414#include <set>
    1515
    16 class TextMenu;
     16#include "Menu/TextMenu/TextMenu.hpp"
     17
    1718class Action;
    1819class StringView;
    1920class TextStatusIndicator;
     21class TxMenu;
    2022
    2123
     
    2931
    3032private:
    31   // populaters
    32   char getSuitableShortForm(std::set <char> &ShortcutList, const std::string name) const;
    33   void populateMenu(TextMenu* Menu, const std::string &name);
    34 
    35   TextMenu *main_menu;
     33  TextMenu<TxMenu> *main_menu;
    3634
    3735  // some actions only needed in textMenus
     36  std::list<Action *> returnFromActions;
    3837  Action *quitAction;
    3938  // all views that are contained in the main Menu
  • src/World.cpp

    rb295ca r41e15b  
    3434#include "Descriptors/MoleculeDescriptor_impl.hpp"
    3535#include "Descriptors/SelectiveIterator_impl.hpp"
     36#include "Actions/ActionTraits.hpp"
    3637#include "Actions/ManipulateAtomsProcess.hpp"
    3738#include "Helpers/Assert.hpp"
     
    245246
    246247ManipulateAtomsProcess* World::manipulateAtoms(boost::function<void(atom*)> op,std::string name,AtomDescriptor descr){
    247   return new ManipulateAtomsProcess(op, descr,name,true);
     248  ActionTraits manipulateTrait(name);
     249  return new ManipulateAtomsProcess(op, descr,manipulateTrait,false);
    248250}
    249251
     
    535537}
    536538
    537 void World::selectAtom(atom *atom){
    538   ASSERT(atom,"Invalid pointer in selection of atom");
    539   selectedAtoms[atom->getId()]=atom;
    540 }
    541 
    542 void World::selectAtom(atomId_t id){
     539void World::selectAtom(const atom *_atom){
     540  // atom * is unchanged in this function, but we do store entity as changeable
     541  ASSERT(_atom,"Invalid pointer in selection of atom");
     542  selectedAtoms[_atom->getId()]=const_cast<atom *>(_atom);
     543}
     544
     545void World::selectAtom(const atomId_t id){
    543546  ASSERT(atoms.count(id),"Atom Id selected that was not in the world");
    544547  selectedAtoms[id]=atoms[id];
     
    548551  internal_AtomIterator begin = getAtomIter_internal(descr);
    549552  internal_AtomIterator end = atomEnd_internal();
    550   void (World::*func)(atom*) = &World::selectAtom; // needed for type resolution of overloaded function
     553  void (World::*func)(const atom*) = &World::selectAtom; // needed for type resolution of overloaded function
    551554  for_each(begin,end,bind1st(mem_fun(func),this)); // func is select... see above
    552555}
    553556
    554 void World::selectAtomsOfMolecule(molecule *_mol){
     557void World::selectAtomsOfMolecule(const molecule *_mol){
    555558  ASSERT(_mol,"Invalid pointer to molecule in selection of Atoms of Molecule");
    556559  // need to make it const to get the fast iterators
    557560  const molecule *mol = _mol;
    558   void (World::*func)(atom*) = &World::selectAtom; // needed for type resolution of overloaded function
     561  void (World::*func)(const atom*) = &World::selectAtom; // needed for type resolution of overloaded function
    559562  for_each(mol->begin(),mol->end(),bind1st(mem_fun(func),this)); // func is select... see above
    560563}
    561564
    562 void World::selectAtomsOfMolecule(moleculeId_t id){
     565void World::selectAtomsOfMolecule(const moleculeId_t id){
    563566  ASSERT(molecules.count(id),"No molecule with the given id upon Selection of atoms from molecule");
    564567  selectAtomsOfMolecule(molecules[id]);
    565568}
    566569
    567 void World::unselectAtom(atom *atom){
    568   ASSERT(atom,"Invalid pointer in unselection of atom");
    569   unselectAtom(atom->getId());
    570 }
    571 
    572 void World::unselectAtom(atomId_t id){
     570void World::unselectAtom(const atom *_atom){
     571  ASSERT(_atom,"Invalid pointer in unselection of atom");
     572  unselectAtom(_atom->getId());
     573}
     574
     575void World::unselectAtom(const atomId_t id){
    573576  ASSERT(atoms.count(id),"Atom Id unselected that was not in the world");
    574577  selectedAtoms.erase(id);
     
    578581  internal_AtomIterator begin = getAtomIter_internal(descr);
    579582  internal_AtomIterator end = atomEnd_internal();
    580   void (World::*func)(atom*) = &World::unselectAtom; // needed for type resolution of overloaded function
     583  void (World::*func)(const atom*) = &World::unselectAtom; // needed for type resolution of overloaded function
    581584  for_each(begin,end,bind1st(mem_fun(func),this)); // func is unselect... see above
    582585}
    583586
    584 void World::unselectAtomsOfMolecule(molecule *_mol){
     587void World::unselectAtomsOfMolecule(const molecule *_mol){
    585588  ASSERT(_mol,"Invalid pointer to molecule in selection of Atoms of Molecule");
    586589  // need to make it const to get the fast iterators
    587590  const molecule *mol = _mol;
    588   void (World::*func)(atom*) = &World::unselectAtom; // needed for type resolution of overloaded function
     591  void (World::*func)(const atom*) = &World::unselectAtom; // needed for type resolution of overloaded function
    589592  for_each(mol->begin(),mol->end(),bind1st(mem_fun(func),this)); // func is unsselect... see above
    590593}
    591594
    592 void World::unselectAtomsOfMolecule(moleculeId_t id){
     595void World::unselectAtomsOfMolecule(const moleculeId_t id){
    593596  ASSERT(molecules.count(id),"No molecule with the given id upon Selection of atoms from molecule");
    594597  unselectAtomsOfMolecule(molecules[id]);
     
    602605}
    603606
    604 bool World::isSelected(atom *atom) const {
    605   return selectedAtoms.find(atom->getId()) != selectedAtoms.end();
     607bool World::isSelected(const atom *_atom) const {
     608  return selectedAtoms.find(_atom->getId()) != selectedAtoms.end();
    606609}
    607610
     
    622625}
    623626
    624 void World::selectMolecule(molecule *mol){
    625   ASSERT(mol,"Invalid pointer to molecule in selection");
    626   selectedMolecules[mol->getId()]=mol;
    627 }
    628 
    629 void World::selectMolecule(moleculeId_t id){
     627void World::selectMolecule(const molecule *_mol){
     628  // molecule * is unchanged in this function, but we do store entity as changeable
     629  ASSERT(_mol,"Invalid pointer to molecule in selection");
     630  selectedMolecules[_mol->getId()]=const_cast<molecule *>(_mol);
     631}
     632
     633void World::selectMolecule(const moleculeId_t id){
    630634  ASSERT(molecules.count(id),"Molecule Id selected that was not in the world");
    631635  selectedMolecules[id]=molecules[id];
     
    635639  internal_MoleculeIterator begin = getMoleculeIter_internal(descr);
    636640  internal_MoleculeIterator end = moleculeEnd_internal();
    637   void (World::*func)(molecule*) = &World::selectMolecule; // needed for type resolution of overloaded function
     641  void (World::*func)(const molecule*) = &World::selectMolecule; // needed for type resolution of overloaded function
    638642  for_each(begin,end,bind1st(mem_fun(func),this)); // func is select... see above
    639643}
    640644
    641 void World::selectMoleculeOfAtom(atom *atom){
    642   ASSERT(atom,"Invalid atom pointer in selection of MoleculeOfAtom");
    643   molecule *mol=atom->getMolecule();
     645void World::selectMoleculeOfAtom(const atom *_atom){
     646  ASSERT(_atom,"Invalid atom pointer in selection of MoleculeOfAtom");
     647  molecule *mol=_atom->getMolecule();
    644648  // the atom might not be part of a molecule
    645649  if(mol){
     
    648652}
    649653
    650 void World::selectMoleculeOfAtom(atomId_t id){
     654void World::selectMoleculeOfAtom(const atomId_t id){
    651655  ASSERT(atoms.count(id),"No such atom with given ID in selection of Molecules of Atom");\
    652656  selectMoleculeOfAtom(atoms[id]);
    653657}
    654658
    655 void World::unselectMolecule(molecule *mol){
    656   ASSERT(mol,"invalid pointer in unselection of molecule");
    657   unselectMolecule(mol->getId());
    658 }
    659 
    660 void World::unselectMolecule(moleculeId_t id){
     659void World::unselectMolecule(const molecule *_mol){
     660  ASSERT(_mol,"invalid pointer in unselection of molecule");
     661  unselectMolecule(_mol->getId());
     662}
     663
     664void World::unselectMolecule(const moleculeId_t id){
    661665  ASSERT(molecules.count(id),"No such molecule with ID in unselection");
    662666  selectedMolecules.erase(id);
     
    666670  internal_MoleculeIterator begin = getMoleculeIter_internal(descr);
    667671  internal_MoleculeIterator end = moleculeEnd_internal();
    668   void (World::*func)(molecule*) = &World::unselectMolecule; // needed for type resolution of overloaded function
     672  void (World::*func)(const molecule*) = &World::unselectMolecule; // needed for type resolution of overloaded function
    669673  for_each(begin,end,bind1st(mem_fun(func),this)); // func is unselect... see above
    670674}
    671675
    672 void World::unselectMoleculeOfAtom(atom *atom){
    673   ASSERT(atom,"Invalid atom pointer in selection of MoleculeOfAtom");
    674   molecule *mol=atom->getMolecule();
     676void World::unselectMoleculeOfAtom(const atom *_atom){
     677  ASSERT(_atom,"Invalid atom pointer in selection of MoleculeOfAtom");
     678  molecule *mol=_atom->getMolecule();
    675679  // the atom might not be part of a molecule
    676680  if(mol){
     
    679683}
    680684
    681 void World::unselectMoleculeOfAtom(atomId_t id){
     685void World::unselectMoleculeOfAtom(const atomId_t id){
    682686  ASSERT(atoms.count(id),"No such atom with given ID in selection of Molecules of Atom");\
    683687  unselectMoleculeOfAtom(atoms[id]);
     
    691695}
    692696
    693 bool World::isSelected(molecule *mol) const {
    694   return selectedMolecules.find(mol->getId()) != selectedMolecules.end();
     697bool World::isSelected(const molecule *_mol) const {
     698  return selectedMolecules.find(_mol->getId()) != selectedMolecules.end();
    695699}
    696700
  • src/World.hpp

    rb295ca r41e15b  
    1919
    2020#include "types.hpp"
     21#include "Actions/ActionTraits.hpp"
    2122#include "Descriptors/SelectiveIterator.hpp"
    2223#include "Patterns/Observer.hpp"
     
    111112   * menus, be kept around for later use etc.
    112113   */
    113   template<typename T> AtomsCalculation<T>* calcOnAtoms(boost::function<T(atom*)>,std::string,AtomDescriptor);
    114   template<typename T> AtomsCalculation<T>* calcOnAtoms(boost::function<T(atom*)>,std::string);
     114  template<typename T> AtomsCalculation<T>* calcOnAtoms(boost::function<T(atom*)>,const ActionTraits &_trait,AtomDescriptor);
     115  template<typename T> AtomsCalculation<T>* calcOnAtoms(boost::function<T(atom*)>,const ActionTraits &_trait);
    115116
    116117  /**
     
    269270  /******** Selections of molecules and Atoms *************/
    270271  void clearAtomSelection();
    271   void selectAtom(atom*);
    272   void selectAtom(atomId_t);
     272  void selectAtom(const atom*);
     273  void selectAtom(const atomId_t);
    273274  void selectAllAtoms(AtomDescriptor);
    274   void selectAtomsOfMolecule(molecule*);
    275   void selectAtomsOfMolecule(moleculeId_t);
    276   void unselectAtom(atom*);
    277   void unselectAtom(atomId_t);
     275  void selectAtomsOfMolecule(const molecule*);
     276  void selectAtomsOfMolecule(const moleculeId_t);
     277  void unselectAtom(const atom*);
     278  void unselectAtom(const atomId_t);
    278279  void unselectAllAtoms(AtomDescriptor);
    279   void unselectAtomsOfMolecule(molecule*);
    280   void unselectAtomsOfMolecule(moleculeId_t);
     280  void unselectAtomsOfMolecule(const molecule*);
     281  void unselectAtomsOfMolecule(const moleculeId_t);
    281282  size_t countSelectedAtoms() const;
    282   bool isSelected(atom *_atom) const;
     283  bool isSelected(const atom *_atom) const;
    283284  const std::vector<atom *> getSelectedAtoms() const;
    284285
    285286  void clearMoleculeSelection();
    286   void selectMolecule(molecule*);
    287   void selectMolecule(moleculeId_t);
     287  void selectMolecule(const molecule*);
     288  void selectMolecule(const moleculeId_t);
    288289  void selectAllMolecules(MoleculeDescriptor);
    289   void selectMoleculeOfAtom(atom*);
    290   void selectMoleculeOfAtom(atomId_t);
    291   void unselectMolecule(molecule*);
    292   void unselectMolecule(moleculeId_t);
     290  void selectMoleculeOfAtom(const atom*);
     291  void selectMoleculeOfAtom(const atomId_t);
     292  void unselectMolecule(const molecule*);
     293  void unselectMolecule(const moleculeId_t);
    293294  void unselectAllMolecules(MoleculeDescriptor);
    294   void unselectMoleculeOfAtom(atom*);
    295   void unselectMoleculeOfAtom(atomId_t);
     295  void unselectMoleculeOfAtom(const atom*);
     296  void unselectMoleculeOfAtom(const atomId_t);
    296297  size_t countSelectedMolecules() const;
    297   bool isSelected(molecule *_mol) const;
     298  bool isSelected(const molecule *_mol) const;
    298299  const std::vector<molecule *> getSelectedMolecules() const;
    299300
  • src/World_calculations.hpp

    rb295ca r41e15b  
    1414
    1515template<typename T>
    16 AtomsCalculation<T>* World::calcOnAtoms(boost::function<T(atom*)> op,std::string name,AtomDescriptor descr){
    17   return new AtomsCalculation<T>(op,name,descr);
     16AtomsCalculation<T>* World::calcOnAtoms(boost::function<T(atom*)> op,const ActionTraits &_trait,AtomDescriptor descr){
     17  return new AtomsCalculation<T>(op,_trait,descr);
    1818}
    1919
    2020template<typename T>
    21 AtomsCalculation<T>* World::calcOnAtoms(boost::function<T(atom*)> op,std::string name) {
    22   return calcOnAtoms<T>(op,name,AllAtoms());
     21AtomsCalculation<T>* World::calcOnAtoms(boost::function<T(atom*)> op,const ActionTraits &_trait) {
     22  return calcOnAtoms<T>(op,_trait,AllAtoms());
    2323}
    2424
  • src/builder.cpp

    rb295ca r41e15b  
    7676
    7777#include "bondgraph.hpp"
    78 #include "CommandLineParser.hpp"
    7978#include "config.hpp"
    8079#include "Helpers/Log.hpp"
     
    8584#include "UIElements/TextUI/TextUIFactory.hpp"
    8685#include "UIElements/CommandLineUI/CommandLineUIFactory.hpp"
     86#include "UIElements/CommandLineUI/CommandLineParser.hpp"
    8787#ifdef USE_GUI_QT
    8888#include "UIElements/Qt4/QtUIFactory.hpp"
     
    9090#include "UIElements/MainWindow.hpp"
    9191#include "UIElements/Dialog.hpp"
    92 #include "Menu/ActionMenuItem.hpp"
     92//#include "Menu/ActionMenuItem.hpp"
    9393#include "Helpers/Verbose.hpp"
    9494#include "World.hpp"
     
    9696#include "Actions/ActionRegistry.hpp"
    9797#include "Actions/ActionHistory.hpp"
    98 #include "Actions/MapOfActions.hpp"
    9998
    10099#include "Parser/ChangeTracker.hpp"
     
    119118  errorLogger::purgeInstance();
    120119  UIFactory::purgeInstance();
    121   MapOfActions::purgeInstance();
     120  ValueStorage::purgeInstance();
    122121  CommandLineParser::purgeInstance();
    123122  ActionRegistry::purgeInstance();
     123  OptionRegistry::purgeInstance();
    124124  ActionHistory::purgeInstance();
    125125#ifdef LOG_OBSERVER
     
    174174    // handle remaining arguments by CommandLineParser
    175175    if (argc>1) {
    176       MapOfActions::getInstance().AddOptionsToParser();
    177       map <std::string, std::string> ShortFormToActionMap = MapOfActions::getInstance().getShortFormToActionMap();
    178       CommandLineParser::getInstance().Run(argc,argv, ShortFormToActionMap);
     176      CommandLineParser::getInstance().InitializeCommandArguments();
     177      CommandLineParser::getInstance().Run(argc,argv);
    179178      DoLog(0) && (Log() << Verbose(0) << "Setting UI to CommandLine." << endl);
    180179      UIFactory::registerFactory(new CommandLineUIFactory::description());
  • src/molecule.cpp

    rb295ca r41e15b  
    640640 * \return copy of molecule
    641641 */
    642 molecule *molecule::CopyMolecule()
     642molecule *molecule::CopyMolecule() const
    643643{
    644644  molecule *copy = World::getInstance().createMolecule();
     
    648648
    649649  // copy all bonds
    650   for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
    651     for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
     650  for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
     651    for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
    652652      if ((*BondRunner)->leftatom == *AtomRunner) {
    653653        bond *Binder = (*BondRunner);
     
    874874 * \param *out output stream
    875875 */
    876 bool molecule::Output(ostream * const output)
     876bool molecule::Output(ostream * const output) const
    877877{
    878878  if (output == NULL) {
     
    891891 * \param *out output stream
    892892 */
    893 bool molecule::OutputTrajectories(ofstream * const output)
     893bool molecule::OutputTrajectories(ofstream * const output) const
    894894{
    895895  if (output == NULL) {
  • src/molecule.hpp

    rb295ca r41e15b  
    6666struct EvaluatePotential
    6767{
    68   int startstep;              //!< start configuration (MDStep in atom::trajectory)
    69   int endstep;                //!< end configuration (MDStep in atom::trajectory)
    70   atom **PermutationMap;      //!< gives target ptr for each atom, array of size molecule::AtomCount (this is "x" in \f$ V^{con}(x) \f$ )
     68  int startstep; //!< start configuration (MDStep in atom::trajectory)
     69  int endstep; //!< end configuration (MDStep in atom::trajectory)
     70  atom **PermutationMap; //!< gives target ptr for each atom, array of size molecule::AtomCount (this is "x" in \f$ V^{con}(x) \f$ )
    7171  DistanceMap **DistanceList; //!< distance list of each atom to each atom
    7272  DistanceMap::iterator *StepList; //!< iterator to ascend through NearestNeighbours \a **DistanceList
    73   int *DoubleList;            //!< count of which sources want to move to this target, basically the injective measure (>1 -> not injective)
     73  int *DoubleList; //!< count of which sources want to move to this target, basically the injective measure (>1 -> not injective)
    7474  DistanceMap::iterator *DistanceIterators; //!< marks which was the last picked target as injective candidate with smallest distance
    75   bool IsAngstroem;           //!< whether coordinates are in angstroem (true) or bohrradius (false)
    76   double *PenaltyConstants;   //!<  penalty constant in front of each term
     75  bool IsAngstroem; //!< whether coordinates are in angstroem (true) or bohrradius (false)
     76  double *PenaltyConstants; //!<  penalty constant in front of each term
    7777};
    7878
     
    8080 * Class incorporates number of types
    8181 */
    82 class molecule : public PointCloud , public Observable {
     82class molecule : public PointCloud, public Observable
     83{
    8384  friend molecule *NewMolecule();
    8485  friend void DeleteMolecule(molecule *);
    8586
    86   public:
    87     typedef ATOMSET(std::list) atomSet;
    88     typedef std::set<atomId_t> atomIdSet;
    89     typedef ObservedIterator<atomSet> iterator;
    90     typedef atomSet::const_iterator const_iterator;
    91 
    92     const periodentafel * const elemente; //!< periodic table with each element
    93     // old deprecated atom handling
    94     //atom *start;        //!< start of atom list
    95     //atom *end;          //!< end of atom list
    96     //bond *first;        //!< start of bond list
    97     //bond *last;         //!< end of bond list
    98     int MDSteps;        //!< The number of MD steps in Trajectories
    99     //int AtomCount;          //!< number of atoms, brought up-to-date by CountAtoms()
    100     int BondCount;          //!< number of atoms, brought up-to-date by CountBonds()
    101     mutable int NoNonHydrogen; //!< number of non-hydrogen atoms in molecule
    102     mutable int NoNonBonds;    //!< number of non-hydrogen bonds in molecule
    103     mutable int NoCyclicBonds; //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis()
    104     double BondDistance; //!< typical bond distance used in CreateAdjacencyList() and furtheron
    105     bool ActiveFlag;    //!< in a MoleculeListClass used to discern active from inactive molecules
    106     //Vector Center;      //!< Center of molecule in a global box
    107     int IndexNr;        //!< index of molecule in a MoleculeListClass
    108     char name[MAXSTRINGSIZE];        //!< arbitrary name
    109 
    110   private:
    111     Formula formula;
    112     Cacheable<int>    AtomCount;
    113     moleculeId_t id;
    114     atomSet atoms; //<!list of atoms
    115     atomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms
    116   protected:
    117     //void CountAtoms();
    118     /**
    119      * this iterator type should be used for internal variables, \
     87public:
     88  typedef ATOMSET(std::list) atomSet;
     89  typedef std::set<atomId_t> atomIdSet;
     90  typedef ObservedIterator<atomSet> iterator;
     91  typedef atomSet::const_iterator const_iterator;
     92
     93  const periodentafel * const elemente; //!< periodic table with each element
     94  // old deprecated atom handling
     95  //atom *start;        //!< start of atom list
     96  //atom *end;          //!< end of atom list
     97  //bond *first;        //!< start of bond list
     98  //bond *last;         //!< end of bond list
     99  int MDSteps; //!< The number of MD steps in Trajectories
     100  //int AtomCount;          //!< number of atoms, brought up-to-date by CountAtoms()
     101  int BondCount; //!< number of atoms, brought up-to-date by CountBonds()
     102  mutable int NoNonHydrogen; //!< number of non-hydrogen atoms in molecule
     103  mutable int NoNonBonds; //!< number of non-hydrogen bonds in molecule
     104  mutable int NoCyclicBonds; //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis()
     105  double BondDistance; //!< typical bond distance used in CreateAdjacencyList() and furtheron
     106  bool ActiveFlag; //!< in a MoleculeListClass used to discern active from inactive molecules
     107  //Vector Center;      //!< Center of molecule in a global box
     108  int IndexNr; //!< index of molecule in a MoleculeListClass
     109  char name[MAXSTRINGSIZE]; //!< arbitrary name
     110
     111private:
     112  Formula formula;
     113  Cacheable<int> AtomCount;
     114  moleculeId_t id;
     115  atomSet atoms; //<!list of atoms
     116  atomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms
     117protected:
     118  //void CountAtoms();
     119  /**
     120   * this iterator type should be used for internal variables, \
    120121     * since it will not lock
    121      */
    122     typedef atomSet::iterator internal_iterator;
    123 
    124 
    125     molecule(const periodentafel * const teil);
    126     virtual ~molecule();
    127 
     122   */
     123  typedef atomSet::iterator internal_iterator;
     124
     125  molecule(const periodentafel * const teil);
     126  virtual ~molecule();
    128127
    129128public:
     
    151150  bool empty() const;
    152151  size_t size() const;
    153   const_iterator erase( const_iterator loc );
    154   const_iterator erase( atom * key );
    155   const_iterator find (  atom * key ) const;
    156   pair<iterator,bool> insert ( atom * const key );
     152  const_iterator erase(const_iterator loc);
     153  const_iterator erase(atom * key);
     154  const_iterator find(atom * key) const;
     155  pair<iterator, bool> insert(atom * const key);
    157156  bool containsAtom(atom* key);
    158 
    159157
    160158  // re-definition of virtual functions from PointCloud
    161159  const char * const GetName() const;
    162   Vector *GetCenter() const ;
    163   TesselPoint *GetPoint() const ;
     160  Vector *GetCenter() const;
     161  TesselPoint *GetPoint() const;
    164162  int GetMaxId() const;
    165   void GoToNext() const ;
    166   void GoToFirst() const ;
    167   bool IsEmpty() const ;
    168   bool IsEnd() const ;
     163  void GoToNext() const;
     164  void GoToFirst() const;
     165  bool IsEmpty() const;
     166  bool IsEnd() const;
    169167
    170168  /// remove atoms from molecule.
     
    181179  bool RemoveBond(bond *pointer);
    182180  bool RemoveBonds(atom *BondPartner);
    183   bool hasBondStructure();
     181  bool hasBondStructure() const;
    184182  unsigned int CountBonds() const;
    185183
     
    213211  double MinimiseConstrainedPotential(atom **&permutation, int startstep, int endstep, bool IsAngstroem);
    214212  void EvaluateConstrainedForces(int startstep, int endstep, atom **PermutationMap, ForceMatrix *Force);
    215   bool LinearInterpolationBetweenConfiguration(int startstep, int endstep, std::string &prefix, config &configuration, bool MapByIdentity);
    216        
     213  bool LinearInterpolationBetweenConfiguration(int startstep, int endstep, std::string prefix, config &configuration, bool MapByIdentity);
     214
    217215  bool CheckBounds(const Vector *x) const;
    218216  void GetAlignvector(struct lsq_params * par) const;
     
    220218  /// Initialising routines in fragmentation
    221219  void CreateAdjacencyListFromDbondFile(ifstream *output);
    222   void CreateAdjacencyList(double bonddistance, bool IsAngstroem, void (BondGraph::*f)(BondedParticle * const , BondedParticle * const , double &, double &, bool), BondGraph *BG = NULL);
     220  void CreateAdjacencyList(double bonddistance, bool IsAngstroem, void(BondGraph::*f)(BondedParticle * const , BondedParticle * const , double &, double &, bool), BondGraph *BG = NULL);
    223221  int CorrectBondDegree() const;
    224222  void OutputBondsList() const;
     
    226224  void OutputGraphInfoPerAtom() const;
    227225  void OutputGraphInfoPerBond() const;
    228 
    229226
    230227  // Graph analysis
     
    240237  bond * CopyBond(atom *left, atom *right, bond *CopyBond);
    241238
    242 
    243   molecule *CopyMolecule();
     239  molecule *CopyMolecule() const;
    244240  molecule* CopyMoleculeFromSubRegion(const Shape&) const;
    245241
     
    247243  int FragmentMolecule(int Order, std::string &prefix);
    248244  bool CheckOrderAtSite(bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, std::string path = "");
    249   bool StoreBondsToFile(std::string &filename, std::string path = "");
    250   bool StoreAdjacencyToFile(std::string &filename, std::string path = "");
     245  bool StoreBondsToFile(std::string filename, std::string path = "");
     246  bool StoreAdjacencyToFile(std::string filename, std::string path = "");
    251247  bool CheckAdjacencyFileAgainstMolecule(std::string &path, atom **ListOfAtoms);
    252248  bool ParseOrderAtSiteFromFile(std::string &path);
     
    269265
    270266  // Output routines.
    271   bool Output(std::ostream * const output);
    272   bool OutputTrajectories(ofstream * const output);
     267  bool Output(std::ostream * const output) const;
     268  bool OutputTrajectories(ofstream * const output) const;
    273269  void OutputListOfBonds() const;
    274270  bool OutputXYZ(ofstream * const output) const;
     
    280276  void flipActiveFlag();
    281277
    282   private:
     278private:
    283279  void init_DFS(struct DFSAccounting&) const;
    284   int last_atom;      //!< number given to last atom
    285   mutable internal_iterator InternalPointer;  //!< internal pointer for PointCloud
     280  int last_atom; //!< number given to last atom
     281  mutable internal_iterator InternalPointer; //!< internal pointer for PointCloud
    286282};
    287283
     
    291287/** A list of \a molecule classes.
    292288 */
    293 class MoleculeListClass : public Observable {
    294   public:
    295     MoleculeList ListOfMolecules; //!< List of the contained molecules
    296     int MaxIndex;
     289class MoleculeListClass : public Observable
     290{
     291public:
     292  MoleculeList ListOfMolecules; //!< List of the contained molecules
     293  int MaxIndex;
    297294
    298295  MoleculeListClass(World *world);
     
    318315  void eraseMolecule();
    319316
    320   private:
     317private:
    321318  World *world; //!< The world this List belongs to. Needed to avoid deadlocks in the destructor
    322319};
    323320
    324 
    325321/** A leaf for a tree of \a molecule class
    326322 * Wraps molecules in a tree structure
    327323 */
    328 class MoleculeLeafClass {
    329   public:
    330     molecule *Leaf;                   //!< molecule of this leaf
    331     //MoleculeLeafClass *UpLeaf;        //!< Leaf one level up
    332     //MoleculeLeafClass *DownLeaf;      //!< First leaf one level down
    333     MoleculeLeafClass *previous;  //!< Previous leaf on this level
    334     MoleculeLeafClass *next;      //!< Next leaf on this level
     324class MoleculeLeafClass
     325{
     326public:
     327  molecule *Leaf; //!< molecule of this leaf
     328  //MoleculeLeafClass *UpLeaf;        //!< Leaf one level up
     329  //MoleculeLeafClass *DownLeaf;      //!< First leaf one level down
     330  MoleculeLeafClass *previous; //!< Previous leaf on this level
     331  MoleculeLeafClass *next; //!< Next leaf on this level
    335332
    336333  //MoleculeLeafClass(MoleculeLeafClass *Up, MoleculeLeafClass *Previous);
     
    347344};
    348345
    349 
    350346#endif /*MOLECULES_HPP_*/
    351347
  • src/molecule_dynamics.cpp

    rb295ca r41e15b  
    498498 * \return true - success in writing step files, false - error writing files or only one step in molecule::Trajectories
    499499 */
    500 bool molecule::LinearInterpolationBetweenConfiguration(int startstep, int endstep, std::string &prefix, config &configuration, bool MapByIdentity)
     500bool molecule::LinearInterpolationBetweenConfiguration(int startstep, int endstep, std::string prefix, config &configuration, bool MapByIdentity)
    501501{
    502502  // TODO: rewrite permutationMaps using enumeration objects
  • src/molecule_graph.cpp

    rb295ca r41e15b  
    233233 * \return true - bonds present, false - no bonds
    234234 */
    235 bool molecule::hasBondStructure()
    236 {
    237   for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
     235bool molecule::hasBondStructure() const
     236{
     237  for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
    238238    if (!(*AtomRunner)->ListOfBonds.empty())
    239239      return true;
     
    10561056 * \return true - file written successfully, false - writing failed
    10571057 */
    1058 bool molecule::StoreAdjacencyToFile(std::string &filename, std::string path)
     1058bool molecule::StoreAdjacencyToFile(std::string filename, std::string path)
    10591059{
    10601060  ofstream AdjacencyFile;
     
    10881088 * \return true - file written successfully, false - writing failed
    10891089 */
    1090 bool molecule::StoreBondsToFile(std::string &filename, std::string path)
     1090bool molecule::StoreBondsToFile(std::string filename, std::string path)
    10911091{
    10921092  ofstream BondFile;
  • src/unittests/ActionSequenceTest.cpp

    rb295ca r41e15b  
    4444{
    4545public:
    46   canUndoActionStub(): Action("canUndoActionStub",false){}
     46  canUndoActionStub(const ActionTraits &_trait):
     47    Action(_trait,false){}
    4748  virtual ~canUndoActionStub(){}
    4849
     
    7576{
    7677public:
    77   cannotUndoActionStub() : Action("cannotUndoActionStub",false){}
     78  cannotUndoActionStub(const ActionTraits &_trait) :
     79    Action(_trait,false){}
    7880  virtual ~cannotUndoActionStub(){}
    7981
     
    106108{
    107109public:
    108   wasCalledActionStub() :
    109       Action("wasCalledActionStub",false),
     110  wasCalledActionStub(const ActionTraits &_trait) :
     111      Action(_trait,false),
    110112      called(false)
    111113  {}
     
    153155  UIFactory::makeUserInterface("Dummy");
    154156  // create some necessary stubs used in this test
    155   positive1 = new canUndoActionStub();
    156   positive2 = new canUndoActionStub();
    157   negative1 = new cannotUndoActionStub();
    158   negative2 = new cannotUndoActionStub();
    159 
    160   shouldCall1 = new wasCalledActionStub();
    161   shouldCall2 = new wasCalledActionStub();
    162   shouldNotCall1 = new wasCalledActionStub();
    163   shouldNotCall2 = new wasCalledActionStub();
     157  ActionTraits canUndoTrait("canUndoActionStub");
     158  ActionTraits cannotUndoTrait("cannotUndoActionStub");
     159  positive1 = new canUndoActionStub(canUndoTrait);
     160  positive2 = new canUndoActionStub(canUndoTrait);
     161  negative1 = new cannotUndoActionStub(cannotUndoTrait);
     162  negative2 = new cannotUndoActionStub(cannotUndoTrait);
     163
     164  ActionTraits wasCalledTrait("wasCalledActionStub");
     165  shouldCall1 = new wasCalledActionStub(wasCalledTrait);
     166  shouldCall2 = new wasCalledActionStub(wasCalledTrait);
     167  shouldNotCall1 = new wasCalledActionStub(wasCalledTrait);
     168  shouldNotCall2 = new wasCalledActionStub(wasCalledTrait);
    164169
    165170}
     
    254259void ActionSequenceTest::doesUndoTest(){
    255260  ActionSequence *sequence = new ActionSequence();
    256   wasCalledActionStub *wasCalled1 = new wasCalledActionStub();
    257   wasCalledActionStub *wasCalled2 = new wasCalledActionStub();
     261  ActionTraits wasCalledTrait("wasCalledActionStub");
     262  wasCalledActionStub *wasCalled1 = new wasCalledActionStub(wasCalledTrait);
     263  wasCalledActionStub *wasCalled2 = new wasCalledActionStub(wasCalledTrait);
    258264  sequence->addAction(wasCalled1);
    259265  sequence->addAction(wasCalled2);
    260266
    261   MakroAction act("Test MakroAction",sequence,false);
     267  ActionTraits MakroTrait("Test MakroAction");
     268  MakroAction act(MakroTrait,sequence,false);
    262269
    263270  act.call();
  • src/unittests/Makefile.am

    rb295ca r41e15b  
    3232  manipulateAtomsTest \
    3333  MatrixUnittest \
     34  MenuDescriptionUnitTest \
    3435  MoleculeDescriptorTest \
    3536  ObserverTest \
     
    3738  periodentafelTest \
    3839  PlaneUnittest \
     40  Registry \
    3941  ShapeUnittest \
    4042  SingletonTest \
     
    9092  MatrixUnittest.cpp \
    9193  manipulateAtomsTest.cpp \
     94  MenuDescriptionUnitTest.cpp \
    9295  MoleculeDescriptorTest.cpp \
    9396  ObserverTest.cpp \
     
    9598  periodentafelTest.cpp \
    9699  PlaneUnittest.cpp \
     100  RegistryUnitTest.cpp \
    97101  ShapeUnittest.cpp \
    98102  SingletonTest.cpp \
     
    128132  manipulateAtomsTest.hpp \
    129133  MatrixUnittest.hpp \
     134  MenuDescriptionUnitTest.hpp \
    130135  MoleculeDescriptorTest.hpp \
     136  ObserverTest.hpp \
    131137  periodentafelTest.hpp \
    132138  ParserUnitTest.hpp \
    133139  PlaneUnittest.hpp \
    134   ObserverTest.hpp \
     140  RegistryUnitTest.hpp \
    135141  SingletonTest.hpp \
    136142  stackclassunittest.hpp \
     
    213219MatrixUnittest_LDADD = ${ALLLIBS}
    214220
     221MenuDescriptionUnitTest_SOURCES = UnitTestMain.cpp MenuDescriptionUnitTest.cpp   MenuDescriptionUnitTest.hpp
     222MenuDescriptionUnitTest_LDADD = ${ALLLIBS}
     223
    215224MoleculeDescriptorTest_SOURCES = UnitTestMain.cpp MoleculeDescriptorTest.cpp MoleculeDescriptorTest.hpp
    216225MoleculeDescriptorTest_LDADD = ${ALLLIBS}
     
    228237PlaneUnittest_LDADD = ${ALLLIBS}
    229238
     239Registry_SOURCES = UnitTestMain.cpp RegistryUnitTest.cpp RegistryUnitTest.hpp
     240Registry_LDADD = ${ALLLIBS}
     241
    230242ShapeUnittest_SOURCES = UnitTestMain.cpp ShapeUnittest.cpp ShapeUnittest.hpp
    231243ShapeUnittest_LDADD = ${ALLLIBS}
  • src/unittests/atomsCalculationTest.cpp

    rb295ca r41e15b  
    3131#include "Actions/AtomsCalculation_impl.hpp"
    3232#include "Actions/ActionRegistry.hpp"
     33#include "Actions/ActionTraits.hpp"
    3334
    3435#include "World.hpp"
     
    8889
    8990void atomsCalculationTest::testCalculateSimple(){
    90   AtomsCalculation<atomId_t> *calc = World::getInstance().calcOnAtoms<atomId_t>(boost::bind(&atom::getId,_1),"FOO",AllAtoms());
     91  ActionTraits FooTrait("FOO");
     92  AtomsCalculation<atomId_t> *calc = World::getInstance().calcOnAtoms<atomId_t>(boost::bind(&atom::getId,_1),FooTrait,AllAtoms());
    9193  std::vector<atomId_t> allIds = (*calc)();
    9294  CPPUNIT_ASSERT(hasAllIds(allIds,atomIds));
     
    9597
    9698void atomsCalculationTest::testCalculateExcluded(){
     99  ActionTraits FooTrait("FOO");
    97100  atomId_t excluded = atomIds[ATOM_COUNT/2];
    98   AtomsCalculation<atomId_t> *calc = World::getInstance().calcOnAtoms<atomId_t>(boost::bind(&atom::getId,_1),"FOO",AllAtoms() && !AtomById(excluded));
     101  AtomsCalculation<atomId_t> *calc = World::getInstance().calcOnAtoms<atomId_t>(boost::bind(&atom::getId,_1),FooTrait,AllAtoms() && !AtomById(excluded));
    99102  std::vector<atomId_t> allIds = (*calc)();
    100103  std::set<atomId_t> excluded_set;
  • tests/regression/testsuite-simple_configuration.at

    rb295ca r41e15b  
    2626AT_SETUP([Simple configuration - adding atom])
    2727AT_KEYWORDS([configuration])
    28 AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -o mpqc pcp xyz -a 1 --position "10., 10., 10."], 0, [ignore], [ignore])
     28AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -o mpqc pcp xyz -a 1 --domain-position "10., 10., 10."], 0, [ignore], [ignore])
    2929AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
    3030AT_CHECK([file=test.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
    3131AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
    32 AT_CHECK([../../molecuilder -i test2.conf -e ${abs_top_srcdir}/src/ -o mpqc pcp xyz -a 1 --position "0., 0., -1."], 134, [ignore], [ignore])
     32AT_CHECK([../../molecuilder -i test2.conf -e ${abs_top_srcdir}/src/ -o mpqc pcp xyz -a 1 --domain-position "0., 0., -1."], 134, [ignore], [ignore])
    3333AT_CLEANUP
    3434AT_SETUP([Simple configuration - adding atom with Undo/Redo])
    3535AT_KEYWORDS([configuration])
    36 AT_CHECK([../../molecuilder -i empty.conf -o pcp -a 1 --position "10., 10., 10." --undo], 0, [ignore], [ignore])
     36AT_CHECK([../../molecuilder -i empty.conf -o pcp -a 1 --domain-position "10., 10., 10." --undo], 0, [ignore], [ignore])
    3737AT_CHECK([file=empty.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
    38 AT_CHECK([../../molecuilder -i test.conf -o mpqc pcp xyz -a 1 --position "10., 10., 10." --undo --redo], 0, [ignore], [ignore])
     38AT_CHECK([../../molecuilder -i test.conf -o mpqc pcp xyz -a 1 --domain-position "10., 10., 10." --undo --redo], 0, [ignore], [ignore])
    3939AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
    4040AT_CHECK([file=test.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
Note: See TracChangeset for help on using the changeset viewer.