Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54326 - in sandbox/monotonic/boost/object_model: . detail generic type
From: christian.schladetsch_at_[hidden]
Date: 2009-06-24 23:27:17


Author: cschladetsch
Date: 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
New Revision: 54326
URL: http://svn.boost.org/trac/boost/changeset/54326

Log:
created object model for monotonic

Added:
   sandbox/monotonic/boost/object_model/
   sandbox/monotonic/boost/object_model/builder.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/class.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/config.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/dereference.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/detail/
   sandbox/monotonic/boost/object_model/detail/allocator.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/detail/postfix.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/detail/prefix.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/dictionary.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/exceptions.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/forward_declarations.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/generic/
   sandbox/monotonic/boost/object_model/generic/base.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/generic/class.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/generic/object.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/generic/registry.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/generic/storage.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/handle.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/label.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/object.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/registry.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/storage.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/template_header.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/type/
   sandbox/monotonic/boost/object_model/type/builtins.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/type/number.hpp (contents, props changed)
   sandbox/monotonic/boost/object_model/type/traits.hpp (contents, props changed)

Added: sandbox/monotonic/boost/object_model/builder.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/builder.hpp 2009-06-24 23:27:15 EDT (Wed, 24 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_BUILDER_HPP
+#define BOOST_OBJECT_MODEL_BUILDER_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/class.hpp>
+
+BOOST_OM_BEGIN
+
+template <class T, class Allocator>
+struct builder
+{
+ typedef type::traits<T> traits;
+
+private:
+ registry<Allocator> &reg;
+ klass<T> *my_klass;
+
+public:
+ builder(registry<Allocator> &R) : reg(R)
+ {
+ my_klass = reg.register_class<T>();
+ }
+ struct methods_type
+ {
+ struct fields_type
+ {
+ template <class Field>
+ fields_type &operator()(const char *name, Field field)
+ {
+ return *this;
+ }
+ } fields;
+
+ template <class Method>
+ methods_type &operator()(const char *name, Method method)
+ {
+ return *this;
+ }
+
+ } methods;
+};
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_BUILDER_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/class.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/class.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,51 @@
+// (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_CLASS_HPP
+#define BOOST_OBJECT_MODEL_CLASS_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/detail/allocator.hpp>
+#include <boost/object_model/generic/class.hpp>
+
+BOOST_OM_BEGIN
+
+template <class T, class Alloc>
+struct klass : generic::klass
+{
+ typedef typename detail::rebind<Alloc,object_model::storage<T> >::type allocator_type;
+ typedef type::traits<T> traits;
+
+ registry<Alloc> &reg;
+ mutable allocator_type allocator;
+
+ klass(registry<Alloc> &factory)
+ : generic::klass(traits::name, traits::type_number), reg(factory), allocator(reg.get_allocator()) { }
+
+ generic::storage &create(handle h) const
+ {
+ storage<T> *store = allocator.allocate(1);
+ //allocator.construct(store);
+ new (store) storage<T>();
+ store->construct(reg, *this, h);
+ return *store;
+ }
+
+ void destroy(generic::storage &) const
+ {
+ }
+
+};
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_CLASS_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/config.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/config.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,32 @@
+// (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_CONFIG_HPP
+#define BOOST_OBJECT_MODEL_CONFIG_HPP
+
+#include <boost/config.hpp>
+#include <boost/functional/hash_fwd.hpp>
+
+#define BOOST_OBJECT_MODEL_NAMESPACE_NAME object_model
+
+#define BOOST_BEGIN namespace boost {
+#define BOOST_END }
+
+#define BOOST_OM_BEGIN BOOST_BEGIN namespace BOOST_OBJECT_MODEL_NAMESPACE_NAME {
+#define BOOST_OM_END } BOOST_END
+#define BOOST_OBJECT_MODEL_NAMESPACE(name) ::boost::BOOST_OBJECT_MODEL_NAMESPACE_NAME::name
+
+BOOST_OM_BEGIN
+
+typedef std::allocator<char> default_allocator;
+
+BOOST_OM_END
+
+#endif // BOOST_OBJECT_MODEL_CONFIG_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/dereference.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/dereference.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,35 @@
+// (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_DEREFERENCE_HPP
+#define BOOST_OBJECT_MODEL_DEREFERENCE_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/generic/object.hpp>
+
+BOOST_OM_BEGIN
+
+template <class T>
+typename type::traits<T>::reference deref(generic::object &object)
+{
+ throw;
+}
+
+template <class T>
+typename type::traits<T>::const_reference const_deref(generic::object const &object)
+{
+ throw;
+}
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_DEREFERENCE_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/detail/allocator.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/detail/allocator.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,31 @@
+// (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_ALLOCATOR_HPP
+#define BOOST_OBJECT_MODEL_DETAIL_ALLOCATOR_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+
+BOOST_OM_BEGIN
+
+namespace detail
+{
+ template <class Alloc, class T>
+ struct rebind
+ {
+ typedef typename Alloc::template rebind<T>::other type;
+ };
+}
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_DETAIL_ALLOCATOR_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/detail/postfix.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/detail/postfix.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,11 @@
+// (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/
+
+
+
+//EOF

Added: sandbox/monotonic/boost/object_model/detail/prefix.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/detail/prefix.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,14 @@
+// (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_CONFIG_HPP
+#include <boost/object_model/config.hpp>
+#endif
+
+
+//EOF

Added: sandbox/monotonic/boost/object_model/dictionary.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/dictionary.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,30 @@
+// (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_DICTIONARY_HPP
+#define BOOST_OBJECT_MODEL_DICTIONARY_HPP
+
+#include <map>
+#include <boost/object_model/detail/prefix.hpp>
+
+BOOST_OM_BEGIN
+
+struct dictionary
+{
+ typedef std::map<label, generic::object> contents_type;
+
+ contents_type contents;
+};
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_DICTIONARY_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/exceptions.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/exceptions.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,38 @@
+// (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_EXCEPTIONS_HPP
+#define BOOST_OBJECT_MODEL_EXCEPTIONS_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+
+BOOST_OM_BEGIN
+
+struct empty_object
+{
+};
+
+struct const_error
+{
+};
+
+struct unknown_type
+{
+};
+
+struct type_mismatch
+{
+};
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_EXCEPTIONS_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/forward_declarations.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/forward_declarations.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,135 @@
+// (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_FORWARD_DECLARATIONS_HPP
+#define BOOST_OBJECT_MODEL_FORWARD_DECLARATIONS_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/exceptions.hpp>
+
+BOOST_OM_BEGIN
+
+namespace type
+{
+ /// traits for a given type
+ template <class T>
+ struct traits;
+
+ /// a type number
+ struct number;
+}
+
+/// a unique identifier of an object
+struct handle;
+
+/// a name for an object
+struct label;
+
+/// a mapping of label to object
+struct dictionary;
+
+/// generic bases for type-specific derived types
+namespace generic
+{
+ struct base;
+
+ struct object_base;
+
+ struct const_object;
+
+ struct mutable_object;
+
+ struct object;
+
+ /// common for all const storage for an instance
+ struct const_storage;
+
+ /// common for all storage for an instance
+ struct storage;
+
+ /// common for types that have a `self` pointer
+ struct reflected;
+
+ /// common for a all methods
+ struct method;
+
+ /// common for all class properties
+ struct property;
+
+ /// common for all classes
+ struct klass;
+
+ struct registry;
+}
+
+template <class T>
+struct const_object;
+
+template <class T>
+struct const_reference;
+
+template <class T>
+struct const_pointer;
+
+template <class T>
+struct mutable_object;
+
+template <class T>
+struct mutable_reference;
+
+template <class T>
+struct mutable_pointer;
+
+template <class T>
+struct object;
+
+template <class T>
+struct pointer;
+
+template <class T>
+struct reference;
+
+/// storage for a specific type
+template <class T>
+struct storage;
+
+template <class T>
+struct reflected;
+
+/// a specific method of class type, with given signature
+template <class T, class Signature>
+struct method;
+
+/// a specific property
+template <class T, class Val>
+struct property;
+
+/// class of a given type
+template <class T, class Al = default_allocator>
+struct klass;
+
+template <class T, class Al = default_allocator>
+struct builder;
+
+/// an object registry (factory)
+template <class Al = default_allocator >
+struct registry;
+
+/// a sequence of executable objects
+struct continuation;
+
+/// executes continuations
+struct exectutor;
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_FORWARD_DECLARATIONS_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/generic/base.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/generic/base.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,38 @@
+// (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_GENERIC_BASE_HPP
+#define BOOST_OBJECT_MODEL_GENERIC_BASE_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/noncopyable.hpp>
+
+BOOST_OM_BEGIN
+
+namespace generic
+{
+ /// common to all other base structures in namespace generic
+ struct base
+ {
+ virtual ~base() { }
+ };
+
+ /// common to all other base structures in namespace generic
+ struct noncopyable_base : noncopyable
+ {
+ virtual ~noncopyable_base() { }
+ };
+}
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_GENERIC_BASE_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/generic/class.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/generic/class.hpp 2009-06-24 23:27:15 EDT (Wed, 24 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_GENERIC_CLASS_HPP
+#define BOOST_OBJECT_MODEL_GENERIC_CLASS_HPP
+
+#include <map>
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/forward_declarations.hpp>
+#include <boost/object_model/type/number.hpp>
+#include <boost/object_model/generic/base.hpp>
+#include <boost/object_model/label.hpp>
+
+BOOST_OM_BEGIN
+
+namespace generic
+{
+ struct klass : base
+ {
+ typedef std::map<label, property const *> properties_type;
+ typedef std::map<label, method const *> methods_type;
+
+ private:
+ label name;
+ type::number type_number;
+
+ properties_type properties;
+ methods_type methods;
+
+ public:
+ klass(const label&, type::number);
+
+ type::number get_type_number() const { return type_number; }
+
+ bool has_method(label const &) const;
+ bool has_field(label const &) const;
+
+ virtual storage &create(handle) const = 0;
+ virtual void destroy(storage &) const = 0;
+
+ //virtual const_object get_property(const label&, const_object &owner) const = 0;
+ //virtual object get_property(const label&, object &owner) const = 0;
+ };
+}
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_GENERIC_CLASS_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/generic/object.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/generic/object.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,100 @@
+// (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_GENERIC_OBJECT_HPP
+#define BOOST_OBJECT_MODEL_GENERIC_OBJECT_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/forward_declarations.hpp>
+#include <boost/object_model/handle.hpp>
+#include <boost/object_model/type/traits.hpp>
+#include <boost/object_model/generic/base.hpp>
+
+BOOST_OM_BEGIN
+
+namespace generic
+{
+ struct object_base
+ {
+ protected:
+ registry *reg;
+ klass const *type;
+ handle number;
+
+ object_base();
+ object_base(const object_base&);
+
+ 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;
+ registry &get_registry() 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;
+ }
+ };
+
+ struct mutable_object : const_object
+ {
+ storage &get_storage();
+ };
+
+ // can be const or mutable
+ struct object : const_object
+ {
+ private:
+ bool konst;
+
+ public:
+ object();
+
+ object(const const_object&);
+ object(const mutable_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&);
+
+ storage &get_storage();
+ };
+
+}
+
+extern const generic::object null_object;
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/postfix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_GENERIC_OBJECT_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/generic/registry.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/generic/registry.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,34 @@
+// (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_GENERIC_REGISTRY_HPP
+#define BOOST_OBJECT_MODEL_GENERIC_REGISTRY_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/forward_declarations.hpp>
+#include <boost/object_model/handle.hpp>
+#include <boost/object_model/storage.hpp>
+
+BOOST_OM_BEGIN
+
+namespace generic
+{
+ struct registry : base
+ {
+ public:
+
+ };
+}
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_GENERIC_REGISTRY_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/generic/storage.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/generic/storage.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,36 @@
+// (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_GENERIC_STORAGE_HPP
+#define BOOST_OBJECT_MODEL_GENERIC_STORAGE_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/dictionary.hpp>
+
+BOOST_OM_BEGIN
+
+namespace generic
+{
+ struct const_storage : const_object
+ {
+ dictionary dict;
+ };
+
+ struct storage : const_storage
+ {
+
+ };
+}
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_GENERIC_STORAGE_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/handle.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/handle.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,52 @@
+// (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_HANDLE_HPP
+#define BOOST_OBJECT_MODEL_HANDLE_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/functional/hash_fwd.hpp>
+
+BOOST_OM_BEGIN
+
+struct handle
+{
+ typedef unsigned value_type;
+
+private:
+ value_type value;
+
+public:
+ handle() : value(0) {}
+ handle(value_type val) : value(val) { }
+ value_type get_value() const { return value; }
+
+ friend bool operator==(handle a, handle b) { return a.value == b.value; }
+ friend bool operator<(handle a, handle b) { return a.value < b.value; }
+};
+
+BOOST_OM_END
+
+BOOST_BEGIN
+
+template <>
+struct hash<BOOST_OBJECT_MODEL_NAMESPACE(handle)>
+{
+ size_t operator()(BOOST_OBJECT_MODEL_NAMESPACE(handle) num) const
+ {
+ return num.get_value();
+ }
+};
+
+BOOST_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_HANDLE_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/label.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/label.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,59 @@
+// (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_LABEL_HPP
+#define BOOST_OBJECT_MODEL_LABEL_HPP
+
+#include <string>
+#include <boost/object_model/detail/prefix.hpp>
+
+BOOST_OM_BEGIN
+
+struct label
+{
+ typedef std::string string_type;
+ typedef string_type::value_type char_type;
+
+private:
+ string_type value;
+
+public:
+ label() { }
+ label(const char_type *);
+ label(const string_type &);
+
+ const string_type &to_string() const { return value; }
+
+ friend bool operator==(label const &a, label const &b) { return a.value == b.value; }
+ friend bool operator<(label const &a, label const &b) { return a.value < b.value; }
+
+private:
+ void from_string(const string_type &);
+ void from_string(const char_type *);
+};
+
+BOOST_OM_END
+
+BOOST_BEGIN
+
+template <>
+struct hash<BOOST_OBJECT_MODEL_NAMESPACE(label)>
+{
+ size_t operator()(BOOST_OBJECT_MODEL_NAMESPACE(label) ident) const
+ {
+ return 42;// TODO: hash on ident.to_string().c_str()
+ }
+};
+
+BOOST_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_LABEL_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/object.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/object.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,46 @@
+// (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_OBJECT_HPP
+#define BOOST_OBJECT_MODEL_OBJECT_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/generic/object.hpp>
+#include <boost/object_model/dereference.hpp>
+
+BOOST_OM_BEGIN
+
+/// an object with a specific type
+template <class T>
+struct object : generic::object
+{
+ typedef type::traits<T> traits;
+
+ object() {}
+ object(const generic::object &obj)
+ {
+ }
+
+ typename traits::reference reference()
+ {
+ return deref<T>(*this);
+ }
+
+ typename traits::reference operator*()
+ {
+ return reference();
+ }
+};
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_OBJECT_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/registry.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/registry.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,100 @@
+// (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_REGISTRY_HPP
+#define BOOST_OBJECT_MODEL_REGISTRY_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
+
+/// an object type factory, and registery of instances
+template <class Allocator>
+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;
+
+protected:
+ allocator_type allocator;
+ instances_type instances;
+ classes_type classes;
+ handle::value_type next_handle;
+
+public:
+ registry()
+ {
+ }
+
+ allocator_type &get_allocator()
+ {
+ return allocator;
+ }
+
+ template <class T>
+ klass<T> *register_class()
+ {
+ 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;
+ return new_class;
+ }
+
+ template <class T>
+ storage<T> &create()
+ {
+ klass<T> const *k = get_class<T>();
+ if (k == 0)
+ throw unknown_type();
+ handle h = ++next_handle;
+ storage<T> &obj = static_cast<storage<T> &>(k->create(h));
+ instances[h] = &obj;
+ return obj;
+ }
+ template <class T>
+ klass<T> const *get_class()
+ {
+ classes_type::iterator iter = classes.find(type::traits<T>::type_number);
+ if (iter == classes.end())
+ return 0;
+ return static_cast<klass<T> const *>(iter->second);
+ }
+
+private:
+
+ template <class T>
+ T *allocator_create()
+ {
+ typename Allocator::template rebind<T>::other alloc(allocator);
+ T *ptr = alloc.allocate(1);
+ //alloc.construct(ptr);
+ new (ptr) T();
+ return ptr;
+ }
+ template <class T, class U>
+ T *allocator_create(U &init)
+ {
+ typename Allocator::template rebind<T>::other alloc(allocator);
+ T *ptr = alloc.allocate(1);
+ //alloc.construct(ptr, init);
+ new (ptr) T(init);
+ return ptr;
+ }
+};
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_REGISTRY_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/storage.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/storage.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,30 @@
+// (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_STORAGE_HPP
+#define BOOST_OBJECT_MODEL_STORAGE_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/generic/storage.hpp>
+
+BOOST_OM_BEGIN
+
+template <class T>
+struct storage : generic::storage
+{
+ typedef type::traits<T> traits;
+
+};
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_STORAGE_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/template_header.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/template_header.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,22 @@
+// (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_(X)_HPP
+#define BOOST_OBJECT_MODEL_(X)_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+
+BOOST_OM_BEGIN
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_(X)_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/type/builtins.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/type/builtins.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,29 @@
+// (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_TYPE_BUILTINS_HPP
+#define BOOST_OBJECT_MODEL_TYPE_BUILTINS_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/type/traits.hpp>
+
+BOOST_OM_BEGIN
+
+struct void_storage {};
+
+BOOST_OM_END
+
+BOOST_OBJECT_MODEL_TRAITS_NUM_STORE(void, boost::object_model::type::number::Void, void_storage);
+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>
+
+#endif // BOOST_OBJECT_MODEL_TYPE_BUILTINS_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/type/number.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/type/number.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,71 @@
+// (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_TYPE_NUMBER_HPP
+#define BOOST_OBJECT_MODEL_TYPE_NUMBER_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+
+BOOST_OM_BEGIN
+
+namespace type
+{
+ struct number
+ {
+ enum builtins
+ {
+ None,
+ Void,
+
+ Object,
+
+ Method,
+ Property,
+ Class,
+
+ Int,
+ Float,
+ String,
+ List,
+ Vector,
+ Map,
+ Set,
+ };
+
+ typedef unsigned short value_type;
+ value_type value;
+
+ number() : value(0) { }
+ number(value_type val) : value(val) { }
+
+ friend bool operator==(number a, number b) { return a.value == b.value; }
+ friend bool operator<(number a, number b) { return a.value < b.value; }
+ };
+
+}
+
+BOOST_OM_END
+
+BOOST_BEGIN
+
+template <>
+struct hash<BOOST_OBJECT_MODEL_NAMESPACE(type::number)>
+{
+ size_t operator()(BOOST_OBJECT_MODEL_NAMESPACE(type::number) num) const
+ {
+ return num.value;
+ }
+};
+
+BOOST_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_TYPE_NUMBER_HPP
+
+//EOF

Added: sandbox/monotonic/boost/object_model/type/traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/object_model/type/traits.hpp 2009-06-24 23:27:15 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,61 @@
+// (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_TYPE_TRAITS_HPP
+#define BOOST_OBJECT_MODEL_TYPE_TRAITS_HPP
+
+#include <boost/object_model/detail/prefix.hpp>
+#include <boost/object_model/type/number.hpp>
+#include <boost/preprocessor/stringize.hpp>
+
+BOOST_OM_BEGIN
+
+namespace type
+{
+ 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;
+ typedef Storage &reference;
+ typedef Storage const &const_reference;
+ };
+
+}
+
+#define BOOST_OBJECT_MODEL_TRAITS_NUM_STORE_NAME(T,N,S,NAME) \
+ BOOST_OM_BEGIN \
+ namespace type \
+ { \
+ template <> \
+ struct traits<T> : traits_base<T,N,S> \
+ { \
+ using traits_base<T,N,S>::type_number; \
+ static const char *name; \
+ }; \
+ template <> \
+ number traits_base<T,N,S>::type_number; \
+ const char * traits<T>::name = NAME; \
+ } \
+ BOOST_OM_END
+
+#define BOOST_OBJECT_MODEL_TRAITS_NUM_STORE(T,N,S) \
+ BOOST_OBJECT_MODEL_TRAITS_NUM_STORE_NAME(T,N,S,BOOST_PP_STRINGIZE(T))
+
+#define BOOST_OBJECT_MODEL_TRAITS_NUM(T,N) \
+ BOOST_OBJECT_MODEL_TRAITS_NUM_STORE(T,N,T)
+
+BOOST_OM_END
+
+#include <boost/object_model/detail/prefix.hpp>
+
+#endif // BOOST_OBJECT_MODEL_TYPE_TRAITS_HPP
+
+//EOF


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