Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54380 - in sandbox/monotonic: boost/object_model boost/object_model/detail boost/object_model/generic libs/object_model/src libs/object_model/src/generic libs/object_model/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-26 15:19:52


Author: cschladetsch
Date: 2009-06-26 15:19:50 EDT (Fri, 26 Jun 2009)
New Revision: 54380
URL: http://svn.boost.org/trac/boost/changeset/54380

Log:
added system_traits<>

Added:
   sandbox/monotonic/boost/object_model/detail/class_base.hpp (contents, props changed)
Removed:
   sandbox/monotonic/libs/object_model/src/generic/class.cpp
   sandbox/monotonic/libs/object_model/src/label.cpp
Text files modified:
   sandbox/monotonic/boost/object_model/class.hpp | 47 ++------------
   sandbox/monotonic/boost/object_model/dictionary.hpp | 15 +++
   sandbox/monotonic/boost/object_model/forward_declarations.hpp | 19 +++++
   sandbox/monotonic/boost/object_model/generic/class.hpp | 12 ++-
   sandbox/monotonic/boost/object_model/generic/registry.hpp | 1
   sandbox/monotonic/boost/object_model/handle.hpp | 1
   sandbox/monotonic/boost/object_model/label.hpp | 10 +-
   sandbox/monotonic/boost/object_model/object.hpp | 4
   sandbox/monotonic/boost/object_model/registry.hpp | 125 ++++++++++++++++++++++++++++++++++-----
   sandbox/monotonic/boost/object_model/storage.hpp | 4
   sandbox/monotonic/boost/object_model/system_traits.hpp | 40 +++++++-----
   sandbox/monotonic/libs/object_model/src/generic/object.cpp | 43 -------------
   sandbox/monotonic/libs/object_model/src/object_model.vcproj | 12 +--
   sandbox/monotonic/libs/object_model/test/basic_tests.cpp | 72 +++++++++-------------
   14 files changed, 218 insertions(+), 187 deletions(-)

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-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -12,65 +12,34 @@
 #include <boost/object_model/detail/prefix.hpp>
 #include <boost/object_model/detail/allocator.hpp>
 #include <boost/object_model/generic/class.hpp>
-//#include <boost/object_model/system_traits.hpp>
+#include <boost/object_model/detail/class_base.hpp>
 
 BOOST_OM_BEGIN
 
-template <class Traits>
-struct klass_base : generic::klass
-{
- typedef typename Traits::label_type Label;
-
- typedef std::map<Label, generic::property const *> properties_type;
- typedef std::map<Label, generic::method const *> methods_type;
-
-private:
- const char *name;
- type::number type_number;
-
- properties_type properties;
- methods_type methods;
-
-public:
- klass_base(const char *ident, type::number num)
- : generic::klass(num), name(ident)
- {
- }
-
- bool has_method(Label const &name) const
- {
- return methods.find(name) != methods.end();
- }
-
- bool has_field(Label const &name) const
- {
- return properties.find(name) != properties.end();
- }
-};
-
-
 template <class T, class Registry>
-struct klass : klass_base<typename Registry::traits_type>
+struct klass : detail::klass_base<typename Registry::traits_type>
 {
         typedef typename Registry::traits_type system_traits;
- typedef klass_base<system_traits> klass_base_type;
+ typedef detail::klass_base<system_traits> klass_base_type;
         typedef typename system_traits::label_type label_type;
         typedef typename Registry::rebind_storage<T>::type storage_type;
- typedef typename system_traits::rebind_allocator<storage_type>::type allocator_type;
+ typedef typename system_traits::allocator_type::template rebind<storage_type>::other allocator_type;
         typedef type::traits<T> traits;
 
+private:
         Registry &reg;
         mutable allocator_type allocator;
 
+public:
         klass(Registry &factory)
                 : klass_base_type(traits::name, traits::type_number), reg(factory), allocator(reg.get_allocator()) { }
 
- generic::object &create(handle h) const
+ generic::object &create() const
         {
                 storage_type *store = allocator.allocate(1);
                 //allocator.construct(store);
                 new (store) storage_type();
- store->construct(reg, *this, h);
+ store->construct(reg, *this, reg.get_next_handle());
                 return *store;
         }
 

Added: sandbox/monotonic/boost/object_model/detail/class_base.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/detail/class_base.hpp 2009-06-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -0,0 +1,57 @@
+// (C) 2009 Christian Schladetsch
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// documentation at https://svn.boost.org/svn/boost/sandbox/monotonic/libs/object_model/doc/index.html
+// sandbox at https://svn.boost.org/svn/boost/sandbox/monotonic/object_model/
+
+#ifndef BOOST_OBJECT_MODEL_DETAIL_CLASS_BASE_HPP
+#define BOOST_OBJECT_MODEL_DETAIL_CLASS_BASE_HPP
+
+#include <map>
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/generic/class.hpp>
+
+BOOST_OM_BEGIN
+
+namespace detail
+{
+ template <class Traits>
+ struct klass_base : generic::klass
+ {
+ typedef typename Traits::label_type Label;
+
+ typedef std::map<Label, generic::property const *> properties_type;
+ typedef std::map<Label, generic::method const *> methods_type;
+
+ private:
+ properties_type properties;
+ methods_type methods;
+
+ public:
+ klass_base(const char *ident, type::number num)
+ : generic::klass(ident, num)
+ {
+ }
+
+ bool has_method(Label const &name) const
+ {
+ return methods.find(name) != methods.end();
+ }
+
+ bool has_field(Label const &name) const
+ {
+ return properties.find(name) != properties.end();
+ }
+ };
+
+} // namespace detail
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/postfix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_DETAIL_CLASS_BASE_HPP
+
+//EOF

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-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -16,14 +16,22 @@
 
 BOOST_OM_BEGIN
 
-template <class Tr>
+template <class Traits>
 struct dictionary
 {
- typedef typename Tr::label_type label_type;
- typedef std::map<label_type, generic::object, std::less<label_type>, typename Tr::allocator_type> contents_type;
+ typedef typename Traits::label_type label_type;
 
+ typedef std::map<
+ label_type
+ , generic::object
+ , std::less<label_type>
+ , typename Traits::allocator_type
+ > contents_type;
+
+private:
         contents_type contents;
 
+public:
         void set(label_type const &name, generic::object const &obj)
         {
                 contents[name] = obj;
@@ -36,6 +44,7 @@
                         return null_object;
                 return iter->second;
         }
+
         bool has(label_type const &name) const
         {
                 return contents.find(name) != contents.end();

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-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -129,12 +129,25 @@
 template <class T, class Traits>
 struct klass;
 
+/// helper structure to assist with reflecting a C++ type
 template <class T, class Traits>
 struct builder;
 
-///// an object registry (factory)
-//template <class Al, class Traits>
-//struct registry;
+/// traits type to control how the system works, and what data-types to use for various
+/// key components
+template <
+ class Alloc = default_allocator // allocator to use for everything
+ , class Char = char // default char type
+ , class ChTr = std::char_traits<Char> // char traits
+ , class Str = string<Alloc, Char, ChTr> // string type to use
+ , class Label = label<Str> // label type. used to name sub-objects
+ , class Ident = label<Str> // identifier. used to access fields and methods
+>
+struct system_traits;
+
+/// an object type factory, and registery of instances
+template <class Traits = system_traits<> >
+struct registry;
 
 /// a sequence of executable objects
 struct continuation;

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-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -20,20 +20,22 @@
 
 namespace generic
 {
- //template <class Label>
+ typedef const char *class_name;
+
         struct klass : base
         {
         private:
                 type::number type_number;
+ class_name name;
 
         public:
- klass(type::number num)
- : type_number(num) { }
+ klass(class_name ident, type::number num)
+ : type_number(num), name(ident) { }
 
                 type::number get_type_number() const { return type_number; }
-
+ class_name get_name() const { return name; }
 
- virtual object &create(handle) const = 0;
+ virtual object &create() const = 0;
                 virtual void destroy(object &) const = 0;
 
                 //virtual const_object get_property(const label&, const_object &owner) const = 0;

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-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -22,6 +22,7 @@
         {
         public:
 
+ virtual handle get_next_handle() = 0;
                 virtual klass const *get_class(type::number) const = 0;
                 virtual bool exists(handle) const = 0;
 

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-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -14,6 +14,7 @@
 
 BOOST_OM_BEGIN
 
+/// a handle is a numeric identifier for a system object
 struct handle
 {
         typedef unsigned value_type;

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-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -20,8 +20,6 @@
 template <class String>
 struct label
 {
-// BOOST_STATIC_ASSERT((boost::is_same<String, string<> >::value));
-
         typedef String string_type;
         typedef typename String::allocator_type allocator_type;
         typedef typename string_type::value_type char_type;
@@ -66,12 +64,12 @@
 
 BOOST_BEGIN
 
-template <>
-struct hash<BOOST_OBJECT_MODEL_NAMESPACE(label<BOOST_OBJECT_MODEL_NAMESPACE(string<>) >)>
+template <class Str>
+struct hash<boost::BOOST_OBJECT_MODEL_NAMESPACE_NAME::label<Str> >
 {
- size_t operator()(const BOOST_OBJECT_MODEL_NAMESPACE(label<BOOST_OBJECT_MODEL_NAMESPACE(string<>) >) &ident) const
+ size_t operator()(const boost::BOOST_OBJECT_MODEL_NAMESPACE_NAME::label<Str> &ident) const
         {
- return 42;// TODO: hash on ident.to_string().c_str()
+ return hash<const typename Str::char_type *>(ident.to_string().c_str());
         }
 };
 

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-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -29,7 +29,7 @@
         const_deref_fun const_deref;
 
 public:
- object() {}
+ object() : deref(0), const_deref(0) {}
 
         object(const generic::object &obj, deref_fun d, const_deref_fun c) : generic::object(obj), deref(d), const_deref(c)
         {
@@ -37,6 +37,8 @@
 
         typename traits::reference_type get_reference()
         {
+ if (!deref)
+ throw empty_object();
                 return deref(*this);
         }
 

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-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -21,13 +21,11 @@
 #include <boost/object_model/system_traits.hpp>
 #include <boost/object_model/object.hpp>
 
-BOOST_OM_BEGIN
+//#define BOOST_OBJECT_MODEL_REGISTRY_USE_UNORDERED_MAPS
 
-/// an object type factory, and registery of instances
-template <class Tr = system_traits<char, default_allocator> >
-struct registry;
+BOOST_OM_BEGIN
 
-/// an object type factory, and registery of instances
+/// an object type factory, and registry of instances
 template <class Tr>
 struct registry : generic::registry
 {
@@ -51,6 +49,7 @@
                 typedef storage<T, traits_type> type;
         };
 
+#ifndef BOOST_OBJECT_MODEL_REGISTRY_USE_UNORDERED_MAPS
         typedef std::map<
                 handle
                 , generic::storage<traits> *
@@ -60,10 +59,27 @@
 
         typedef std::map<
                 type::number
- , klass_base<traits_type> const *
+ , detail::klass_base<traits_type> const *
                 , std::less<type::number>
                 , allocator_type
> classes_type;
+#else
+ typedef boost::unordered_map<
+ handle
+ , generic::storage<traits> *
+ , boost::hash<handle>
+ , std::less<handle>
+ , allocator_type
+ > instances_type;
+
+ typedef boost::unordered_map<
+ type::number
+ , detail::klass_base<traits_type> const *
+ , boost::hash<type::number>
+ , std::less<type::number>
+ , allocator_type
+ > classes_type;
+#endif
 
         template <class T>
         static typename type::traits<T>::reference_type deref(generic::object &object)
@@ -80,28 +96,94 @@
         {
                 if (!object.is_type<T>())
                         throw type_mismatch();
- throw;
- //return static_cast<typename rebind_storage<T>::type const &>(object.get_storage()).get_const_reference();
+ return static_cast<const_storage<T, traits_type> const &>(object.get_storage()).get_const_reference();
+ }
+
+ template <class Ty>
+ void set_value(generic::object &obj, const Ty &value)
+ {
+ deref<Ty>(obj) = value;
+ }
+ template <class Ty>
+ Ty const &get_const_value(generic::object &obj)
+ {
+ return const_deref<Ty>(obj);
+ }
+ template <class Ty>
+ Ty const &get_value(const generic::const_object &obj)
+ {
+ return const_deref<Ty>(obj);
+ }
+ template <class Ty>
+ Ty &get_value(generic::mutable_object &obj)
+ {
+ return deref<Ty>(obj);
+ }
+ template <class Ty>
+ void set_child_value(generic::object &parent, typename traits::label_type const &label, const Ty &value)
+ {
+ generic::object child = get(parent, label);
+ if (!child.exists())
+ set(parent, label, create<Ty>(value));
+ else
+ deref<Ty>(child) = value;
+ }
+
+ template <class Ty>
+ Ty &get_child_value(generic::object &parent, typename traits::label_type const &label)
+ {
+ generic::object child = get(parent, label);
+ if (!child.exists())
+ throw empty_object();
+ return deref<Ty>(child);
+ }
+
+ template <class Ty>
+ const Ty &get_child_value(const generic::const_object &parent, typename traits::label_type const &label)
+ {
+ generic::const_object child = get(parent, label);
+ if (!child.exists())
+ throw empty_object();
+ return deref<Ty>(child);
         }
 
- void set(generic::object &parent, typename traits::label_type const &label, generic::object &child)
+ void set_child(generic::object parent, typename traits::label_type const &label, const generic::const_object child)
         {
                 generic::storage<traits> &p = get_storage(parent.get_handle());
- generic::storage<traits> &q = get_storage(child.get_handle());
+ generic::const_storage<traits> &q = get_const_storage(child.get_handle());
                 p.set(label, q);
         }
- generic::object get(generic::object &parent, typename traits::label_type const &label)
+
+ generic::mutable_object get_child(const generic::mutable_object parent, typename traits::label_type const &label)
         {
                 generic::storage<traits> &p = get_storage(parent.get_handle());
                 return p.get(label);
         }
- bool has(generic::object &parent, typename traits::label_type const &label)
+
+ generic::const_object get_const_child(const generic::object &parent, typename traits::label_type const &label)
         {
- generic::storage<traits> &p = get_storage(parent.get_handle());
+ const generic::const_storage<traits> &p = get_const_storage(parent.get_handle());
+ return p.get(label);
+ }
+ generic::const_object get_child(const generic::const_object parent, typename traits::label_type const &label)
+ {
+ return get_const_child(parent);
+ }
+
+ bool has_child(const generic::const_object parent, typename traits::label_type const &label)
+ {
+ const generic::const_storage<traits> &p = get_const_storage(parent.get_handle());
                 return p.has(label);
         }
 
 protected:
+ template <class, class> friend struct klass;
+ handle get_next_handle()
+ {
+ return ++next_handle;
+ }
+
+private:
         allocator_type allocator;
         instances_type instances;
         classes_type classes;
@@ -129,7 +211,7 @@
                 clear();
                 BOOST_FOREACH(typename classes_type::value_type &val, classes)
                 {
- allocator_destroy(const_cast<klass_base<traits_type> *>(val.second));
+ allocator_destroy(const_cast<detail::klass_base<traits_type> *>(val.second));
                 }
                 classes.clear();
         }
@@ -153,6 +235,14 @@
                 return *iter->second;
         }
 
+ generic::const_storage<traits> get_const_storage(handle h) const
+ {
+ instances_type::const_iterator iter = instances.find(h);
+ if (iter == instances.end())
+ throw unknown_handle();
+ return *iter->second;
+ }
+
         size_t num_classes() const
         {
                 return classes.size();
@@ -199,10 +289,9 @@
                 typename rebind_klass<T>::type const *k = get_class<T>();
                 if (k == 0)
                         throw unknown_type();
- handle h = ++next_handle;
                 typedef typename rebind_storage<T>::type storage_type;
- storage_type &obj = static_cast<storage_type &>(k->create(h));
- instances[h] = &obj;
+ storage_type &obj = static_cast<storage_type &>(k->create());
+ instances[obj.get_handle()] = &obj;
                 return object<T>(obj, &this_type::deref<T>, &this_type::const_deref<T>);
         }
 
@@ -226,7 +315,7 @@
         template <class T>
         T *allocator_create()
         {
- typename Allocator::template rebind<T>::other alloc(allocator);
+ typename allocator_type::template rebind<T>::other alloc(allocator);
                 T *ptr = alloc.allocate(1);
                 //alloc.construct(ptr);
                 new (ptr) T();

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-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -23,7 +23,7 @@
 
         const_storage() {}
         const_storage(typename type_traits::const_reference_type init) : value(init) { }
- typename type_traits::const_reference_type get_const_reference()
+ typename type_traits::const_reference_type get_const_reference() const
         {
                 return value;
         }
@@ -40,7 +40,7 @@
         storage() : dirty(true) {}
         storage(typename type_traits::const_reference_type init) : value(init), dirty(false) { }
 
- typename type_traits::const_reference_type get_const_reference()
+ typename type_traits::const_reference_type get_const_reference() const
         {
                 return value;
         }

Modified: sandbox/monotonic/boost/object_model/system_traits.hpp
==============================================================================
--- sandbox/monotonic/boost/object_model/system_traits.hpp (original)
+++ sandbox/monotonic/boost/object_model/system_traits.hpp 2009-06-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -12,29 +12,33 @@
 #include <boost/object_model/detail/prefix.hpp>
 #include <boost/object_model/string.hpp>
 #include <boost/object_model/label.hpp>
+#include <boost/object_model/class.hpp>
 
 BOOST_OM_BEGIN
 
-template <class Ch = char, class Al = std::allocator<Ch> >
+///
+template <class Alloc
+ , class Char
+ , class ChTr
+ , class Str
+ , class Label
+ , class Ident
+>
 struct system_traits
 {
- typedef Ch char_type;
- typedef std::char_traits<char_type> char_traits;
- typedef Al allocator_type;
- typedef string<allocator_type, char_type, char_traits> string_type;
- typedef label<string_type> label_type;
- typedef system_traits<Ch,Al> this_type;
-
- template <class T>
- struct rebind_class
- {
- typedef klass<T, this_type> type;
- };
- template <class T>
- struct rebind_allocator
- {
- typedef typename allocator_type::template rebind<T>::other type;
- };
+ typedef Char char_type;
+ typedef Alloc allocator_type;
+ typedef Str string_type;
+ typedef ChTr char_traits;
+ typedef Label label_type;
+ typedef Ident identifier_type;
+ typedef system_traits<Alloc, Char, ChTr, Str, Label, Ident> this_type;
+};
+
+template <class Label, class Al = default_allocator, class Ch = char >
+struct set_label : system_traits<Al, Ch>
+{
+ typedef Label label_type;
 };
 
 BOOST_OM_END

Deleted: sandbox/monotonic/libs/object_model/src/generic/class.cpp
==============================================================================
--- sandbox/monotonic/libs/object_model/src/generic/class.cpp 2009-06-26 15:19:50 EDT (Fri, 26 Jun 2009)
+++ (empty file)
@@ -1,19 +0,0 @@
-// (C) 2009 Christian Schladetsch
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// documentation at https://svn.boost.org/svn/boost/sandbox/monotonic/libs/object_model/doc/index.html
-// 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>
-
-BOOST_OM_BEGIN
-
-
-BOOST_OM_END
-
-//EOF
-
-

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-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -28,12 +28,6 @@
         {
         }
 
- //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;
@@ -79,39 +73,6 @@
                 return get_registry().get_storage(get_handle());
         }
 
- //void object_base::set(label const &name, object const &obj)
- //{
- // get_storage().set(name, obj);
- //}
-
- //object object_base::get(label const &name) const
- //{
- // return get_storage().get(name);
- //}
-
- // 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_base &mutable_object::get_storage()
         {
@@ -123,10 +84,8 @@
         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)
         {
@@ -149,8 +108,6 @@
         }
         const object_base &object::get_storage() const
         {
- if (is_const())
- throw const_error();
                 return get_registry().get_storage(get_handle());
         }
 }

Deleted: sandbox/monotonic/libs/object_model/src/label.cpp
==============================================================================
--- sandbox/monotonic/libs/object_model/src/label.cpp 2009-06-26 15:19:50 EDT (Fri, 26 Jun 2009)
+++ (empty file)
@@ -1,19 +0,0 @@
-// (C) 2009 Christian Schladetsch
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// documentation at https://svn.boost.org/svn/boost/sandbox/monotonic/libs/object_model/doc/index.html
-// sandbox at https://svn.boost.org/svn/boost/sandbox/monotonic/object_model/
-
-#include <boost/object_model/label.hpp>
-
-BOOST_OM_BEGIN
-
-
-
-
-
-BOOST_OM_END
-
-//EOF

Modified: sandbox/monotonic/libs/object_model/src/object_model.vcproj
==============================================================================
--- sandbox/monotonic/libs/object_model/src/object_model.vcproj (original)
+++ sandbox/monotonic/libs/object_model/src/object_model.vcproj 2009-06-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -317,6 +317,10 @@
>
                                         </File>
                                         <File
+ RelativePath="..\..\..\boost\object_model\detail\class_base.hpp"
+ >
+ </File>
+ <File
                                                 RelativePath="..\..\..\boost\object_model\detail\make_method.hpp"
>
                                         </File>
@@ -390,18 +394,10 @@
                 <Filter
                         Name="src"
>
- <File
- RelativePath=".\label.cpp"
- >
- </File>
                         <Filter
                                 Name="generic"
>
                                 <File
- RelativePath=".\generic\class.cpp"
- >
- </File>
- <File
                                         RelativePath=".\generic\object.cpp"
>
                                 </File>

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-26 15:19:50 EDT (Fri, 26 Jun 2009)
@@ -38,6 +38,37 @@
         //text = om::type::make_specifier<int>().to_string(reg);
 }
 
+BOOST_AUTO_TEST_CASE(test_values)
+{
+ om::registry<om::set_label<int> > r;
+ r.register_class<int>();
+ om::object<int> n = r.create<int>();
+ BOOST_ASSERT(n.exists());
+ BOOST_ASSERT(n.is_type<int>());
+ r.set_value(n, 42);
+ BOOST_ASSERT(r.get_value<int>(n) == 42);
+}
+
+BOOST_AUTO_TEST_CASE(test_int_labels)
+{
+ om::registry<om::set_label<int> > r;
+ r.register_class<void>();
+ om::object<void> parent = r.create<void>();
+ om::object<void> child = r.create<void>();
+ r.set_child(parent, 42, child);
+ BOOST_ASSERT(r.has_child(parent, 42));
+}
+
+BOOST_AUTO_TEST_CASE(test_string_labels)
+{
+ om::registry<> r;
+ r.register_class<void>();
+ om::object<void> parent = r.create<void>();
+ om::object<void> child = r.create<void>();
+ r.set_child(parent, "child", child);
+ BOOST_ASSERT(r.has_child(parent, "child"));
+}
+
 BOOST_AUTO_TEST_CASE(test_type_traits)
 {
         BOOST_STATIC_ASSERT(om::type::traits<int>::type_number == om::type::number::Int);
@@ -82,47 +113,6 @@
         BOOST_ASSERT((reg.deref<int>(num) == 42));
 }
 
-struct custom_traits
-{
- typedef char char_type;
- typedef std::char_traits<char_type> char_traits;
- typedef std::allocator<char> allocator_type;
- typedef om::string<allocator_type, char_type, char_traits> string_type;
- typedef int label_type;
- typedef custom_traits this_type;
-
- template <class T>
- struct rebind_class
- {
- typedef om::klass<T, this_type> type;
- };
- template <class T>
- struct rebind_allocator
- {
- typedef typename allocator_type::template rebind<T>::other type;
- };
-};
-
-BOOST_AUTO_TEST_CASE(test_int_labels)
-{
- om::registry<custom_traits> r;
- r.register_class<void>();
- om::object<void> parent = r.create<void>();
- om::object<void> child = r.create<void>();
- r.set(parent, 42, child);
- BOOST_ASSERT(r.has(parent, 42));
-}
-
-BOOST_AUTO_TEST_CASE(test_string_labels)
-{
- om::registry<> r;
- r.register_class<void>();
- om::object<void> parent = reg.create<void>();
- om::object<void> child = reg.create<void>();
- r.set(parent, "child", child);
- BOOST_ASSERT(r.has(parent, "child"));
-}
-
 struct Foo
 {
         int num;


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