Changeset 3b9aa1


Ignore:
Timestamp:
Feb 14, 2016, 12:33:41 PM (9 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:
cf9287
Parents:
367489
git-author:
Frederik Heber <heber@…> (10/30/15 11:54:29)
git-committer:
Frederik Heber <heber@…> (02/14/16 12:33:41)
Message:

FIX: All ObservedValue getters now return const references.

  • this should avoid some unnecessary copying.
Location:
src/UIElements
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/InstanceBoard/QtObservedAtom.cpp

    r367489 r3b9aa1  
    365365}
    366366
    367 atomId_t QtObservedAtom::getAtomIndex() const
     367const atomId_t& QtObservedAtom::getAtomIndex() const
    368368{
    369369  return boost::any_cast<ObservedValue_wCallback<atomId_t> *>(ObservedValues[AtomIndex])->get();
    370370}
    371371
    372 QtObservedAtom::ListOfBonds_t QtObservedAtom::getAtomBonds() const
     372const QtObservedAtom::ListOfBonds_t& QtObservedAtom::getAtomBonds() const
    373373{
    374374  return boost::any_cast<ObservedValue_wCallback<ListOfBonds_t, atomId_t> *>(ObservedValues[AtomBonds])->get();
    375375}
    376376
    377 atomicNumber_t QtObservedAtom::getAtomElement() const
     377const atomicNumber_t& QtObservedAtom::getAtomElement() const
    378378{
    379379  return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[AtomElement])->get();
    380380}
    381381
    382 moleculeId_t QtObservedAtom::getAtomMoleculeIndex() const
     382const moleculeId_t& QtObservedAtom::getAtomMoleculeIndex() const
    383383{
    384384  return boost::any_cast<ObservedValue_wCallback<moleculeId_t, atomId_t> *>(ObservedValues[AtomMoleculeIndex])->get();
    385385}
    386386
    387 std::string QtObservedAtom::getAtomName() const
     387const std::string& QtObservedAtom::getAtomName() const
    388388{
    389389  return boost::any_cast<ObservedValue_wCallback<std::string, atomId_t> *>(ObservedValues[AtomName])->get();
    390390}
    391391
    392 Vector QtObservedAtom::getAtomPosition() const
     392const Vector& QtObservedAtom::getAtomPosition() const
    393393{
    394394  return boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(ObservedValues[AtomPosition])->get();
  • src/UIElements/Qt4/InstanceBoard/QtObservedAtom.hpp

    r367489 r3b9aa1  
    8787   * \return atom's index
    8888   */
    89   atomId_t getAtomIndex() const;
     89  const atomId_t& getAtomIndex() const;
    9090
    9191  //!> typedef for list of bonds, defined by pairs of atom ids
     
    9696   * \return atom's bonds
    9797   */
    98   ListOfBonds_t getAtomBonds() const;
     98  const ListOfBonds_t& getAtomBonds() const;
    9999
    100100  /** Getter to atom element contained in \a ObservedValues.
     
    102102   * \return atom's element
    103103   */
    104   atomicNumber_t getAtomElement() const;
     104  const atomicNumber_t& getAtomElement() const;
    105105
    106106  /** Getter to atom name contained in \a ObservedValues.
     
    108108   * \return atom's name
    109109   */
    110   std::string getAtomName() const;
     110  const std::string& getAtomName() const;
    111111
    112112  /** Getter to atom position contained in \a ObservedValues.
     
    114114   * \return atom's position
    115115   */
    116   Vector getAtomPosition() const;
     116  const Vector& getAtomPosition() const;
    117117
    118118  /** Getter to atom's molecule index contained in \a ObservedValues.
     
    120120   * \return atom's molecule index
    121121   */
    122   moleculeId_t getAtomMoleculeIndex() const;
     122  const moleculeId_t& getAtomMoleculeIndex() const;
    123123
    124124signals:
  • src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.cpp

    r367489 r3b9aa1  
    459459}
    460460
    461 int QtObservedMolecule::getAtomCount() const
     461const int& QtObservedMolecule::getAtomCount() const
    462462{
    463463  return boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[AtomCount])->get();
    464464}
    465465
    466 int QtObservedMolecule::getBondCount() const
     466const int& QtObservedMolecule::getBondCount() const
    467467{
    468468  return boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[BondCount])->get();
    469469}
    470470
    471 std::string QtObservedMolecule::getMolFormula() const
     471const std::string& QtObservedMolecule::getMolFormula() const
    472472{
    473473  return boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(ObservedValues[FormulaString])->get();
    474474}
    475475
    476 Vector QtObservedMolecule::getMolCenter() const
     476const Vector& QtObservedMolecule::getMolCenter() const
    477477{
    478478  return boost::any_cast<ObservedValue_wCallback<Vector, moleculeId_t> *>(ObservedValues[MolCenter])->get();
    479479}
    480480
    481 moleculeId_t QtObservedMolecule::getMolIndex() const
     481const moleculeId_t& QtObservedMolecule::getMolIndex() const
    482482{
    483483  return boost::any_cast<ObservedValue_wCallback<moleculeId_t> *>(ObservedValues[MolIndex])->get();
    484484}
    485485
    486 std::string QtObservedMolecule::getMolName() const
     486const std::string& QtObservedMolecule::getMolName() const
    487487{
    488488  return boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(ObservedValues[MolName])->get();
    489489}
    490490
    491 int QtObservedMolecule::getNonHydrogenCount() const
     491const int& QtObservedMolecule::getNonHydrogenCount() const
    492492{
    493493  return boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[NonHydrogenCount])->get();
    494494}
    495495
    496 molecule::BoundingBoxInfo QtObservedMolecule::getBoundingBox() const
     496const molecule::BoundingBoxInfo& QtObservedMolecule::getBoundingBox() const
    497497{
    498498  return boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t> *>(ObservedValues[BoundingBox])->get();
  • src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp

    r367489 r3b9aa1  
    8484   * \return molecule's atom count
    8585   */
    86   int getAtomCount() const;
     86  const int& getAtomCount() const;
    8787
    8888  /** Getter to molecule bond count contained in \a ObservedValues.
     
    9090   * \return molecule's bond count
    9191   */
    92   int getBondCount() const;
     92  const int& getBondCount() const;
    9393
    9494  /** Getter to molecule center contained in \a ObservedValues.
     
    9696   * \return molecule's center
    9797   */
    98   Vector getMolCenter() const;
     98  const Vector& getMolCenter() const;
    9999
    100100  /** Getter to molecule index contained in \a ObservedValues.
     
    102102   * \return molecule's index
    103103   */
    104   moleculeId_t getMolIndex() const;
     104  const moleculeId_t& getMolIndex() const;
    105105
    106106  /** Getter to molecule name contained in \a ObservedValues.
     
    108108   * \return molecule's name
    109109   */
    110   std::string getMolName() const;
     110  const std::string& getMolName() const;
    111111
    112112  /** Getter to molecule formula contained in \a ObservedValues.
     
    114114   * \return molecule's formula
    115115   */
    116   std::string getMolFormula() const;
     116  const std::string& getMolFormula() const;
    117117
    118118  /** Getter to molecule non-hydrogen atom  count contained in \a ObservedValues.
     
    120120   * \return molecule's non-hydrogen atom count
    121121   */
    122   int getNonHydrogenCount() const;
     122  const int& getNonHydrogenCount() const;
    123123
    124124  /** Getter to molecule's bounding box contained in \a ObservedValues.
     
    126126   * \return molecule's bounding box
    127127   */
    128   molecule::BoundingBoxInfo getBoundingBox() const;
     128  const molecule::BoundingBoxInfo& getBoundingBox() const;
    129129
    130130  static const molecule * const getMolecule(const moleculeId_t _id);
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp

    r367489 r3b9aa1  
    526526}
    527527
    528 atomId_t GLMoleculeObject_bond::getleftIndex() const
     528const atomId_t& GLMoleculeObject_bond::getleftIndex() const
    529529{
    530530  return boost::any_cast<ObservedValue_wCallback<atomId_t> *>(ObservedValues[leftIndex])->get();
    531531}
    532532
    533 atomId_t GLMoleculeObject_bond::getrightIndex() const
     533const atomId_t& GLMoleculeObject_bond::getrightIndex() const
    534534{
    535535  return boost::any_cast<ObservedValue_wCallback<atomId_t> *>(ObservedValues[rightIndex])->get();
    536536}
    537537
    538 Vector GLMoleculeObject_bond::getleftPosition() const
     538const Vector& GLMoleculeObject_bond::getleftPosition() const
    539539{
    540540  return boost::any_cast<ObservedValue_wCallback<Vector,atomId_t> *>(ObservedValues[leftPosition])->get();
    541541}
    542542
    543 Vector GLMoleculeObject_bond::getrightPosition() const
     543const Vector& GLMoleculeObject_bond::getrightPosition() const
    544544{
    545545  return boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(ObservedValues[rightPosition])->get();
    546546}
    547547
    548 atomicNumber_t GLMoleculeObject_bond::getleftElement() const
     548const atomicNumber_t& GLMoleculeObject_bond::getleftElement() const
    549549{
    550550  return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[leftElement])->get();
    551551}
    552552
    553 atomicNumber_t GLMoleculeObject_bond::getrightElement() const
     553const atomicNumber_t& GLMoleculeObject_bond::getrightElement() const
    554554{
    555555  return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[rightElement])->get();
    556556}
    557557
    558 int GLMoleculeObject_bond::getDegree() const
     558const int& GLMoleculeObject_bond::getDegree() const
    559559{
    560560  return boost::any_cast<ObservedValue_wCallback<int, bondIds_t> *>(ObservedValues[Degree])->get();
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.hpp

    r367489 r3b9aa1  
    177177   * \return left atom's id
    178178   */
    179   atomId_t getleftIndex() const;
     179  const atomId_t& getleftIndex() const;
    180180
    181181  /** Getter to right atom's id contained in \a ObservedValues.
     
    183183   * \return right atom's id
    184184   */
    185   atomId_t getrightIndex() const;
     185  const atomId_t& getrightIndex() const;
    186186
    187187  /** Getter to left atom's position contained in \a ObservedValues.
     
    189189   * \return left atom's position
    190190   */
    191   Vector getleftPosition() const;
     191  const Vector& getleftPosition() const;
    192192
    193193  /** Getter to right atom's position contained in \a ObservedValues.
     
    195195   * \return right atom's position
    196196   */
    197   Vector getrightPosition() const;
     197  const Vector& getrightPosition() const;
    198198
    199199  /** Getter to left atom's element contained in \a ObservedValues.
     
    201201   * \return left atom's element
    202202   */
    203   atomicNumber_t getleftElement() const;
     203  const atomicNumber_t& getleftElement() const;
    204204
    205205  /** Getter to rightatom's element contained in \a ObservedValues.
     
    207207   * \return right atom's element
    208208   */
    209   atomicNumber_t getrightElement() const;
     209  const atomicNumber_t& getrightElement() const;
    210210
    211211  /** Getter to bond's degree contained in \a ObservedValues.
     
    213213   * \return bond's degree
    214214   */
    215   int getDegree() const;
     215  const int& getDegree() const;
    216216
    217217  /** Counts how many ObservedValues got subjectKilled.
Note: See TracChangeset for help on using the changeset viewer.