Ignore:
Timestamp:
Aug 9, 2013, 2:20:35 PM (12 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:
98dbee
Parents:
a8bc27a
git-author:
Frederik Heber <heber@…> (06/24/13 08:07:20)
git-committer:
Frederik Heber <heber@…> (08/09/13 14:20:35)
Message:

Made HomologyContainer observable.

  • added clear() and getNextKey() functionality.
Location:
src/Fragmentation/Homology
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Homology/HomologyContainer.cpp

    ra8bc27a rbcc24f  
    4848#include "Fragmentation/Graph.hpp"
    4949
     50HomologyContainer::HomologyContainer() :
     51  Observable("HomologyContainer")
     52{}
     53
     54HomologyContainer::HomologyContainer(const container_t &values) :
     55  Observable("HomologyContainer"),
     56  container(values)
     57{}
     58
    5059std::ostream& operator<<(std::ostream &out, const HomologyContainer &homologycontainer)
    5160{
     
    8089}
    8190
     91void HomologyContainer::insert(const container_t &values) {
     92  OBSERVE;
     93  container.insert(values.begin(), values.end());
     94}
     95
     96void HomologyContainer::clear() {
     97  OBSERVE;
     98  container.clear();
     99}
     100
    82101// we need to explicitly instantiate the serialization functions
    83102BOOST_CLASS_EXPORT_IMPLEMENT(HomologyContainer)
  • src/Fragmentation/Homology/HomologyContainer.hpp

    ra8bc27a rbcc24f  
    1717#include <boost/serialization/export.hpp>
    1818#include <boost/serialization/map.hpp>
     19#include <boost/serialization/split_member.hpp>
    1920#include <boost/serialization/vector.hpp>
    2021
     
    2425
    2526#include "CodePatterns/IteratorAdaptors.hpp"
     27#include "CodePatterns/Observer/Observable.hpp"
    2628
    2729#include "Fragmentation/Homology/HomologyGraph.hpp"
     
    4143 *
    4244 */
    43 class HomologyContainer
     45class HomologyContainer : public Observable
    4446{
    4547  //!> grant access to output operator
     
    5456  typedef MapKeyConstIterator<container_t::const_iterator> const_key_iterator;
    5557  typedef std::pair< const_iterator, const_iterator> range_t;
     58
    5659public:
    5760  /** Default Constructor of class HomologyContainer.
    5861   *
    5962   */
    60   HomologyContainer() {}
     63  HomologyContainer();
    6164
    6265  /** Constructor of class HomologyContainer.
     
    6467   * @param values values with with to initially fill the container
    6568   */
    66   HomologyContainer(const container_t &values) :
    67     container(values)
    68   {}
     69  HomologyContainer(const container_t &values);
     70
    6971  /** Destructor of class HomologyContainer.
    7072   *
     
    101103   * @param values graph and values to insert
    102104   */
    103   void insert(const container_t &values) {
    104     container.insert(values.begin(), values.end());
    105   }
     105  void insert(const container_t &values);
    106106
    107107  /** Returns iterator range with all contained graphs homologous to the given \a graph.
     
    136136  { return const_key_iterator(container.end()); }
    137137
     138  const_key_iterator getNextKey(const_key_iterator &iter) const
     139  { return const_key_iterator(container.upper_bound(*iter)); }
     140
     141  /** Clears all homologies from container.
     142   *
     143   */
     144  void clear();
     145
    138146private:
    139147  //!> multimap containing all homologous graph under same key but each with its value
     
    144152  // serialization
    145153  template <typename Archive>
    146   void serialize(Archive& ar, const unsigned int version)
     154  void load(Archive& ar, const unsigned int version)
     155  {
     156    OBSERVE;
     157    ar & container;
     158  }
     159  template <typename Archive>
     160  void save(Archive& ar, const unsigned int version) const
    147161  {
    148162    ar & container;
    149163  }
     164  BOOST_SERIALIZATION_SPLIT_MEMBER()
    150165};
    151166
Note: See TracChangeset for help on using the changeset viewer.