summaryrefslogtreecommitdiff
path: root/include/gras/detail
diff options
context:
space:
mode:
Diffstat (limited to 'include/gras/detail')
-rw-r--r--include/gras/detail/block.hpp8
-rw-r--r--include/gras/detail/property.hpp25
2 files changed, 12 insertions, 21 deletions
diff --git a/include/gras/detail/block.hpp b/include/gras/detail/block.hpp
index 483b2bf..a8bc2b1 100644
--- a/include/gras/detail/block.hpp
+++ b/include/gras/detail/block.hpp
@@ -13,21 +13,21 @@ GRAS_FORCE_INLINE void Block::register_property(
void(ClassType::*set)(const ValueType &)
)
{
- boost::shared_ptr<PropertyRegistry> pr;
+ PropertyRegistrySptr pr;
pr.reset(new PropertyRegistryImpl<ClassType, ValueType>(this, get, set));
- this->property_interface_register(key, pr);
+ this->_register_property(key, pr);
}
template <typename ValueType>
GRAS_FORCE_INLINE void Block::set_property(const std::string &key, const ValueType &value)
{
- return this->property_interface_set(key, PMC_M(value));
+ return this->_set_property(key, PMC_M(value));
}
template <typename ValueType>
GRAS_FORCE_INLINE ValueType Block::get_property(const std::string &key)
{
- return this->property_interface_get(key).as<ValueType>();
+ return this->_get_property(key).as<ValueType>();
}
} //namespace gras
diff --git a/include/gras/detail/property.hpp b/include/gras/detail/property.hpp
index 467fb70..fd13025 100644
--- a/include/gras/detail/property.hpp
+++ b/include/gras/detail/property.hpp
@@ -3,19 +3,23 @@
#ifndef INCLUDED_GRAS_DETAIL_PROPERTY_HPP
#define INCLUDED_GRAS_DETAIL_PROPERTY_HPP
+#include <gras/gras.hpp>
#include <PMC/PMC.hpp>
+#include <boost/shared_ptr.hpp>
namespace gras
{
-struct PropertyRegistry
+struct GRAS_API PropertyRegistry
{
- PropertyRegistry(void){}
- ~PropertyRegistry(void){}
+ PropertyRegistry(void);
+ virtual ~PropertyRegistry(void);
virtual void set(const PMCC &) = 0;
virtual PMCC get(void) = 0;
};
+typedef boost::shared_ptr<PropertyRegistry> PropertyRegistrySptr;
+
template <typename ClassType, typename ValueType>
struct PropertyRegistryImpl : PropertyRegistry
{
@@ -28,7 +32,7 @@ struct PropertyRegistryImpl : PropertyRegistry
_getter(getter),
_setter(setter)
{}
- ~PropertyRegistryImpl(void){}
+ virtual ~PropertyRegistryImpl(void){}
void set(const PMCC &value)
{
@@ -45,19 +49,6 @@ struct PropertyRegistryImpl : PropertyRegistry
void(ClassType::*_setter)(const ValueType &);
};
-struct PropertyInterface
-{
- virtual void property_interface_register(
- const std::string &key,
- boost::shared_ptr<PropertyRegistry> pr
- ) = 0;
-
- virtual void property_interface_set(const std::string &key, const PMCC &value) = 0;
-
- virtual PMCC property_interface_get(const std::string &key) = 0;
-
-};
-
} //namespace gras
#endif /*INCLUDED_GRAS_DETAIL_PROPERTY_HPP*/