Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Action.cpp

    re4afb4 rbcf653  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include <iostream>
    2322#include <string>
    2423
     
    2625#include "Actions/ActionRegistry.hpp"
    2726#include "Actions/ActionHistory.hpp"
    28 #include "Actions/OptionRegistry.hpp"
    29 #include "Actions/OptionTrait.hpp"
    3027#include "Exceptions/MissingValueException.hpp"
    3128#include "UIElements/Dialog.hpp"
    32 #include "Helpers/Assert.hpp"
    3329#include "Helpers/MemDebug.hpp"
    3430#include "UIElements/UIFactory.hpp"
     
    4743Action::state_ptr Action::failure = getEmptyState();
    4844
    49 Action::Action(const ActionTraits &_Traits, bool _doRegister) :
    50     Traits(_Traits)
     45Action::Action(std::string _name,bool _doRegister) :
     46name(_name)
    5147{
    52   // register with ActionRegistry
    5348  if(_doRegister){
    5449    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     }
    7550  }
    7651}
     
    8055
    8156const string Action::getName(){
    82   return Traits.getName();
     57  return name;
    8358}
    8459
     
    129104  return true;
    130105}
    131 
Note: See TracChangeset for help on using the changeset viewer.