Ignore:
Timestamp:
Jun 25, 2010, 8:08:59 AM (15 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
4f7f34e
Parents:
35b698
Message:

Added const_iterator get[Begin\End]Iter() and ostream& operator << to ActionRegistry.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/ActionRegistry.cpp

    r35b698 rd0fbec  
    1919using namespace std;
    2020
     21/** Constructor for class ActionRegistry.
     22 */
    2123ActionRegistry::ActionRegistry()
    2224{
    2325}
    2426
     27/** Destructor for class ActionRegistry.
     28 */
    2529ActionRegistry::~ActionRegistry()
    2630{
     
    3236}
    3337
     38/** Returns pointer to an action named by \a name.
     39 * \param name name of action
     40 * \return pointer to Action
     41 */
    3442Action* ActionRegistry::getActionByName(const std::string name){
    3543  map<const string,Action*>::iterator iter;
     
    3947}
    4048
     49/** States whether action is present or not.
     50 * \note This iss needed as ActionRegistry::getActionByName() ASSERT()s that action is in map.
     51 * \param name name of action
     52 * \return true - Action present, false - Action absent
     53 */
    4154bool ActionRegistry::isActionByNamePresent(const std::string name){
    4255  map<const string,Action*>::iterator iter;
     
    4558}
    4659
     60/** Registers an Action with the ActionRegistry.
     61 * \param *action pointer to Action.
     62 */
    4763void ActionRegistry::registerAction(Action* action){
    4864  pair<map<const string,Action*>::iterator,bool> ret;
     65  //cout << "Trying to register action with name " << action->getName() << "." << endl;
    4966  ret = actionMap.insert(pair<const string,Action*>(action->getName(),action));
    5067  ASSERT(ret.second,"Two actions with the same name added to registry");
    5168}
    5269
     70/** Unregisters an Action.
     71 * \param *action pointer to Action.
     72 */
    5373void ActionRegistry::unregisterAction(Action* action){
     74  //cout << "Unregistering action with name " << action->getName() << "." << endl;
    5475  actionMap.erase(action->getName());
    5576}
    5677
     78/** Returns an iterator pointing to the start of the map of Action's.
     79 * \return begin iterator
     80 */
    5781std::map<const std::string,Action*>::iterator ActionRegistry::getBeginIter()
    5882{
     
    6084}
    6185
     86/** Returns an iterator pointing to the end of the map of Action's.
     87 * \return end iterator
     88 */
    6289std::map<const std::string,Action*>::iterator ActionRegistry::getEndIter()
    6390{
     
    6592}
    6693
     94/** Returns a const iterator pointing to the start of the map of Action's.
     95 * \return constant begin iterator
     96 */
     97std::map<const std::string,Action*>::const_iterator ActionRegistry::getBeginIter() const
     98{
     99  return actionMap.begin();
     100}
     101
     102/** Returns a const iterator pointing to the end of the map of Action's.
     103 * \return constant end iterator
     104 */
     105std::map<const std::string,Action*>::const_iterator ActionRegistry::getEndIter() const
     106{
     107  return actionMap.end();
     108}
     109
     110/** Prints the contents of the ActionRegistry \a &m to \a &ost.
     111 * \param &ost output stream
     112 * \param &m reference to ActionRegistry
     113 * \return reference to the above out stream for concatenation
     114 */
     115ostream& operator<<(ostream& ost, const ActionRegistry& m)
     116{
     117  ost << "ActionRegistry contains:" << endl;
     118  for (std::map<const std::string,Action*>::const_iterator iter = m.getBeginIter(); iter != m.getEndIter(); ++iter) {
     119    ost << "\t" << iter->first << " with pointer " << iter->second << endl;
     120  }
     121  return ost;
     122};
     123
     124
     125
    67126CONSTRUCT_SINGLETON(ActionRegistry)
Note: See TracChangeset for help on using the changeset viewer.