From 5485d42efba261c8879d1208c31d9cd5d18c303d Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Thu, 21 Mar 2013 00:00:06 -0700
Subject: gras: combine block property headers

---
 include/gras/detail/block.hpp    | 43 +++++++++++++++++++++++++++++-
 include/gras/detail/property.hpp | 56 ----------------------------------------
 2 files changed, 42 insertions(+), 57 deletions(-)
 delete mode 100644 include/gras/detail/property.hpp

(limited to 'include/gras/detail')

diff --git a/include/gras/detail/block.hpp b/include/gras/detail/block.hpp
index 588c3cc..2a48080 100644
--- a/include/gras/detail/block.hpp
+++ b/include/gras/detail/block.hpp
@@ -6,6 +6,47 @@
 namespace gras
 {
 
+struct GRAS_API PropertyRegistry
+{
+    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>
+class PropertyRegistryImpl : public PropertyRegistry
+{
+public:
+    PropertyRegistryImpl(
+        ClassType *my_class,
+        ValueType(ClassType::*getter)(void),
+        void(ClassType::*setter)(const ValueType &)
+    ):
+        _my_class(my_class),
+        _getter(getter),
+        _setter(setter)
+    {}
+    virtual ~PropertyRegistryImpl(void){}
+
+    void set(const PMCC &value)
+    {
+        (_my_class->*_setter)(value.as<ValueType>());
+    }
+
+    PMCC get(void)
+    {
+        return PMC_M((_my_class->*_getter)());
+    }
+
+private:
+    ClassType *_my_class;
+    ValueType(ClassType::*_getter)(void);
+    void(ClassType::*_setter)(const ValueType &);
+};
+
 /*!
  * The following functions implement the templated methods in Block
  */
@@ -19,7 +60,7 @@ inline void Block::register_property(
 {
     PropertyRegistrySptr pr;
     pr.reset(new PropertyRegistryImpl<ClassType, ValueType>((ClassType *)this, get, set));
-    this->_register_property(key, pr);
+    this->_register_property(key, PMC_M(pr));
 }
 
 template <typename ValueType>
diff --git a/include/gras/detail/property.hpp b/include/gras/detail/property.hpp
deleted file mode 100644
index 2fcdca0..0000000
--- a/include/gras/detail/property.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information.
-
-#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 GRAS_API PropertyRegistry
-{
-    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>
-class PropertyRegistryImpl : public PropertyRegistry
-{
-public:
-    PropertyRegistryImpl(
-        ClassType *my_class,
-        ValueType(ClassType::*getter)(void),
-        void(ClassType::*setter)(const ValueType &)
-    ):
-        _my_class(my_class),
-        _getter(getter),
-        _setter(setter)
-    {}
-    virtual ~PropertyRegistryImpl(void){}
-
-    void set(const PMCC &value)
-    {
-        (_my_class->*_setter)(value.as<ValueType>());
-    }
-
-    PMCC get(void)
-    {
-        return PMC_M((_my_class->*_getter)());
-    }
-
-private:
-    ClassType *_my_class;
-    ValueType(ClassType::*_getter)(void);
-    void(ClassType::*_setter)(const ValueType &);
-};
-
-} //namespace gras
-
-#endif /*INCLUDED_GRAS_DETAIL_PROPERTY_HPP*/
-- 
cgit