From a33f9f67fbc44185bf1fcc57e9493fcf1192af1a Mon Sep 17 00:00:00 2001 From: marco <marco@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Sun, 25 Apr 2010 08:45:27 +0000 Subject: [PATCH] shorten methods of GenericPropertyContainer somewhat The old signatures are still available in Python, but produce a deprecation warning. After some time, we will remove the long signatures completely. git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2113 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- examples/dokk/protein.py | 2 +- examples/dokk/score_updater.py | 4 +- examples/misc/the_hammer.py | 4 +- modules/base/doc/generic_properties.dox | 4 +- modules/base/pymod/export_generic_property.cc | 50 ++--- modules/base/pymod/wrap_base.cc | 2 +- .../src/export_helper/generic_property_def.hh | 177 +++++++++++++++--- modules/base/src/generic_property.hh | 130 ++++++------- modules/base/tests/test_generic_property.cc | 32 ++-- modules/bindings/pymod/dssp.py | 10 +- modules/bindings/pymod/msms.py | 2 +- modules/conop/src/ring_finder.cc | 20 +- modules/conop/src/ring_finder.hh | 2 +- modules/io/src/mol/entity_io_sdf_handler.cc | 6 +- modules/io/tests/test_io_sdf.cc | 4 +- modules/mol/base/doc/query.dox | 8 +- modules/mol/base/doc/query.rst | 6 +- modules/mol/base/src/atom_base.cc | 4 +- modules/mol/base/src/atom_base.hh | 8 +- modules/mol/base/src/bond_handle.cc | 4 +- modules/mol/base/src/bond_handle.hh | 8 +- modules/mol/base/src/chain_base.cc | 4 +- modules/mol/base/src/chain_base.hh | 8 +- modules/mol/base/src/entity_base.cc | 4 +- modules/mol/base/src/entity_base.hh | 8 +- .../mol/base/src/entity_property_mapper.cc | 24 +-- modules/mol/base/src/impl/atom_impl.hh | 2 +- modules/mol/base/src/impl/chain_impl.hh | 2 +- modules/mol/base/src/impl/connector_impl.hh | 2 +- modules/mol/base/src/impl/entity_impl.hh | 2 +- modules/mol/base/src/impl/residue_impl.hh | 2 +- modules/mol/base/src/property_id.hh | 2 +- modules/mol/base/src/query.hh | 2 +- modules/mol/base/src/residue_base.cc | 4 +- modules/mol/base/src/residue_base.hh | 8 +- modules/mol/base/tests/test_query.cc | 6 +- modules/seq/base/src/impl/sequence_impl.hh | 2 +- modules/seq/base/src/sequence_handle.cc | 8 +- modules/seq/base/src/sequence_handle.hh | 16 +- 39 files changed, 354 insertions(+), 239 deletions(-) diff --git a/examples/dokk/protein.py b/examples/dokk/protein.py index 6e338e90a..a73fbcffd 100644 --- a/examples/dokk/protein.py +++ b/examples/dokk/protein.py @@ -3,7 +3,7 @@ class Protein: def __init__(self, prot): self.handle=prot for a in self.handle.atoms: - a.SetGenericFloatProperty('clash', 0.0) + a.SetFloatProp('clash', 0.0) self.prot_go_=gfx.Entity("Prot", self.handle) gfx.Scene().Add(self.prot_go_) diff --git a/examples/dokk/score_updater.py b/examples/dokk/score_updater.py index a1522ce9a..f98eb9eb9 100644 --- a/examples/dokk/score_updater.py +++ b/examples/dokk/score_updater.py @@ -10,7 +10,7 @@ class ScoreUpdater(QtCore.QObject): def UpdateScores(self): for atom in self.old_atoms: - atom.SetGenericFloatProperty('clash', 0) + atom.SetFloatProp('clash', 0) ligand = self.level.ligand prot_within = set() @@ -22,6 +22,6 @@ class ScoreUpdater(QtCore.QObject): lig_view=ligand.handle.CreateFullView() for a in prot_within: score=qa.ClashScore(a, lig_view) - a.SetGenericFloatProperty('clash', score) + a.SetFloatProp('clash', score) self.level.surface.go.ReapplyColorOps() self.old_atoms = prot_within diff --git a/examples/misc/the_hammer.py b/examples/misc/the_hammer.py index 6b4d7f25e..116890008 100644 --- a/examples/misc/the_hammer.py +++ b/examples/misc/the_hammer.py @@ -23,7 +23,7 @@ class Anim(QtCore.QTimer): self.edi.UpdateICS() for a in self.b.view.atoms: score=qa.ClashScore(a.handle, self.a.view) - a.SetGenericFloatProperty('clash', score) + a.SetFloatProp('clash', score) self.a.UpdatePositions() self.b.ReapplyColorOps() @@ -70,7 +70,7 @@ b=TheWall() a_go=gfx.Entity("a", gfx.CUSTOM, a) b_go=gfx.Entity("b", gfx.CUSTOM, b) for a in a.atoms: - a.SetGenericFloatProperty('clash', 0.0) + a.SetFloatProp('clash', 0.0) scene.Add(a_go) scene.Add(b_go) diff --git a/modules/base/doc/generic_properties.dox b/modules/base/doc/generic_properties.dox index 2737a18aa..2ce57b2ae 100644 --- a/modules/base/doc/generic_properties.dox +++ b/modules/base/doc/generic_properties.dox @@ -2,7 +2,7 @@ namespace ost { /*! \page generic_properties generic properties -Most building blocks are a GenericPropertyContainer, meaning that arbitrary +Most building blocks are a GenericPropContainer, meaning that arbitrary key-value pairs can be stored in them, namely: \li EntityHandle and EntityView @@ -15,6 +15,6 @@ The view variants will reflect the generic properties of the handle variants. A generic property key is always a String, and a value can be one of String, Real, int or bool. For each of these data types, methods to retrieve and store values are available both in Python and C++. For more details see the -documentation of GenericPropertyContainer. +documentation of GenericPropContainer. */ } \ No newline at end of file diff --git a/modules/base/pymod/export_generic_property.cc b/modules/base/pymod/export_generic_property.cc index 9f2761dc2..881865849 100644 --- a/modules/base/pymod/export_generic_property.cc +++ b/modules/base/pymod/export_generic_property.cc @@ -24,32 +24,32 @@ using namespace boost::python; using namespace ost; -void export_GenericProperty() +void export_GenericProp() { - String (GenericPropertyContainer::* get_string1)(const String&) const = &GenericPropertyContainer::GetGenericStringProperty; - String (GenericPropertyContainer::* get_string2)(const String&, const String&) const = &GenericPropertyContainer::GetGenericStringProperty; - Real (GenericPropertyContainer::* get_float1)(const String&) const = &GenericPropertyContainer::GetGenericFloatProperty; - Real (GenericPropertyContainer::* get_float2)(const String&, Real) const = &GenericPropertyContainer::GetGenericFloatProperty; - int (GenericPropertyContainer::* get_int1)(const String&) const = &GenericPropertyContainer::GetGenericIntProperty; - int (GenericPropertyContainer::* get_int2)(const String&, int) const = &GenericPropertyContainer::GetGenericIntProperty; - bool (GenericPropertyContainer::* get_bool1)(const String&) const = &GenericPropertyContainer::GetGenericBoolProperty; - bool (GenericPropertyContainer::* get_bool2)(const String&, bool) const = &GenericPropertyContainer::GetGenericBoolProperty; + String (GenericPropContainer::* get_string1)(const String&) const = &GenericPropContainer::GetStringProp; + String (GenericPropContainer::* get_string2)(const String&, const String&) const = &GenericPropContainer::GetStringProp; + Real (GenericPropContainer::* get_float1)(const String&) const = &GenericPropContainer::GetFloatProp; + Real (GenericPropContainer::* get_float2)(const String&, Real) const = &GenericPropContainer::GetFloatProp; + int (GenericPropContainer::* get_int1)(const String&) const = &GenericPropContainer::GetIntProp; + int (GenericPropContainer::* get_int2)(const String&, int) const = &GenericPropContainer::GetIntProp; + bool (GenericPropContainer::* get_bool1)(const String&) const = &GenericPropContainer::GetBoolProp; + bool (GenericPropContainer::* get_bool2)(const String&, bool) const = &GenericPropContainer::GetBoolProp; - class_<GenericPropertyContainer, boost::noncopyable>("GenericPropertyContainer",no_init) - .def("HasGenericProperty",&GenericPropertyContainer::HasGenericProperty) - .def("SetGenericStringProperty",&GenericPropertyContainer::SetGenericStringProperty) - .def("GetGenericStringProperty",get_string1) - .def("GetGenericStringProperty",get_string2) - .def("SetGenericFloatProperty",&GenericPropertyContainer::SetGenericFloatProperty) - .def("GetGenericFloatProperty",get_float1) - .def("GetGenericFloatProperty",get_float2) - .def("SetGenericIntProperty",&GenericPropertyContainer::SetGenericIntProperty) - .def("GetGenericIntProperty",get_int1) - .def("GetGenericIntProperty",get_int2) - .def("SetGenericBoolProperty",&GenericPropertyContainer::SetGenericBoolProperty) - .def("GetGenericBoolProperty",get_bool1) - .def("GetGenericBoolProperty",get_bool2) - .def("ClearGenericProperties",&GenericPropertyContainer::ClearGenericProperties) - .def("GetGenericPropertyStringRepresentation",&GenericPropertyContainer::GetGenericPropertyStringRepresentation) + class_<GenericPropContainer, boost::noncopyable>("GenericPropContainer",no_init) + .def("HasProp",&GenericPropContainer::HasProp) + .def("SetStringProp",&GenericPropContainer::SetStringProp) + .def("GetStringProp",get_string1) + .def("GetStringProp",get_string2) + .def("SetFloatProp",&GenericPropContainer::SetFloatProp) + .def("GetFloatProp",get_float1) + .def("GetFloatProp",get_float2) + .def("SetIntProp",&GenericPropContainer::SetIntProp) + .def("GetIntProp",get_int1) + .def("GetIntProp",get_int2) + .def("SetBoolProp",&GenericPropContainer::SetBoolProp) + .def("GetBoolProp",get_bool1) + .def("GetBoolProp",get_bool2) + .def("ClearProps",&GenericPropContainer::ClearProps) + .def("GetPropAsString",&GenericPropContainer::GetPropAsString) ; } diff --git a/modules/base/pymod/wrap_base.cc b/modules/base/pymod/wrap_base.cc index d28c889ac..c3dd609ec 100644 --- a/modules/base/pymod/wrap_base.cc +++ b/modules/base/pymod/wrap_base.cc @@ -26,7 +26,7 @@ using namespace boost::python; void export_Logger(); -void export_GenericProperty(); +void export_GenericProp(); void export_Range(); void export_Units(); diff --git a/modules/base/src/export_helper/generic_property_def.hh b/modules/base/src/export_helper/generic_property_def.hh index 4b8241be7..3203bc198 100644 --- a/modules/base/src/export_helper/generic_property_def.hh +++ b/modules/base/src/export_helper/generic_property_def.hh @@ -20,36 +20,152 @@ #ifndef GENERIC_PROPERTY_DEF_HH #define GENERIC_PROPERTY_DEF_HH +#include <ost/log.hh> /* Author: Marco Biasini */ +template <typename C> +String depr_get_string_a(C& c, const String& k, const String& v) +{ + LOGN_MESSAGE("GetGenericStringProperty is deprecated. Use GetStringProp"); + return c.GetStringProp(k, v); +} + +template <typename C> +String depr_get_string_b(C& c, const String& k) +{ + LOGN_MESSAGE("GetGenericStringProperty is deprecated. Use GetStringProp"); + return c.GetStringProp(k); +} + +template <typename C> +void depr_set_string(C& c, const String& k, const String& v) +{ + LOGN_MESSAGE("SetGenericStringProperty is deprecated. Use SetStringProp"); + return c.SetStringProp(k, v); +} + +template <typename C> +int depr_get_int_a(C& c, const String& k, const int& v) +{ + LOGN_MESSAGE("GetGenericIntProperty is deprecated. Use GetIntProp"); + return c.GetIntProp(k, v); +} + +template <typename C> +int depr_get_int_b(C& c, const String& k) +{ + LOGN_MESSAGE("GetGenericIntProperty is deprecated. Use GetIntProp"); + return c.GetIntProp(k); +} + +template <typename C> +void depr_set_int(C& c, const String& k, const int& v) +{ + LOGN_MESSAGE("SetGenericIntProperty is deprecated. Use SetIntProp"); + return c.SetIntProp(k, v); +} + +template <typename C> +bool depr_get_bool_a(C& c, const String& k, const bool& v) +{ + LOGN_MESSAGE("GetGenericBoolProperty is deprecated. Use GetBoolProp"); + return c.GetBoolProp(k, v); +} + +template <typename C> +bool depr_get_bool_b(C& c, const String& k) +{ + LOGN_MESSAGE("GetGenericBoolProperty is deprecated. Use GetBoolProp"); + return c.GetBoolProp(k); +} + +template <typename C> +void depr_set_bool(C& c, const String& k, const bool& v) +{ + LOGN_MESSAGE("SetGenericBoolProperty is deprecated. Use SetBoolProp"); + return c.SetBoolProp(k, v); +} + +template <typename C> +Real depr_get_float_a(C& c, const String& k, const float& v) +{ + LOGN_MESSAGE("GetGenericFloatProperty is deprecated. Use GetFloatProp"); + return c.GetFloatProp(k, v); +} + +template <typename C> +Real depr_get_float_b(C& c, const String& k) +{ + LOGN_MESSAGE("GetGenericFloatProperty is deprecated. Use GetFloatProp"); + return c.GetFloatProp(k); +} + +template <typename C> +void depr_set_float(C& c, const String& k, const Real& v) +{ + LOGN_MESSAGE("SetGenericFloatProperty is deprecated. Use SetFloatProp"); + return c.SetFloatProp(k, v); +} + +template <typename C> +void depr_clear_props(C& c) +{ + LOGN_MESSAGE("ClearGenericProperties is deprecated. Use ClearProps"); + c.ClearProps(); +} + +template <typename C> +bool depr_has_prop(C& c, const String& k) +{ + LOGN_MESSAGE("HasGenericProperty is deprecated. Use HasProp"); + return c.HasProp(k); +} + +template <typename C> +String depr_prop_as_string(C& c, const String& k) +{ + LOGN_MESSAGE("GetGenericPropertyStringRepresentation is deprecated. Use GetPropAsString"); + return c.GetPropAsString(k); +} + template <typename C, typename O> void const_generic_prop_def(O& bp_class) { - bool (C::*get_bool1)(const String&, bool) const=&C::GetGenericBoolProperty; - bool (C::*get_bool2)(const String&) const=&C::GetGenericBoolProperty; + bool (C::*get_bool1)(const String&, bool) const=&C::GetBoolProp; + bool (C::*get_bool2)(const String&) const=&C::GetBoolProp; - int (C::*get_int1)(const String&, int) const=&C::GetGenericIntProperty; - int (C::*get_int2)(const String&) const=&C::GetGenericIntProperty; + int (C::*get_int1)(const String&, int) const=&C::GetIntProp; + int (C::*get_int2)(const String&) const=&C::GetIntProp; - Real (C::*get_float1)(const String&, Real) const=&C::GetGenericFloatProperty; - Real (C::*get_float2)(const String&) const=&C::GetGenericFloatProperty; + Real (C::*get_float1)(const String&, Real) const=&C::GetFloatProp; + Real (C::*get_float2)(const String&) const=&C::GetFloatProp; - String (C::*get_str1)(const String&, const String&) const=&C::GetGenericStringProperty; - String (C::*get_str2)(const String&) const=&C::GetGenericStringProperty; + String (C::*get_str1)(const String&, const String&) const=&C::GetStringProp; + String (C::*get_str2)(const String&) const=&C::GetStringProp; bp_class - .def("HasGenericProperty", &C::HasGenericProperty) - .def("GetGenericPropertyStringRepresentation", - &C::GetGenericPropertyStringRepresentation) - .def("GetGenericBoolProperty", get_bool1) - .def("GetGenericBoolProperty", get_bool2) - .def("GetGenericFloatProperty", get_float1) - .def("GetGenericFloatProperty", get_float2) - .def("GetGenericIntProperty", get_int1) - .def("GetGenericIntProperty", get_int2) - .def("GetGenericStringProperty", get_str1) - .def("GetGenericStringProperty", get_str2) + .def("HasProp", &C::HasProp) + .def("GetPropAsString", + &C::GetPropAsString) + .def("GetBoolProp", get_bool1) + .def("GetBoolProp", get_bool2) + .def("GetFloatProp", get_float1) + .def("GetFloatProp", get_float2) + .def("GetIntProp", get_int1) + .def("GetIntProp", get_int2) + .def("GetStringProp", get_str1) + .def("GetStringProp", get_str2) + .def("GetGenericBoolProperty", &depr_get_bool_a<C>) + .def("GetGenericBoolProperty", &depr_get_bool_b<C>) + .def("GetGenericFloatProperty", &depr_get_float_a<C>) + .def("GetGenericFloatProperty", &depr_get_float_b<C>) + .def("GetGenericIntProperty", &depr_get_int_a<C>) + .def("GetGenericIntProperty", &depr_get_int_b<C>) + .def("GetGenericStringProperty", &depr_get_string_a<C>) + .def("GetGenericStringProperty", &depr_get_string_b<C>) + .def("HasGenericProperty", &depr_has_prop<C>) + .def("GetGenericPropertyStringRepresentation", &depr_prop_as_string<C>) ; } @@ -58,18 +174,17 @@ void generic_prop_def(O& bp_class) { const_generic_prop_def<C, O>(bp_class); bp_class - .def("SetGenericBoolProperty", - &C::SetGenericBoolProperty) - .def("ClearGenericProperties", - &C::ClearGenericProperties) - .def("GetGenericPropertyStringRepresentation", - &C::GetGenericPropertyStringRepresentation) - .def("SetGenericFloatProperty", - &C::SetGenericFloatProperty) - .def("SetGenericIntProperty", - &C::SetGenericIntProperty) - .def("SetGenericStringProperty", - &C::SetGenericStringProperty) + .def("SetBoolProp",&C::SetBoolProp) + .def("ClearProps", &C::ClearProps) + .def("GetPropAsString", &C::GetPropAsString) + .def("SetFloatProp", &C::SetFloatProp) + .def("SetIntProp", &C::SetIntProp) + .def("SetStringProp", &C::SetStringProp) + .def("ClearGenericProperties", &depr_clear_props<C>) + .def("SetGenericIntProperty", &depr_set_int<C>) + .def("SetGenericFloatProperty", &depr_set_float<C>) + .def("SetGenericBoolProperty", &depr_set_bool<C>) + .def("SetGenericStringProperty", &depr_set_string<C>) ; } diff --git a/modules/base/src/generic_property.hh b/modules/base/src/generic_property.hh index 3fe6f037a..4ea8d3253 100644 --- a/modules/base/src/generic_property.hh +++ b/modules/base/src/generic_property.hh @@ -22,9 +22,9 @@ /* usage: - the impl is derived from GenericPropertyContainerImpl + the impl is derived from GenericPropContainerImpl - the handle is derived from GenericPropertyContainer, and then has the + the handle is derived from GenericPropContainer, and then has the setter and getter methods for String, Real, int and bool mapping */ @@ -37,44 +37,44 @@ namespace ost { -struct TEMPLATE_EXPORT GenericPropertyError: public std::exception +struct TEMPLATE_EXPORT GenericPropError: public std::exception { - GenericPropertyError(const String& m): + GenericPropError(const String& m): m_(m) {} - virtual ~GenericPropertyError() throw() {} + virtual ~GenericPropError() throw() {} virtual const char* what() const throw() { return m_.c_str(); } String m_; }; -typedef boost::variant<String, Real, int, bool> GenericPropertyValue; +typedef boost::variant<String, Real, int, bool> GenericPropValue; /// \brief base class for the implementation -class TEMPLATE_EXPORT GenericPropertyContainerImpl +class TEMPLATE_EXPORT GenericPropContainerImpl { - typedef std::map<String,GenericPropertyValue> PropertyMap; + typedef std::map<String,GenericPropValue> PropertyMap; public: - GenericPropertyContainerImpl(): map_(NULL) {} - ~GenericPropertyContainerImpl() + GenericPropContainerImpl(): map_(NULL) {} + ~GenericPropContainerImpl() { if (map_) { delete map_; } } - GenericPropertyContainerImpl(const GenericPropertyContainerImpl& rhs): + GenericPropContainerImpl(const GenericPropContainerImpl& rhs): map_(rhs.map_ ? new PropertyMap(*rhs.map_) : NULL) { } - GenericPropertyContainerImpl& operator=(const GenericPropertyContainerImpl& r) + GenericPropContainerImpl& operator=(const GenericPropContainerImpl& r) { this->Assign(r); return *this; } - GenericPropertyValue& GenericProperty(const String& key) + GenericPropValue& GenericProp(const String& key) { if (!map_) { map_=new PropertyMap; @@ -82,7 +82,7 @@ public: return (*map_)[key]; } - const GenericPropertyValue& GenericProperty(const String& key) const + const GenericPropValue& GenericProp(const String& key) const { if (!map_) { map_=new PropertyMap; @@ -90,19 +90,19 @@ public: return (*map_)[key]; } - bool HasGenericProperty(const String& key) const + bool HasProp(const String& key) const { return map_ && map_->find(key) != map_->end(); } - void ClearGenericProperties() + void ClearProps() { if (map_) { map_->clear(); } } - void Assign(const GenericPropertyContainerImpl& impl) + void Assign(const GenericPropContainerImpl& impl) { if (impl.map_) { if (!map_) { @@ -111,11 +111,11 @@ public: *map_=*impl.map_; } } else { - this->ClearGenericProperties(); + this->ClearProps(); } } - PropertyMap GetGenericPropertyMap() const + PropertyMap GetPropMap() const { if (!map_) { map_=new PropertyMap; @@ -129,40 +129,40 @@ private: }; template <typename H> -class TEMPLATE_EXPORT ConstGenericPropertyContainer { +class TEMPLATE_EXPORT ConstGenericPropContainer { protected: template<typename T> T gp_get(const String& key) const { - if(HasGenericProperty(key)) { - return boost::get<T>(GetImpl()->GenericProperty(key)); + if(HasProp(key)) { + return boost::get<T>(GetImpl()->GenericProp(key)); } else { std::ostringstream m(""); m << "unknown property " << key; - throw GenericPropertyError(m.str()); + throw GenericPropError(m.str()); } } template<typename T> T gp_get(const String& key, const T& def) const { - if(HasGenericProperty(key)) { - return boost::get<T>(GetImpl()->GenericProperty(key)); + if(HasProp(key)) { + return boost::get<T>(GetImpl()->GenericProp(key)); } return def; } - GenericPropertyContainerImpl* GetImpl() + GenericPropContainerImpl* GetImpl() { return static_cast<H*>(this)->GpImpl(); } - const GenericPropertyContainerImpl* GetImpl() const + const GenericPropContainerImpl* GetImpl() const { return static_cast<const H*>(this)->GpImpl(); } public: /// \brief checks existence of property - bool HasGenericProperty(const String& key) const { - return this->GetImpl()->HasGenericProperty(key); + bool HasProp(const String& key) const { + return this->GetImpl()->HasProp(key); } /// \brief returns a String representation of stored value @@ -172,129 +172,129 @@ public: /// same as trying to get a generic float/int/bool property as a String type; /// the latter will result in a boost:get exception. Use this method to obtain /// a representation suitable for output. - String GetGenericPropertyStringRepresentation(const String& key) const + String GetPropAsString(const String& key) const { - if(!HasGenericProperty(key)) return ""; + if(!HasProp(key)) return ""; std::ostringstream rep(""); - rep << this->GetImpl()->GenericProperty(key); + rep << this->GetImpl()->GenericProp(key); return rep.str(); } /// \brief returns String property, raises an exception if it does not exist - String GetGenericStringProperty(const String& key) const + String GetStringProp(const String& key) const { return this->gp_get<String>(key); } /// \brief returns floating point property, raises an exception if it does /// not exist - Real GetGenericFloatProperty(const String& key) const + Real GetFloatProp(const String& key) const { - if(HasGenericProperty(key)) { - GenericPropertyValue value=this->GetImpl()->GenericProperty(key); + if(HasProp(key)) { + GenericPropValue value=this->GetImpl()->GenericProp(key); if (value.which()==1) { - return boost::get<Real>(this->GetImpl()->GenericProperty(key)); + return boost::get<Real>(this->GetImpl()->GenericProp(key)); } else if (value.which()==2) { - return boost::get<int>(this->GetImpl()->GenericProperty(key)); + return boost::get<int>(this->GetImpl()->GenericProp(key)); } std::ostringstream m(""); m << "property '" << key << "' is not numeric"; - throw GenericPropertyError(m.str()); + throw GenericPropError(m.str()); } else { std::ostringstream m(""); m << "unknown property " << key; - throw GenericPropertyError(m.str()); + throw GenericPropError(m.str()); } } /// \brief returns integer property, raises an exception if it does not exist - int GetGenericIntProperty(const String& key) const + int GetIntProp(const String& key) const { return this->gp_get<int>(key); } /// \brief returns boolean property, raises an exception if it does not exist - bool GetGenericBoolProperty(const String& key) const + bool GetBoolProp(const String& key) const { return this->gp_get<bool>(key); } /// \brief returns String property, or the given default if it does not exist - String GetGenericStringProperty(const String& key, const String& def) const + String GetStringProp(const String& key, const String& def) const { return this->gp_get<String>(key,def); } /// \brief returns floating point property, or the given default if it does /// not exist - Real GetGenericFloatProperty(const String& key, Real def) const + Real GetFloatProp(const String& key, Real def) const { - if(this->HasGenericProperty(key)) { - GenericPropertyValue value=GetImpl()->GenericProperty(key); + if(this->HasProp(key)) { + GenericPropValue value=GetImpl()->GenericProp(key); if (value.which()==1) { - return boost::get<Real>(GetImpl()->GenericProperty(key)); + return boost::get<Real>(GetImpl()->GenericProp(key)); } else if (value.which()==2) { - return boost::get<int>(GetImpl()->GenericProperty(key)); + return boost::get<int>(GetImpl()->GenericProp(key)); } std::ostringstream m(""); m << "property '" << key << "' is not numeric"; - throw GenericPropertyError(m.str()); + throw GenericPropError(m.str()); } else { return def; } } /// \brief returns integer property, or the given default if it does not exist - int GetGenericIntProperty(const String& key, int def) const + int GetIntProp(const String& key, int def) const { return this->gp_get<int>(key, def); } /// \brief returns boolean property, or the given default if it does not exist - bool GetGenericBoolProperty(const String& key, bool def) const + bool GetBoolProp(const String& key, bool def) const { return this->gp_get<bool>(key, def); } - std::map<String,GenericPropertyValue> GetGenericPropertyMap() const + std::map<String,GenericPropValue> GetPropMap() const { - return this->GetImpl()->GetGenericPropertyMap(); + return this->GetImpl()->GetPropMap(); } }; /// \brief base class for the handler classes template <typename H> -class TEMPLATE_EXPORT GenericPropertyContainer : - public ConstGenericPropertyContainer<H> +class TEMPLATE_EXPORT GenericPropContainer : + public ConstGenericPropContainer<H> { public: - void ClearGenericProperties() + void ClearProps() { - this->GetImpl()->ClearGenericProperties(); + this->GetImpl()->ClearProps(); } /// \brief sets String property - void SetGenericStringProperty(const String& key, const String& value) + void SetStringProp(const String& key, const String& value) { - this->GetImpl()->GenericProperty(key)=value; + this->GetImpl()->GenericProp(key)=value; } /// \brief sets floating point property - void SetGenericFloatProperty(const String& key, Real value) + void SetFloatProp(const String& key, Real value) { - this->GetImpl()->GenericProperty(key)=value; + this->GetImpl()->GenericProp(key)=value; } /// \brief sets integer property - void SetGenericIntProperty(const String& key, int value) + void SetIntProp(const String& key, int value) { - this->GetImpl()->GenericProperty(key)=value; + this->GetImpl()->GenericProp(key)=value; } /// \ brief sets boolean property - void SetGenericBoolProperty(const String& key, bool value) + void SetBoolProp(const String& key, bool value) { - this->GetImpl()->GenericProperty(key)=value; + this->GetImpl()->GenericProp(key)=value; } }; diff --git a/modules/base/tests/test_generic_property.cc b/modules/base/tests/test_generic_property.cc index 8b8f2a8b7..9fad50c49 100644 --- a/modules/base/tests/test_generic_property.cc +++ b/modules/base/tests/test_generic_property.cc @@ -36,30 +36,30 @@ BOOST_AUTO_TEST_CASE( test_generic_property ) AtomHandle atom2 = editor.InsertAtom(res, "Y",geom::Vec3()); BondHandle bond = editor.Connect(atom, atom2); - eh.SetGenericStringProperty("a","123"); - ch.SetGenericFloatProperty("b",1.5); - res.SetGenericIntProperty("c",123); - atom.SetGenericBoolProperty("d",true); - bond.SetGenericIntProperty("e", 12); + eh.SetStringProp("a","123"); + ch.SetFloatProp("b",1.5); + res.SetIntProp("c",123); + atom.SetBoolProp("d",true); + bond.SetIntProp("e", 12); - BOOST_CHECK(eh.HasGenericProperty("x")==false); - BOOST_CHECK(eh.HasGenericProperty("a")==true); + BOOST_CHECK(eh.HasProp("x")==false); + BOOST_CHECK(eh.HasProp("a")==true); - BOOST_CHECK(eh.GetGenericStringProperty("a")=="123"); - BOOST_CHECK(ch.GetGenericFloatProperty("b")==1.5); - BOOST_CHECK(res.GetGenericIntProperty("c")==123); - BOOST_CHECK(atom.GetGenericBoolProperty("d")==true); - BOOST_CHECK(bond.GetGenericIntProperty("e")==12); + BOOST_CHECK(eh.GetStringProp("a")=="123"); + BOOST_CHECK(ch.GetFloatProp("b")==1.5); + BOOST_CHECK(res.GetIntProp("c")==123); + BOOST_CHECK(atom.GetBoolProp("d")==true); + BOOST_CHECK(bond.GetIntProp("e")==12); EntityView ev = eh.CreateFullView(); ChainView chv = ev.FindChain("A"); ResidueView resv = ev.FindResidue(res); AtomView atomv = ev.FindAtom(atom); - BOOST_CHECK(ev.GetGenericStringProperty("a")=="123"); - BOOST_CHECK(chv.GetGenericFloatProperty("b")==1.5); - BOOST_CHECK(resv.GetGenericIntProperty("c")==123); - BOOST_CHECK(atomv.GetGenericBoolProperty("d")==true); + BOOST_CHECK(ev.GetStringProp("a")=="123"); + BOOST_CHECK(chv.GetFloatProp("b")==1.5); + BOOST_CHECK(resv.GetIntProp("c")==123); + BOOST_CHECK(atomv.GetBoolProp("d")==true); } BOOST_AUTO_TEST_SUITE_END() diff --git a/modules/bindings/pymod/dssp.py b/modules/bindings/pymod/dssp.py index af1790c79..8cb0eff7f 100644 --- a/modules/bindings/pymod/dssp.py +++ b/modules/bindings/pymod/dssp.py @@ -134,22 +134,22 @@ def LoadDSSP(file_name, model, extract_burial_status_flag=0, # set property "burial status: if extract_burial_status_flag == 1: #set default (dummy) burial status for incomplete residues: - residue.SetGenericStringProperty("burial_status", 'X') + residue.SetStringProp("burial_status", 'X') #handle seleno-methionine appearing as amino acid 'X' in DSSP: if residue.name=="MSE" and amino_acid=='X': amino_acid='M' - residue.SetGenericFloatProperty("solvent_accessibility", + residue.SetFloatProp("solvent_accessibility", solvent_accessibility) if calculate_relative_sa: relative_sa=_CalcRelativeSA(amino_acid,solvent_accessibility) - residue.SetGenericFloatProperty("relative_solvent_accessibility", + residue.SetFloatProp("relative_solvent_accessibility", relative_sa) if relative_sa < 0.25: - residue.SetGenericStringProperty("burial_status", 'b') + residue.SetStringProp("burial_status", 'b') else: - residue.SetGenericStringProperty("burial_status", 'e') + residue.SetStringProp("burial_status", 'e') except Exception, e: print "ERROR:",e continue diff --git a/modules/bindings/pymod/msms.py b/modules/bindings/pymod/msms.py index 9ae73f78a..6f36ab9fd 100644 --- a/modules/bindings/pymod/msms.py +++ b/modules/bindings/pymod/msms.py @@ -77,7 +77,7 @@ def _ParseAreaFile(entity,file, property): for l in area_lines: atom_no, sesa, sasa = l.split() a = entity.atoms[int(atom_no)] - a.SetGenericFloatProperty(property, float(sasa)) + a.SetFloatProp(property, float(sasa)) ## \brief Method which recursively deletes a directory diff --git a/modules/conop/src/ring_finder.cc b/modules/conop/src/ring_finder.cc index c3f908228..cbb9a6fb9 100755 --- a/modules/conop/src/ring_finder.cc +++ b/modules/conop/src/ring_finder.cc @@ -28,7 +28,7 @@ namespace ost { namespace conop { mol::AtomHandleList ahl=ent_.GetAtomList(); for (mol::AtomHandleList::iterator i=ahl.begin();i!=ahl.end();++i) { if (i->IsValid()) { - if (! i->HasGenericProperty("RFvisited")) { + if (! i->HasProp("RFvisited")) { // start ring search from each unvisited atom (e.g. if there are // multiple unconnected fragments) std::map<long int,bool> ring_closings; @@ -68,13 +68,13 @@ namespace ost { namespace conop { mol::EntityView view=ent_.CreateEmptyView(); mol::AtomHandleList ahl=ent_.GetAtomList(); for (mol::AtomHandleList::iterator i=ahl.begin();i!=ahl.end();++i) { - if (i->HasGenericProperty("RFinring")) { + if (i->HasProp("RFinring")) { view.AddAtom(*i); } } mol::BondHandleList bhl=ent_.GetBondList(); for (mol::BondHandeList::const_iterator j=bhl.begin();j!=bhl.end();++j) { - if (j->HasGenericProperty("RFinring")) { + if (j->HasProp("RFinring")) { view.AddBond(*j); } } @@ -88,7 +88,7 @@ namespace ost { namespace conop { std::map<long int,bool> &ring_closings) { int num_rings_start=ring_closings.size(); - curr.SetGenericBoolProperty("RFvisited",true); + curr.SetBoolProp("RFvisited",true); mol::AtomHandleList bp=curr.GetBondPartners(); for (mol::AtomHandleList::iterator i=bp.begin(); i!=bp.end(); ++i) { if ((*i)==prev) { @@ -96,27 +96,27 @@ namespace ost { namespace conop { continue; } mol::BondHandle b=curr.FindBondToAtom(*i); - if (b.HasGenericProperty("RFvisited")) { + if (b.HasProp("RFvisited")) { // do not go along previously visited bonds continue; } - b.SetGenericBoolProperty("RFvisited", true); - if (i->HasGenericProperty("RFvisited")) { + b.SetBoolProp("RFvisited", true); + if (i->HasProp("RFvisited")) { // we have found a ring ring_closings[i->GetHashCode()]=true; - b.SetGenericBoolProperty("RFinring", true); + b.SetBoolProp("RFinring", true); } else { // no ring yet - continue to next atom int num_found=VisitNext((*i),curr,ring_closings); // back from the recursion if (num_found>0) { - b.SetGenericBoolProperty("RFinring", true); + b.SetBoolProp("RFinring", true); } } } if (ring_closings.size()-num_rings_start>0) { // if current atom is in the ring closing list, remove it - curr.SetGenericBoolProperty("RFinring", true); + curr.SetBoolProp("RFinring", true); ring_closings.erase(curr.GetHashCode()); } return ring_closings.size()-num_rings_start; diff --git a/modules/conop/src/ring_finder.hh b/modules/conop/src/ring_finder.hh index fe59e111b..b5dfd9f3b 100755 --- a/modules/conop/src/ring_finder.hh +++ b/modules/conop/src/ring_finder.hh @@ -44,7 +44,7 @@ public: /// \brief Walk along the path of the entity in a depth first search and /// identify atoms and bonds which are in rings /// - /// For all atoms and bonds, belonging to a ring, the GenericBoolProperty + /// For all atoms and bonds, belonging to a ring, the BoolProp /// RFinring is set to true. The search for rings is only carried out once. /// This method does not need to be called explicitly, it will be /// automatically called if the rings have not yet been identified. diff --git a/modules/io/src/mol/entity_io_sdf_handler.cc b/modules/io/src/mol/entity_io_sdf_handler.cc index 9ec62a2e6..bbd703bc1 100644 --- a/modules/io/src/mol/entity_io_sdf_handler.cc +++ b/modules/io/src/mol/entity_io_sdf_handler.cc @@ -65,7 +65,7 @@ void EntityIOSDFHandler::Import(mol::EntityHandle& ent, std::istream& instream) while(std::getline(instream,line) && !boost::iequals(line, "")) { data_value.append(line); } - curr_chain_.SetGenericStringProperty(data_header, data_value); + curr_chain_.SetStringProp(data_header, data_value); } else if (boost::iequals(line, "$$$$")) { LOGN_MESSAGE("MOLECULE " << curr_chain_.GetName() << " (" << chain_count_ << ") added.") NextMolecule(); @@ -363,8 +363,8 @@ namespace { ostr_ << "M END" << std::endl; // write data block - std::map<String,GenericPropertyValue> prop_map = non_const_chain.GetGenericPropertyMap(); - std::map<String,GenericPropertyValue>::iterator iter; + std::map<String,GenericPropValue> prop_map = non_const_chain.GetPropMap(); + std::map<String,GenericPropValue>::iterator iter; for(iter = prop_map.begin(); iter != prop_map.end(); ++iter) { ostr_ << "> <" << (*iter).first << ">" << std::endl; ostr_ << (*iter).second << std::endl; diff --git a/modules/io/tests/test_io_sdf.cc b/modules/io/tests/test_io_sdf.cc index 4fcad509e..71c773f39 100644 --- a/modules/io/tests/test_io_sdf.cc +++ b/modules/io/tests/test_io_sdf.cc @@ -54,9 +54,9 @@ BOOST_AUTO_TEST_CASE(test_io_sdf) BOOST_CHECK(ch.IsValid()); // check properties - BOOST_CHECK(ch.HasGenericProperty("r_i_glide_rmsd")); + BOOST_CHECK(ch.HasProp("r_i_glide_rmsd")); BOOST_CHECK_EQUAL(boost::lexical_cast<Real>(boost::trim_copy - (ch.GetGenericStringProperty("r_i_glide_rmsd"))), + (ch.GetStringProp("r_i_glide_rmsd"))), 0.543804f); } diff --git a/modules/mol/base/doc/query.dox b/modules/mol/base/doc/query.dox index 7c3b7f3d5..0e4f57ce8 100644 --- a/modules/mol/base/doc/query.dox +++ b/modules/mol/base/doc/query.dox @@ -65,16 +65,16 @@ syntax: instead of rnum>=10 and rnum<=20` one can write \c rnum=10:20` \section gen_prop GenericProperties The query language can also be used for numeric generic properties (i.e. -GenericFloatProperty and GenericIntProperty), but the syntax is slightly +FloatProp and IntProp), but the syntax is slightly different. To access any generic properties, it needs to be specified that they are generic and at which level they are defined. Therefore, all generic properties start with a \c g, followed by an \c a, \c r or \c c for atom, residue or chain level respectively. \code # set generic properties for atom, residue, chain -atom_handle.SetGenericFloatProperty("testpropatom", 5.2) -resid_handle.SetGenericFloatProperty("testpropres", 1.1) -chain_handle.SetGenericIntProperty("testpropchain", 10) +atom_handle.SetFloatProp("testpropatom", 5.2) +resid_handle.SetFloatProp("testpropres", 1.1) +chain_handle.SetIntProp("testpropchain", 10) # query statements sel_a=e.Select("gatestpropatom<=10.0") diff --git a/modules/mol/base/doc/query.rst b/modules/mol/base/doc/query.rst index 8b5d26c32..20c4b711a 100644 --- a/modules/mol/base/doc/query.rst +++ b/modules/mol/base/doc/query.rst @@ -92,9 +92,9 @@ they are defined. Therefore, all generic properties start with a ``g``, followed .. code-block:: python # set generic properties for atom, residue, chain - atom_handle.SetGenericFloatProperty("testpropatom", 5.2) - resid_handle.SetGenericFloatProperty("testpropres", 1.1) - chain_handle.SetGenericIntProperty("testpropchain", 10) + atom_handle.SetFloatProp("testpropatom", 5.2) + resid_handle.SetFloatProp("testpropres", 1.1) + chain_handle.SetIntProp("testpropchain", 10) # query statements sel_a=e.Select("gatestpropatom<=10.0") diff --git a/modules/mol/base/src/atom_base.cc b/modules/mol/base/src/atom_base.cc index 9a8cfb1fc..ac0a63e73 100644 --- a/modules/mol/base/src/atom_base.cc +++ b/modules/mol/base/src/atom_base.cc @@ -29,12 +29,12 @@ AtomBase::AtomBase() AtomBase::AtomBase(const impl::AtomImplPtr& impl): impl_(impl) {} -GenericPropertyContainerImpl* AtomBase::GpImpl() +GenericPropContainerImpl* AtomBase::GpImpl() { return Impl().get(); } -const GenericPropertyContainerImpl* AtomBase::GpImpl() const +const GenericPropContainerImpl* AtomBase::GpImpl() const { return Impl().get(); } diff --git a/modules/mol/base/src/atom_base.hh b/modules/mol/base/src/atom_base.hh index 71ec8dbe8..9744f00f8 100644 --- a/modules/mol/base/src/atom_base.hh +++ b/modules/mol/base/src/atom_base.hh @@ -44,12 +44,12 @@ namespace ost { namespace mol { /// that the position of an atom is undefined when there are pending changes /// of an ICSEditor in buffered edit mode. Before calling #GetPos(), /// ICSEditor::UpdateXCS() should be called explicitly. -class DLLEXPORT_OST_MOL AtomBase: public GenericPropertyContainer<AtomBase> { +class DLLEXPORT_OST_MOL AtomBase: public GenericPropContainer<AtomBase> { public: AtomBase(); AtomBase(const impl::AtomImplPtr& impl); public: - friend class ConstGenericPropertyContainer<AtomBase>; + friend class ConstGenericPropContainer<AtomBase>; ///\brief Get atom name. /// /// In Python the atom name may also be accesssed over the property \c Name @@ -135,9 +135,9 @@ public: long GetHashCode() const; protected: - GenericPropertyContainerImpl* GpImpl(); + GenericPropContainerImpl* GpImpl(); - const GenericPropertyContainerImpl* GpImpl() const; + const GenericPropContainerImpl* GpImpl() const; void CheckValidity() const; impl::AtomImplPtr impl_; diff --git a/modules/mol/base/src/bond_handle.cc b/modules/mol/base/src/bond_handle.cc index 995f4d143..2441e5273 100644 --- a/modules/mol/base/src/bond_handle.cc +++ b/modules/mol/base/src/bond_handle.cc @@ -31,12 +31,12 @@ BondHandle::BondHandle(): BondHandle::BondHandle(const impl::ConnectorImplP& im): impl_(im) {} -GenericPropertyContainerImpl* BondHandle::GpImpl() +GenericPropContainerImpl* BondHandle::GpImpl() { return impl_.get(); } -const GenericPropertyContainerImpl* BondHandle::GpImpl() const +const GenericPropContainerImpl* BondHandle::GpImpl() const { return impl_.get(); } diff --git a/modules/mol/base/src/bond_handle.hh b/modules/mol/base/src/bond_handle.hh index 114e033a6..9d6bea4c6 100644 --- a/modules/mol/base/src/bond_handle.hh +++ b/modules/mol/base/src/bond_handle.hh @@ -32,9 +32,9 @@ namespace ost { namespace mol { /// Represents a chemical bond between two atoms (#GetFirst(), #GetSecond()). /// New bonds are created with EditorBase::Connect(). class DLLEXPORT_OST_MOL BondHandle: - public GenericPropertyContainer<BondHandle> { + public GenericPropContainer<BondHandle> { public: - friend class ConstGenericPropertyContainer<BondHandle>; + friend class ConstGenericPropContainer<BondHandle>; /// necessary dummy ctor, creates invalid handle BondHandle(); /// ctor for internal use, in public interface for convenience purposes @@ -113,9 +113,9 @@ public: protected: - GenericPropertyContainerImpl* GpImpl(); + GenericPropContainerImpl* GpImpl(); - const GenericPropertyContainerImpl* GpImpl() const; + const GenericPropContainerImpl* GpImpl() const; void CheckValidity() const; private: impl::ConnectorImplP impl_; diff --git a/modules/mol/base/src/chain_base.cc b/modules/mol/base/src/chain_base.cc index 29a40f3a2..aef8bc19a 100644 --- a/modules/mol/base/src/chain_base.cc +++ b/modules/mol/base/src/chain_base.cc @@ -28,13 +28,13 @@ ChainBase::ChainBase() ChainBase::ChainBase(const impl::ChainImplPtr& impl): impl_(impl) {} -GenericPropertyContainerImpl* ChainBase::GpImpl() +GenericPropContainerImpl* ChainBase::GpImpl() { return impl_.get(); } -const GenericPropertyContainerImpl* ChainBase::GpImpl() const +const GenericPropContainerImpl* ChainBase::GpImpl() const { return impl_.get(); } diff --git a/modules/mol/base/src/chain_base.hh b/modules/mol/base/src/chain_base.hh index c8de6551b..68e0d4bf8 100644 --- a/modules/mol/base/src/chain_base.hh +++ b/modules/mol/base/src/chain_base.hh @@ -36,13 +36,13 @@ namespace ost { namespace mol { /// Chains are linear chains of \ref ResidueHandle "residues". Peptide chains are /// ordered from N- to C-terminus. class DLLEXPORT_OST_MOL ChainBase: - public GenericPropertyContainer<ChainBase> { + public GenericPropContainer<ChainBase> { public: // constructors ChainBase(); ChainBase(const impl::ChainImplPtr& impl); public: - friend class ConstGenericPropertyContainer<ChainBase>; + friend class ConstGenericPropContainer<ChainBase>; String GetName() const; /// \name Handle validity //@{ @@ -66,9 +66,9 @@ public: return impl_; } protected: - GenericPropertyContainerImpl* GpImpl(); + GenericPropContainerImpl* GpImpl(); - const GenericPropertyContainerImpl* GpImpl() const; + const GenericPropContainerImpl* GpImpl() const; void CheckValidity() const; private: diff --git a/modules/mol/base/src/entity_base.cc b/modules/mol/base/src/entity_base.cc index df3fc636e..16ea851d9 100644 --- a/modules/mol/base/src/entity_base.cc +++ b/modules/mol/base/src/entity_base.cc @@ -36,12 +36,12 @@ impl::EntityImplPtr& EntityBase::Impl() { const impl::EntityImplPtr& EntityBase::Impl() const { return impl_; } -GenericPropertyContainerImpl* EntityBase::GpImpl() +GenericPropContainerImpl* EntityBase::GpImpl() { return Impl().get(); } -const GenericPropertyContainerImpl* EntityBase::GpImpl() const +const GenericPropContainerImpl* EntityBase::GpImpl() const { return Impl().get(); } diff --git a/modules/mol/base/src/entity_base.hh b/modules/mol/base/src/entity_base.hh index 05228c56f..9c4fe8922 100644 --- a/modules/mol/base/src/entity_base.hh +++ b/modules/mol/base/src/entity_base.hh @@ -28,9 +28,9 @@ namespace ost { namespace mol { /// \brief definition of EntityBase class DLLEXPORT_OST_MOL EntityBase: - public GenericPropertyContainer<EntityBase> { + public GenericPropContainer<EntityBase> { public: - friend class ConstGenericPropertyContainer<EntityBase>; + friend class ConstGenericPropContainer<EntityBase>; EntityBase(const impl::EntityImplPtr& impl); EntityBase(); @@ -65,9 +65,9 @@ public: const impl::EntityImplPtr& Impl() const; protected: - GenericPropertyContainerImpl* GpImpl(); + GenericPropContainerImpl* GpImpl(); - const GenericPropertyContainerImpl* GpImpl() const; + const GenericPropContainerImpl* GpImpl() const; void CheckValidity() const; private: diff --git a/modules/mol/base/src/entity_property_mapper.cc b/modules/mol/base/src/entity_property_mapper.cc index 0e74f6ab8..c6cd606b3 100644 --- a/modules/mol/base/src/entity_property_mapper.cc +++ b/modules/mol/base/src/entity_property_mapper.cc @@ -52,17 +52,17 @@ Real EntityPropertyMapper::get_property(const T& atom, Real def_value) const switch(prop_.level) { case Prop::ATOM: if (B) { - return atom.GetGenericFloatProperty(prop_name_, def_value); + return atom.GetFloatProp(prop_name_, def_value); } else { - return atom.GetGenericFloatProperty(prop_name_); + return atom.GetFloatProp(prop_name_); } case Prop::RESIDUE: if (B) { - Real value=atom.GetResidue().GetGenericFloatProperty(prop_name_, + Real value=atom.GetResidue().GetFloatProp(prop_name_, def_value); return value; } else { - return atom.GetResidue().GetGenericFloatProperty(prop_name_); + return atom.GetResidue().GetFloatProp(prop_name_); } default: return def_value; @@ -98,12 +98,12 @@ Real EntityPropertyMapper::Get(const AtomView& atom, Real EntityPropertyMapper::Get(const ResidueView& res) const { - return res.GetGenericFloatProperty(prop_name_); + return res.GetFloatProp(prop_name_); } Real EntityPropertyMapper::Get(const ResidueHandle& res) const { - return res.GetGenericFloatProperty(prop_name_); + return res.GetFloatProp(prop_name_); } @@ -111,13 +111,13 @@ Real EntityPropertyMapper::Get(const ResidueHandle& res) const Real EntityPropertyMapper::Get(const ResidueHandle& res, Real def_value) const { - return res.GetGenericFloatProperty(prop_name_, def_value); + return res.GetFloatProp(prop_name_, def_value); } Real EntityPropertyMapper::Get(const ResidueView& res, Real def_value) const { - return res.GetGenericFloatProperty(prop_name_, def_value); + return res.GetFloatProp(prop_name_, def_value); } @@ -127,12 +127,12 @@ Real EntityPropertyMapper::Get(const ResidueView& res, Real EntityPropertyMapper::Get(const ChainView& chain) const { - return chain.GetGenericFloatProperty(prop_name_); + return chain.GetFloatProp(prop_name_); } Real EntityPropertyMapper::Get(const ChainHandle& chain) const { - return chain.GetGenericFloatProperty(prop_name_); + return chain.GetFloatProp(prop_name_); } @@ -140,13 +140,13 @@ Real EntityPropertyMapper::Get(const ChainHandle& chain) const Real EntityPropertyMapper::Get(const ChainHandle& chain, Real def_value) const { - return chain.GetGenericFloatProperty(prop_name_, def_value); + return chain.GetFloatProp(prop_name_, def_value); } Real EntityPropertyMapper::Get(const ChainView& chain, Real def_value) const { - return chain.GetGenericFloatProperty(prop_name_, def_value); + return chain.GetFloatProp(prop_name_, def_value); } }} //ns diff --git a/modules/mol/base/src/impl/atom_impl.hh b/modules/mol/base/src/impl/atom_impl.hh index f3c2cc1c0..b24abc85c 100644 --- a/modules/mol/base/src/impl/atom_impl.hh +++ b/modules/mol/base/src/impl/atom_impl.hh @@ -46,7 +46,7 @@ namespace ost { namespace mol { namespace impl { /// coordinates. the secondary connectors connect this atom with the atoms that /// themselves depend on the coordinate system of this atom. /// \internal -class AtomImpl: public GenericPropertyContainerImpl, +class AtomImpl: public GenericPropContainerImpl, public boost::enable_shared_from_this<AtomImpl> { public: AtomImpl(const EntityImplPtr& ent, const ResidueImplPtr& res, diff --git a/modules/mol/base/src/impl/chain_impl.hh b/modules/mol/base/src/impl/chain_impl.hh index 24d5b4009..644bed1e7 100644 --- a/modules/mol/base/src/impl/chain_impl.hh +++ b/modules/mol/base/src/impl/chain_impl.hh @@ -38,7 +38,7 @@ namespace ost { namespace mol {namespace impl { /// \internal -class ChainImpl: public GenericPropertyContainerImpl, +class ChainImpl: public GenericPropContainerImpl, public boost::enable_shared_from_this<ChainImpl> { public: diff --git a/modules/mol/base/src/impl/connector_impl.hh b/modules/mol/base/src/impl/connector_impl.hh index e0e0c0528..2898a237d 100644 --- a/modules/mol/base/src/impl/connector_impl.hh +++ b/modules/mol/base/src/impl/connector_impl.hh @@ -32,7 +32,7 @@ namespace ost { namespace mol { namespace impl { -class ConnectorImpl: public GenericPropertyContainerImpl, +class ConnectorImpl: public GenericPropContainerImpl, public boost::enable_shared_from_this<ConnectorImpl> { public: ConnectorImpl(const EntityImplPtr& e, const AtomImplPtr& first, diff --git a/modules/mol/base/src/impl/entity_impl.hh b/modules/mol/base/src/impl/entity_impl.hh index ebe32704b..63504c749 100644 --- a/modules/mol/base/src/impl/entity_impl.hh +++ b/modules/mol/base/src/impl/entity_impl.hh @@ -80,7 +80,7 @@ typedef enum { /// \internal -class EntityImpl: public GenericPropertyContainerImpl, +class EntityImpl: public GenericPropContainerImpl, public boost::enable_shared_from_this<EntityImpl> { public: diff --git a/modules/mol/base/src/impl/residue_impl.hh b/modules/mol/base/src/impl/residue_impl.hh index 6a36a75bc..22e816b6e 100644 --- a/modules/mol/base/src/impl/residue_impl.hh +++ b/modules/mol/base/src/impl/residue_impl.hh @@ -43,7 +43,7 @@ namespace ost { namespace mol { namespace impl { /// \internal /// \brief Residue implementation -class ResidueImpl: public GenericPropertyContainerImpl, +class ResidueImpl: public GenericPropContainerImpl, public boost::enable_shared_from_this<ResidueImpl> { diff --git a/modules/mol/base/src/property_id.hh b/modules/mol/base/src/property_id.hh index 6c06e7ef3..dfc984bc2 100644 --- a/modules/mol/base/src/property_id.hh +++ b/modules/mol/base/src/property_id.hh @@ -36,7 +36,7 @@ public: /// it is used as an index to determine in which order the generic properties /// where specified in the query string. /// GenericProperties are defined with gapropname, grpropname, gcpropname for - /// the GenericProperty 'propname' at the atom, residue and chain level + /// the GenericProp 'propname' at the atom, residue and chain level /// respectively. typedef enum { RNAME, ANAME, CNAME, ELE, RNUM, ANUM, AX, AY, AZ, OCC, RTYPE, ISHETATM, diff --git a/modules/mol/base/src/query.hh b/modules/mol/base/src/query.hh index b67978511..a064629cb 100644 --- a/modules/mol/base/src/query.hh +++ b/modules/mol/base/src/query.hh @@ -56,7 +56,7 @@ namespace ost { namespace mol { /// resulting view. /// /// For matching GenericProperties, use gapropname, grpropname, gcpropname for -/// the GenericProperty 'propname' at the atom, residue and chain level +/// the GenericProp 'propname' at the atom, residue and chain level /// respectively. The g marks the property as generic. struct DLLEXPORT_OST_MOL QueryFlag { typedef enum { diff --git a/modules/mol/base/src/residue_base.cc b/modules/mol/base/src/residue_base.cc index 60e684806..f4ce54ee5 100644 --- a/modules/mol/base/src/residue_base.cc +++ b/modules/mol/base/src/residue_base.cc @@ -34,12 +34,12 @@ ResidueBase::ResidueBase(const impl::ResidueImplPtr& impl): impl_(impl) {} -GenericPropertyContainerImpl* ResidueBase::GpImpl() +GenericPropContainerImpl* ResidueBase::GpImpl() { return Impl().get(); } -const GenericPropertyContainerImpl* ResidueBase::GpImpl() const +const GenericPropContainerImpl* ResidueBase::GpImpl() const { return Impl().get(); } diff --git a/modules/mol/base/src/residue_base.hh b/modules/mol/base/src/residue_base.hh index 0aabe77a3..69749ed49 100644 --- a/modules/mol/base/src/residue_base.hh +++ b/modules/mol/base/src/residue_base.hh @@ -57,13 +57,13 @@ namespace ost { namespace mol { /// When loading an entity from file, the one-letter and chemical class of a /// residue are assigned by the \ref conop::Builder "default builder". class DLLEXPORT_OST_MOL ResidueBase: - public GenericPropertyContainer<ResidueBase> { + public GenericPropContainer<ResidueBase> { public: ResidueBase(); ResidueBase(const impl::ResidueImplPtr& impl); ResidueBase(const ResidueBase& rhs); public: - friend class ConstGenericPropertyContainer<ResidueBase>; + friend class ConstGenericPropContainer<ResidueBase>; /// \brief return residue number const ResNum& GetNumber() const; @@ -145,9 +145,9 @@ public: const impl::ResidueImplPtr& Impl() const; protected: - GenericPropertyContainerImpl* GpImpl(); + GenericPropContainerImpl* GpImpl(); - const GenericPropertyContainerImpl* GpImpl() const; + const GenericPropContainerImpl* GpImpl() const; void CheckValidity() const; private: impl::ResidueImplPtr impl_; diff --git a/modules/mol/base/tests/test_query.cc b/modules/mol/base/tests/test_query.cc index 1b5074444..3dd125e44 100644 --- a/modules/mol/base/tests/test_query.cc +++ b/modules/mol/base/tests/test_query.cc @@ -33,9 +33,9 @@ EntityHandle make_query_test_entity() EntityHandle eh = CreateEntity(); XCSEditor e=eh.RequestXCSEditor(); ChainHandle chain = e.InsertChain("A"); - chain.SetGenericFloatProperty("testpropc", 1.0); + chain.SetFloatProp("testpropc", 1.0); ResidueHandle res = e.AppendResidue(chain, "MET"); - res.SetGenericFloatProperty("testpropr", 1.0); + res.SetFloatProp("testpropr", 1.0); AtomProp c_atom; c_atom.element="C"; c_atom.radius=1.0; @@ -51,7 +51,7 @@ EntityHandle make_query_test_entity() s_atom.element="S"; s_atom.radius=1.0; AtomHandle ah=e.InsertAtom(res, "N",geom::Vec3(21.609,35.384,56.705), n_atom); - ah.SetGenericFloatProperty("testpropa", 1.0); + ah.SetFloatProp("testpropa", 1.0); e.InsertAtom(res, "CA",geom::Vec3(20.601,35.494,57.793), c_atom); e.InsertAtom(res, "C",geom::Vec3(19.654,34.300,57.789), c_atom); e.InsertAtom(res, "O",geom::Vec3(18.447,34.456,57.595), o_atom); diff --git a/modules/seq/base/src/impl/sequence_impl.hh b/modules/seq/base/src/impl/sequence_impl.hh index 6ac241970..d6159402b 100644 --- a/modules/seq/base/src/impl/sequence_impl.hh +++ b/modules/seq/base/src/impl/sequence_impl.hh @@ -43,7 +43,7 @@ class SequenceImpl; typedef boost::shared_ptr<SequenceImpl> SequenceImplPtr; /// \internal -class DLLEXPORT_OST_SEQ SequenceImpl : public GenericPropertyContainerImpl { +class DLLEXPORT_OST_SEQ SequenceImpl : public GenericPropContainerImpl { public: /// \brief Construct new sequence object from sequence_string. static SequenceImplPtr FromString(const String& seq_name, diff --git a/modules/seq/base/src/sequence_handle.cc b/modules/seq/base/src/sequence_handle.cc index 60216f9ae..eeb3d1acb 100644 --- a/modules/seq/base/src/sequence_handle.cc +++ b/modules/seq/base/src/sequence_handle.cc @@ -349,22 +349,22 @@ const String& SequenceHandle::GetString() const return Impl()->GetString(); } -GenericPropertyContainerImpl* ConstSequenceHandle::GpImpl() +GenericPropContainerImpl* ConstSequenceHandle::GpImpl() { return Impl().get(); } -const GenericPropertyContainerImpl* ConstSequenceHandle::GpImpl() const +const GenericPropContainerImpl* ConstSequenceHandle::GpImpl() const { return Impl().get(); } -GenericPropertyContainerImpl* SequenceHandle::GpImpl() +GenericPropContainerImpl* SequenceHandle::GpImpl() { return Impl().get(); } -const GenericPropertyContainerImpl* SequenceHandle::GpImpl() const +const GenericPropContainerImpl* SequenceHandle::GpImpl() const { return Impl().get(); } diff --git a/modules/seq/base/src/sequence_handle.hh b/modules/seq/base/src/sequence_handle.hh index c76c3298c..ad4d294e3 100644 --- a/modules/seq/base/src/sequence_handle.hh +++ b/modules/seq/base/src/sequence_handle.hh @@ -43,9 +43,9 @@ class AlignmentHandle; /// The ConstSequenceHandle provides all read-only methods of the /// \ref SequenceHandle "sequence handle". class DLLEXPORT_OST_SEQ ConstSequenceHandle : - public ConstGenericPropertyContainer<ConstSequenceHandle> { + public ConstGenericPropContainer<ConstSequenceHandle> { public: - friend class ConstGenericPropertyContainer<ConstSequenceHandle>; + friend class ConstGenericPropContainer<ConstSequenceHandle>; friend class AlignmentHandle; friend class ConstSequenceList; friend class SequenceList; @@ -120,9 +120,9 @@ public: bool IsValid() const; /// \internal protected: - GenericPropertyContainerImpl* GpImpl(); + GenericPropContainerImpl* GpImpl(); - const GenericPropertyContainerImpl* GpImpl() const; + const GenericPropContainerImpl* GpImpl() const; public: ConstSequenceHandle(const impl::SequenceImplPtr& impl); impl::SequenceImplPtr& Impl() const; @@ -154,9 +154,9 @@ private: /// Sequences IO is dealt with in the sequence module. For more information, /// consult \ref module_seq "this page". class DLLEXPORT_OST_SEQ SequenceHandle : - public GenericPropertyContainer<SequenceHandle> { + public GenericPropContainer<SequenceHandle> { public: - friend class GenericPropertyContainer<SequenceHandle>; + friend class GenericPropContainer<SequenceHandle>; friend class SequenceList; friend class AlignmentHandle; @@ -261,9 +261,9 @@ public: impl::SequenceImplPtr& Impl() const; - GenericPropertyContainerImpl* GpImpl(); + GenericPropContainerImpl* GpImpl(); - const GenericPropertyContainerImpl* GpImpl() const; + const GenericPropContainerImpl* GpImpl() const; private: void CheckValidity() const; mutable impl::SequenceImplPtr impl_; -- GitLab