Changeset 2445fb for src


Ignore:
Timestamp:
May 4, 2012, 2:19:07 PM (13 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:
9875cc
Parents:
083490
git-author:
Frederik Heber <heber@…> (11/27/11 20:09:01)
git-committer:
Frederik Heber <heber@…> (05/04/12 14:19:07)
Message:

Added private default cstor to FragmentResult.

  • enhanced unit test by a vector<Fragmentresult> test and this made the above default cstor necessary.
Location:
src/Fragmentation/Automation
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Automation/FragmentResult.cpp

    r083490 r2445fb  
    2121
    2222#include "FragmentResult.hpp"
     23
     24/** Private default Constructor of class FragmentResult.
     25 *
     26 * This cstor is for serialization of this class inside a vector
     27 * only. Without it, we would not need it.
     28 */
     29FragmentResult::FragmentResult() :
     30  JobId(JobId::NoJob),
     31  result(std::string("NoJob"))
     32{}
    2333
    2434/** Constructor of class FragmentResult.
  • src/Fragmentation/Automation/FragmentResult.hpp

    r083490 r2445fb  
    5050private:
    5151  friend class boost::serialization::access;
     52
     53  /// private default constructor for serialization only.
     54  FragmentResult();
     55
    5256  // serialization
    5357  template <typename Archive>
  • src/Fragmentation/Automation/unittests/FragmentResultUnitTest.cpp

    r083490 r2445fb  
    2525#include <boost/archive/text_oarchive.hpp>
    2626#include <boost/archive/text_iarchive.hpp>
     27#include <boost/serialization/vector.hpp>
    2728
    2829#include "FragmentResultUnitTest.hpp"
     
    9394}
    9495
     96/** UnitTest for serialization
     97 */
     98void FragmentResultTest::vectorserializationTest()
     99{
     100  std::vector<FragmentResult> testresults;
     101  FragmentResult testResult(1);
     102  testresults.push_back(testResult);
     103  // write element to stream
     104  std::stringstream stream;
     105  boost::archive::text_oarchive oa(stream);
     106  oa << testresults;
     107
     108  //std::cout << "Contents of archive is " << stream.str() << std::endl;
     109
     110  // create and open an archive for input
     111  boost::archive::text_iarchive ia(stream);
     112  // read class state from archive
     113  std::vector<FragmentResult> othertestresults;
     114
     115  ia >> othertestresults;
     116
     117  CPPUNIT_ASSERT (testresults == othertestresults);
     118}
  • src/Fragmentation/Automation/unittests/FragmentResultUnitTest.hpp

    r083490 r2445fb  
    1515
    1616#include <string>
     17#include <vector>
    1718
    1819#include <cppunit/extensions/HelperMacros.h>
     
    2526    CPPUNIT_TEST ( equalityTest );
    2627    CPPUNIT_TEST ( serializationTest );
     28    CPPUNIT_TEST ( vectorserializationTest );
    2729    CPPUNIT_TEST_SUITE_END();
    2830
     
    3234      void equalityTest();
    3335      void serializationTest();
     36      void vectorserializationTest();
    3437
    3538};
Note: See TracChangeset for help on using the changeset viewer.