Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54328 - in sandbox/monotonic: boost/object_model boost/object_model/generic boost/object_model/type libs/monotonic/test/Tests libs/object_model/src/generic libs/object_model/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-25 00:34:02


Author: cschladetsch
Date: 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
New Revision: 54328
URL: http://svn.boost.org/trac/boost/changeset/54328

Log:
added object creation/deletion via registry

Text files modified:
   sandbox/monotonic/boost/object_model/builder.hpp | 2
   sandbox/monotonic/boost/object_model/class.hpp | 5 +
   sandbox/monotonic/boost/object_model/dereference.hpp | 2
   sandbox/monotonic/boost/object_model/dictionary.hpp | 2
   sandbox/monotonic/boost/object_model/exceptions.hpp | 2
   sandbox/monotonic/boost/object_model/forward_declarations.hpp | 2
   sandbox/monotonic/boost/object_model/generic/base.hpp | 2
   sandbox/monotonic/boost/object_model/generic/class.hpp | 2
   sandbox/monotonic/boost/object_model/generic/object.hpp | 46 ++++++++++++--------
   sandbox/monotonic/boost/object_model/generic/registry.hpp | 3
   sandbox/monotonic/boost/object_model/generic/storage.hpp | 2
   sandbox/monotonic/boost/object_model/handle.hpp | 2
   sandbox/monotonic/boost/object_model/label.hpp | 2
   sandbox/monotonic/boost/object_model/object.hpp | 2
   sandbox/monotonic/boost/object_model/registry.hpp | 65 ++++++++++++++++++++++++++--
   sandbox/monotonic/boost/object_model/storage.hpp | 2
   sandbox/monotonic/boost/object_model/template_header.hpp | 2
   sandbox/monotonic/boost/object_model/type/builtins.hpp | 2
   sandbox/monotonic/boost/object_model/type/number.hpp | 2
   sandbox/monotonic/boost/object_model/type/traits.hpp | 7 --
   sandbox/monotonic/libs/monotonic/test/Tests/Tests.vcproj | 2
   sandbox/monotonic/libs/object_model/src/generic/object.cpp | 89 ++++++++++++++++++++++++++++++++++++++-
   sandbox/monotonic/libs/object_model/test/basic_tests.cpp | 40 ++++++++++++++++-
   23 files changed, 231 insertions(+), 56 deletions(-)

Modified: sandbox/monotonic/boost/object_model/builder.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/builder.hpp (original)
+++ sandbox/monotonic/boost/object_model/builder.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -50,7 +50,7 @@
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_BUILDER_HPP
 

Modified: sandbox/monotonic/boost/object_model/class.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/class.hpp (original)
+++ sandbox/monotonic/boost/object_model/class.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -36,15 +36,16 @@
                 return *store;
         }
 
- void destroy(generic::storage &) const
+ void destroy(generic::storage &obj) const
         {
+ allocator.destroy(&static_cast<storage<T> &>(obj));
         }
 
 };
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_CLASS_HPP
 

Modified: sandbox/monotonic/boost/object_model/dereference.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/dereference.hpp (original)
+++ sandbox/monotonic/boost/object_model/dereference.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -28,7 +28,7 @@
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_DEREFERENCE_HPP
 

Modified: sandbox/monotonic/boost/object_model/dictionary.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/dictionary.hpp (original)
+++ sandbox/monotonic/boost/object_model/dictionary.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -23,7 +23,7 @@
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_DICTIONARY_HPP
 

Modified: sandbox/monotonic/boost/object_model/exceptions.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/exceptions.hpp (original)
+++ sandbox/monotonic/boost/object_model/exceptions.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -31,7 +31,7 @@
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_EXCEPTIONS_HPP
 

Modified: sandbox/monotonic/boost/object_model/forward_declarations.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/forward_declarations.hpp (original)
+++ sandbox/monotonic/boost/object_model/forward_declarations.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -128,7 +128,7 @@
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_FORWARD_DECLARATIONS_HPP
 

Modified: sandbox/monotonic/boost/object_model/generic/base.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/generic/base.hpp (original)
+++ sandbox/monotonic/boost/object_model/generic/base.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -31,7 +31,7 @@
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_GENERIC_BASE_HPP
 

Modified: sandbox/monotonic/boost/object_model/generic/class.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/generic/class.hpp (original)
+++ sandbox/monotonic/boost/object_model/generic/class.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -50,7 +50,7 @@
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_GENERIC_CLASS_HPP
 

Modified: sandbox/monotonic/boost/object_model/generic/object.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/generic/object.hpp (original)
+++ sandbox/monotonic/boost/object_model/generic/object.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -28,41 +28,40 @@
 
                 object_base();
                 object_base(const object_base&);
+ object_base(const const_storage&);
 
                 template <class T, class Al> friend struct object_model::klass;
 
                 void construct(registry &, klass const &, handle);
- };
-
- struct const_object : object_base
- {
-
- protected:
 
         public:
- const_object();
- const_object(const const_object &);
- const_object(const object &);
- const_object &operator=(const const_object &);
-
                 klass const &get_class() const;
- type::number const &get_type_number() const;
+ type::number get_type_number() const;
                 registry &get_registry() const;
+ handle get_handle() const;
 
                 const storage &get_storage() const;
-
                 bool exists() const;
 
                 template <class T>
                 bool is_type() const
                 {
- return get_type_number() == type::traits<T>::type_number.value;
+ return get_type_number() == type::traits<T>::type_number;
                 }
         };
 
- struct mutable_object : const_object
+ struct const_object : object_base
         {
- storage &get_storage();
+
+ protected:
+
+ public:
+// const_object();
+ //const_object(const const_storage &);
+ //const_object(const const_object &);
+ //const_object(const object &);
+ //const_object &operator=(const const_object &);
+
         };
 
         // can be const or mutable
@@ -73,16 +72,25 @@
 
         public:
                 object();
-
                 object(const const_object&);
                 object(const mutable_object&);
- object(const object&);
+// object(const object&);
                 object(const storage &);
                 object(const const_storage &);
 
                 object &operator=(const const_object&);
                 object &operator=(const mutable_object&);
- object &operator=(const object&);
+// object &operator=(const object&);
+
+ bool is_const() const { return konst; }
+ storage &get_storage();
+ };
+
+ struct mutable_object : const_object
+ {
+ mutable_object();
+ mutable_object(storage &);
+ mutable_object(const object &obj) : const_object(obj) { }
 
                 storage &get_storage();
         };

Modified: sandbox/monotonic/boost/object_model/generic/registry.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/generic/registry.hpp (original)
+++ sandbox/monotonic/boost/object_model/generic/registry.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -22,12 +22,13 @@
         {
         public:
 
+ virtual bool exists(handle) const = 0;
         };
 }
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_GENERIC_REGISTRY_HPP
 

Modified: sandbox/monotonic/boost/object_model/generic/storage.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/generic/storage.hpp (original)
+++ sandbox/monotonic/boost/object_model/generic/storage.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -29,7 +29,7 @@
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_GENERIC_STORAGE_HPP
 

Modified: sandbox/monotonic/boost/object_model/handle.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/handle.hpp (original)
+++ sandbox/monotonic/boost/object_model/handle.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -45,7 +45,7 @@
 
 BOOST_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_HANDLE_HPP
 

Modified: sandbox/monotonic/boost/object_model/label.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/label.hpp (original)
+++ sandbox/monotonic/boost/object_model/label.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -52,7 +52,7 @@
 
 BOOST_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_LABEL_HPP
 

Modified: sandbox/monotonic/boost/object_model/object.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/object.hpp (original)
+++ sandbox/monotonic/boost/object_model/object.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -39,7 +39,7 @@
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_OBJECT_HPP
 

Modified: sandbox/monotonic/boost/object_model/registry.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/registry.hpp (original)
+++ sandbox/monotonic/boost/object_model/registry.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -9,10 +9,13 @@
 #ifndef BOOST_OBJECT_MODEL_REGISTRY_HPP
 #define BOOST_OBJECT_MODEL_REGISTRY_HPP
 
+#include <map>
+#include <boost/unordered/unordered_map.hpp>
+#include <boost/foreach.hpp>
+
 #include <boost/object_model/detail/prefix.hpp>
 #include <boost/object_model/generic/registry.hpp>
 #include <boost/object_model/type/number.hpp>
-#include <boost/unordered/unordered_map.hpp>
 
 BOOST_OM_BEGIN
 
@@ -21,8 +24,10 @@
 struct registry : generic::registry
 {
         typedef Allocator allocator_type;
- typedef boost::unordered_map<handle, generic::storage *, hash<handle>, std::less<handle>, Allocator> instances_type;
- typedef boost::unordered_map<type::number, generic::klass const *, hash<type::number>, std::less<type::number>, Allocator> classes_type;
+ //typedef boost::unordered_map<handle, generic::storage *, hash<handle>, std::less<handle>, Allocator> instances_type;
+ //typedef boost::unordered_map<type::number, generic::klass const *, hash<type::number>, std::less<type::number>, Allocator> classes_type;
+ typedef std::map<handle, generic::storage *, std::less<handle>, allocator_type> instances_type;
+ typedef std::map<type::number, generic::klass const *, std::less<type::number>, allocator_type> classes_type;
 
 protected:
         allocator_type allocator;
@@ -34,6 +39,46 @@
         registry()
         {
         }
+ ~registry()
+ {
+ clear();
+ }
+ void clear()
+ {
+ BOOST_FOREACH(typename instances_type::value_type &val, instances)
+ {
+ destroy(*val.second);
+ }
+ instances.clear();
+ }
+ void destroy(generic::mutable_object obj)
+ {
+ instances_type::iterator val = instances.find(obj.get_handle());
+ if (val == instances.end())
+ {
+ return;
+ }
+ obj.get_class().destroy(*val->second);
+ instances.erase(val);
+ }
+
+ size_t num_classes() const
+ {
+ return classes.size();
+ }
+ size_t num_instances() const
+ {
+ return instances.size();
+ }
+
+ bool exists(const generic::const_object &obj) const
+ {
+ return exists(obj.get_handle());
+ }
+ bool exists(handle h) const
+ {
+ return instances.find(h) != instances.end();
+ }
 
         allocator_type &get_allocator()
         {
@@ -43,9 +88,10 @@
         template <class T>
         klass<T> *register_class()
         {
+ BOOST_ASSERT(!has_class<T>());
                 klass<T> *new_class = allocator_create<klass<T> >(*this);
- BOOST_ASSERT(classes.find(new_class->get_type_number()) == classes.end());
                 classes[new_class->get_type_number()] = new_class;
+ BOOST_ASSERT(classes.find(new_class->get_type_number()) != classes.end());
                 return new_class;
         }
 
@@ -60,10 +106,17 @@
                 instances[h] = &obj;
                 return obj;
         }
+
+ template <class T>
+ bool has_class() const
+ {
+ return get_class<T>() != 0;
+ }
+
         template <class T>
- klass<T> const *get_class()
+ klass<T> const *get_class() const
         {
- classes_type::iterator iter = classes.find(type::traits<T>::type_number);
+ classes_type::const_iterator iter = classes.find(type::traits<T>::type_number);
                 if (iter == classes.end())
                         return 0;
                 return static_cast<klass<T> const *>(iter->second);

Modified: sandbox/monotonic/boost/object_model/storage.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/storage.hpp (original)
+++ sandbox/monotonic/boost/object_model/storage.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -23,7 +23,7 @@
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_STORAGE_HPP
 

Modified: sandbox/monotonic/boost/object_model/template_header.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/template_header.hpp (original)
+++ sandbox/monotonic/boost/object_model/template_header.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -15,7 +15,7 @@
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_(X)_HPP
 

Modified: sandbox/monotonic/boost/object_model/type/builtins.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/type/builtins.hpp (original)
+++ sandbox/monotonic/boost/object_model/type/builtins.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -22,7 +22,7 @@
 BOOST_OBJECT_MODEL_TRAITS_NUM(int, boost::object_model::type::number::Int);
 BOOST_OBJECT_MODEL_TRAITS_NUM(float, boost::object_model::type::number::Float);
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_TYPE_BUILTINS_HPP
 

Modified: sandbox/monotonic/boost/object_model/type/number.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/type/number.hpp (original)
+++ sandbox/monotonic/boost/object_model/type/number.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -64,7 +64,7 @@
 
 BOOST_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_TYPE_NUMBER_HPP
 

Modified: sandbox/monotonic/boost/object_model/type/traits.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/type/traits.hpp (original)
+++ sandbox/monotonic/boost/object_model/type/traits.hpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -20,7 +20,6 @@
         template <class T, size_t N, class S = T>
         struct traits_base
         {
- static number type_number;
                 typedef S Storage;
                 typedef Storage type;
                 typedef Storage *pointer;
@@ -37,11 +36,9 @@
                 template <> \
                 struct traits<T> : traits_base<T,N,S> \
                 { \
- using traits_base<T,N,S>::type_number; \
+ BOOST_STATIC_CONSTANT(number::value_type, type_number = N); \
                         static const char *name; \
                 }; \
- template <> \
- number traits_base<T,N,S>::type_number; \
                 const char * traits<T>::name = NAME; \
         } \
         BOOST_OM_END
@@ -54,7 +51,7 @@
 
 BOOST_OM_END
 
-#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/postfix.hpp>
 
 #endif // BOOST_OBJECT_MODEL_TYPE_TRAITS_HPP
 

Modified: sandbox/monotonic/libs/monotonic/test/Tests/Tests.vcproj
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/Tests/Tests.vcproj (original)
+++ sandbox/monotonic/libs/monotonic/test/Tests/Tests.vcproj 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -2,7 +2,7 @@
 <VisualStudioProject
         ProjectType="Visual C++"
         Version="9.00"
- Name="Tests"
+ Name="monotonic_tests"
         ProjectGUID="{D4779B0F-266B-46D3-8BCF-0E14EF8B817B}"
         RootNamespace="Tests"
         Keyword="Win32Proj"

Modified: sandbox/monotonic/libs/object_model/src/generic/object.cpp
==============================================================================
--- sandbox/monotonic/libs/object_model/src/generic/object.cpp (original)
+++ sandbox/monotonic/libs/object_model/src/generic/object.cpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -7,11 +7,18 @@
 // sandbox at https://svn.boost.org/svn/boost/sandbox/monotonic/object_model/
 
 #include <boost/object_model/generic/object.hpp>
+#include <boost/object_model/generic/class.hpp>
+#include <boost/object_model/generic/storage.hpp>
+#include <boost/object_model/registry.hpp>
 
 BOOST_OM_BEGIN
 
 namespace generic
 {
+ //---------------------------------------------------
+ // object_base
+ //---------------------------------------------------
+
         object_base::object_base()
                 : reg(0), type(0), number(0)
         {
@@ -22,6 +29,12 @@
         {
         }
 
+ object_base::object_base(const const_storage& store)
+ : reg(store.reg), type(store.type), number(store.number)
+ {
+ }
+
+
         void object_base::construct(registry &r, klass const &k, handle h)
         {
                 reg = &r;
@@ -29,18 +42,88 @@
                 number = h;
         }
 
- const_object::const_object()
+ registry &object_base::get_registry() const
+ {
+ if (reg == 0)
+ throw empty_object();
+ return *reg;
+ }
+ klass const &object_base::get_class() const
+ {
+ if (type == 0)
+ throw empty_object();
+ return *type;
+ }
+
+ type::number object_base::get_type_number() const
         {
+ return get_class().get_type_number();
         }
 
- object::object()
+ handle object_base::get_handle() const
         {
+ return number;
         }
 
- object::object(const storage &store)
+ bool object_base::exists() const
         {
+ return get_registry().exists(number);
         }
 
+ //---------------------------------------------------
+ // const_object
+ //---------------------------------------------------
+
+ //const_object::const_object()
+ //{
+ //}
+
+ //const_object::const_object(const const_storage &store) : object_base(store)
+ //{
+ //}
+
+ //const_object::const_object(const object &)
+ //{
+ //}
+
+
+ //---------------------------------------------------
+ // mutable_object
+ //---------------------------------------------------
+
+ mutable_object::mutable_object()
+ {
+ }
+
+ mutable_object::mutable_object(storage &store) : const_object(store)
+ {
+ }
+
+ //---------------------------------------------------
+ // object
+ //---------------------------------------------------
+
+ object::object() : konst(false) { }
+
+ object::object(const const_object& obj) : const_object(obj), konst(true) { }
+ object::object(const const_storage & obj) : const_object(obj), konst(true) { }
+
+ object::object(const mutable_object& obj) : const_object(obj), konst(false) { }
+ object::object(const storage &store) : const_object(store), konst(false) { }
+
+ object &object::operator=(const const_object& obj)
+ {
+ const_object::operator=(obj);
+ konst = true;
+ return *this;
+ }
+
+ object &object::operator=(const mutable_object& obj)
+ {
+ const_object::operator=(obj);
+ konst = false;
+ return *this;
+ }
 }
 
 const generic::object null_object;

Modified: sandbox/monotonic/libs/object_model/test/basic_tests.cpp
==============================================================================
--- sandbox/monotonic/libs/object_model/test/basic_tests.cpp (original)
+++ sandbox/monotonic/libs/object_model/test/basic_tests.cpp 2009-06-25 00:33:57 EDT (Thu, 25 Jun 2009)
@@ -23,15 +23,47 @@
 using namespace boost;
 namespace om = boost::object_model;
 
+//BOOST_OM_BEGIN
+//namespace type
+//{
+// template <>
+// struct traits<void>// : traits_base<void,number::Void,int>
+// {
+// BOOST_STATIC_CONSTANT(short, type_number = 42);//static int type_number = 42;
+// static const char *name;
+// };
+// //int traits<void>::type_number = 42;//number::Void;
+// const char * traits<void>::name = "Void";
+//}
+//BOOST_OM_END
+
+BOOST_AUTO_TEST_CASE(test_type_traits)
+{
+ BOOST_STATIC_ASSERT(om::type::traits<int>::type_number == om::type::number::Int);
+ BOOST_STATIC_ASSERT(om::type::traits<void>::type_number == om::type::number::Void);
+}
+
 BOOST_AUTO_TEST_CASE(test_generic_object)
 {
         om::registry<> reg;
 
+ reg.register_class<void>();
+ BOOST_ASSERT(reg.has_class<void>());
+
         om::generic::object obj = reg.create<void>();
- BOOST_ASSERT(num.exists());
+ BOOST_ASSERT(obj.exists());
 
- om::generic::const_object cobj = obj;
-// om::generic::mutable_object mobj = obj;
+ om::generic::const_object const_obj = obj;
+ BOOST_ASSERT(const_obj.exists());
+ om::generic::mutable_object mobj = obj;
+
+ BOOST_ASSERT(reg.num_classes() == 1);
+ BOOST_ASSERT(reg.num_instances() == 1);
+
+ BOOST_ASSERT(obj.exists());
+ reg.destroy(obj);
+ BOOST_ASSERT(!obj.exists());
+ BOOST_ASSERT(reg.num_instances() == 0);
 }
 
 BOOST_AUTO_TEST_CASE(test_object)
@@ -41,7 +73,7 @@
         BOOST_ASSERT(num.exists());
         BOOST_ASSERT(num.is_type<int>());
         *num = 42;
- BOOST_ASSERT(deref<int>(num) == 42);
+// BOOST_ASSERT(deref<int>(num) == 42);
 }
 
 struct Foo


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk