Changeset 882678 for src/Actions/ValueStorage.hpp
- Timestamp:
- Apr 6, 2011, 1:50:42 PM (14 years ago)
- 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:
- 336e33
- Parents:
- b94634
- git-author:
- Frederik Heber <heber@…> (04/01/11 22:29:00)
- git-committer:
- Frederik Heber <heber@…> (04/06/11 13:50:42)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/ValueStorage.hpp
rb94634 r882678 23 23 #include <vector> 24 24 #include <typeinfo> 25 #include <utility> 25 26 26 27 #include "Actions/OptionTrait.hpp" 27 28 #include "Actions/OptionRegistry.hpp" 28 #include "Exceptions/IllegalTypeException.hpp"29 29 #include "Exceptions/MissingValueException.hpp" 30 30 #include "CodePatterns/Assert.hpp" 31 31 #include "CodePatterns/Singleton.hpp" 32 33 #include <exception> 34 #include <boost/exception.hpp> 35 36 class MatrixContent; 37 class Vector; 38 39 /** Base type for all exceptions regarding ValueStorage class. 40 * 41 */ 42 struct ValueStorageException : virtual std::exception, virtual boost::exception { }; 43 44 /** ========================== General error information ================== */ 45 46 /** Exception information for ValueStorageException: name of option. 47 */ 48 typedef boost::error_info<struct tag_ValueStorageOptionName, const char *> ValueStorageOptionName; 49 50 /** Exception information for ValueStorageException: name of type. 51 */ 52 typedef boost::error_info<struct tag_ValueStorageTypeName, const char *> ValueStorageTypeName; 53 54 /** Exception information for ValueStorageException: pair of names of two types. 55 */ 56 typedef boost::error_info< 57 struct tag_ValueStorageTypeName, 58 std::pair<const char *,const char *> > ValueStoragePairTypeName; 59 60 /** ============================ Specific exceptions ====================== */ 61 62 /** Exception thrown when ValueStorage is given an illegal type for a specific option. 63 */ 64 struct IllegalTypeException : virtual ValueStorageException { }; 32 65 33 66 class MapOfActionsTest; … … 94 127 CurrentValueMap.erase(name); 95 128 } else 96 throw IllegalTypeException(__FILE__,__LINE__); 129 throw IllegalTypeException() << ValueStorageOptionName(name) 130 << ValueStoragePairTypeName(std::make_pair( 131 typeid(_T).name(), 132 OptionRegistry_instance.getOptionByName(name)->getTypeName().c_str()) 133 ); 97 134 } 98 135 template<typename T> void queryCurrentValue(const char * name, std::vector<T> &_T) … … 111 148 } 112 149 } else 113 throw IllegalTypeException(__FILE__,__LINE__); 150 throw IllegalTypeException() << ValueStorageOptionName(name) 151 << ValueStoragePairTypeName(std::make_pair( 152 typeid(_T).name(), 153 OptionRegistry_instance.getOptionByName(name)->getTypeName().c_str()) 154 ); 114 155 } 115 156 … … 136 177 CurrentValueMap[name] = stream.str(); 137 178 } else 138 throw IllegalTypeException(__FILE__,__LINE__); 139 } 179 throw IllegalTypeException() << ValueStorageOptionName(name) 180 << ValueStoragePairTypeName(std::make_pair( 181 typeid(_T).name(), 182 OptionRegistry_instance.getOptionByName(name)->getTypeName().c_str()) 183 ); 184 } 140 185 /** Sets a value in the storage. 141 186 * \param name key of value … … 152 197 CurrentValueMap[name] = stream.str(); 153 198 } else 154 throw IllegalTypeException(__FILE__,__LINE__); 199 throw IllegalTypeException() << ValueStorageOptionName(name) 200 << ValueStoragePairTypeName(std::make_pair( 201 typeid(_T).name(), 202 OptionRegistry_instance.getOptionByName(name)->getTypeName().c_str()) 203 ); 155 204 } 156 205
Note:
See TracChangeset
for help on using the changeset viewer.