Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54327 - in sandbox/monotonic: boost/monotonic libs/monotonic/test libs/monotonic/test/Tests libs/object_model libs/object_model/src libs/object_model/src/generic libs/object_model/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-24 23:29:36


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

Log:
created object model for monotonic

Added:
   sandbox/monotonic/libs/object_model/ (props changed)
   sandbox/monotonic/libs/object_model/src/ (props changed)
   sandbox/monotonic/libs/object_model/src/generic/
   sandbox/monotonic/libs/object_model/src/generic/class.cpp (contents, props changed)
   sandbox/monotonic/libs/object_model/src/generic/object.cpp (contents, props changed)
   sandbox/monotonic/libs/object_model/src/label.cpp (contents, props changed)
   sandbox/monotonic/libs/object_model/src/object_model.vcproj (contents, props changed)
   sandbox/monotonic/libs/object_model/test/
   sandbox/monotonic/libs/object_model/test/basic_tests.cpp (contents, props changed)
Text files modified:
   sandbox/monotonic/boost/monotonic/allocator_base.hpp | 8 ++++
   sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp | 3 +
   sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp | 30 ++++++++--------
   sandbox/monotonic/libs/monotonic/test/monotonic.sln | 8 ++++
   sandbox/monotonic/libs/monotonic/test/monotonic.vcproj | 68 ++++++++++++++++++++++++++++++++++++++++
   5 files changed, 101 insertions(+), 16 deletions(-)

Modified: sandbox/monotonic/boost/monotonic/allocator_base.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/allocator_base.hpp (original)
+++ sandbox/monotonic/boost/monotonic/allocator_base.hpp 2009-06-24 23:29:35 EDT (Wed, 24 Jun 2009)
@@ -6,8 +6,8 @@
 #ifndef BOOST_MONOTONIC_ALLOCATOR_BASE_HPP
 #define BOOST_MONOTONIC_ALLOCATOR_BASE_HPP
 
-#include <boost/monotonic/detail/prefix.hpp>
 #include <boost/assert.hpp>
+#include <boost/monotonic/detail/prefix.hpp>
 #include <boost/type_traits/has_trivial_constructor.hpp>
 #include <boost/type_traits/has_trivial_destructor.hpp>
 
@@ -15,6 +15,8 @@
 #include <boost/monotonic/detail/container.hpp>
 #include <boost/monotonic/detail/construct.hpp>
 
+//#include <boost/interprocess/containers/version_type.hpp>
+
 #ifdef BOOST_MONOTONIC_USE_POOLS
 # include <boost/monotonic/storage_pool.hpp>
 #endif
@@ -36,6 +38,10 @@
                         typedef T value_type;
                         typedef detail::Construct<detail::is_monotonic<T>::value> Construct;
 
+// typedef mpl::integral_c<unsigned, 2> version;
+ //typedef boost::interprocess::version_type<allocator_base, 2> version;
+
+
                         BOOST_STATIC_CONSTANT(size_t, alignment = boost::aligned_storage<sizeof(T)>::alignment);
 
                 //private:

Modified: sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp 2009-06-24 23:29:35 EDT (Wed, 24 Jun 2009)
@@ -45,6 +45,9 @@
 
 using monotonic::heap_region_tag;
 
+struct num_tag;
+struct str_tag;
+
 struct Tracked
 {
         static int count;

Modified: sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp 2009-06-24 23:29:35 EDT (Wed, 24 Jun 2009)
@@ -101,20 +101,20 @@
                 result.mono_elapsed = timer.elapsed();
         }
 
- //if (types.Includes(Type::Monotonic))
- //{
- // srand(42);
- // monotonic::local<my_local> storage;
- // boost::timer timer;
- // for (size_t n = 0; n < count; ++n)
- // {
- // {
- // fun.test(monotonic::allocator<void, my_local>(), length);
- // }
- // storage.reset();
- // }
- // result.local_mono_elapsed = timer.elapsed();
- //}
+ if (types.Includes(Type::Monotonic))
+ {
+ srand(42);
+ monotonic::local<my_local> storage;
+ boost::timer timer;
+ for (size_t n = 0; n < count; ++n)
+ {
+ {
+ fun.test(monotonic::allocator<void, my_local>(), length);
+ }
+ storage.reset();
+ }
+ result.local_mono_elapsed = timer.elapsed();
+ }
 
         if (types.Includes(Type::Standard))
         {
@@ -202,7 +202,7 @@
 template <class Cont>
 std::pair<typename Cont::value_type, typename Cont::value_type> standard_deviation_mean(Cont const &cont)
 {
- return standard_deviation_mean(cont.begin(), cont.end());
+ return standard_deviation_mean(boost::begin(cont), boost::end(cont));
 }
 
 void print_cumulative(std::vector<PoolResult> const &results)

Modified: sandbox/monotonic/libs/monotonic/test/monotonic.sln
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/monotonic.sln (original)
+++ sandbox/monotonic/libs/monotonic/test/monotonic.sln 2009-06-24 23:29:35 EDT (Wed, 24 Jun 2009)
@@ -5,6 +5,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tests", "Tests\Tests.vcproj", "{D4779B0F-266B-46D3-8BCF-0E14EF8B817B}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "object_model", "..\..\object_model\src\object_model.vcproj", "{E557E90C-C695-4A7B-B5A6-2F133AF88563}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -23,6 +25,12 @@
                 {D4779B0F-266B-46D3-8BCF-0E14EF8B817B}.Release|Win32.ActiveCfg = Release|Win32
                 {D4779B0F-266B-46D3-8BCF-0E14EF8B817B}.ReleaseSym|Win32.ActiveCfg = Release|Win32
                 {D4779B0F-266B-46D3-8BCF-0E14EF8B817B}.ReleaseSym|Win32.Build.0 = Release|Win32
+ {E557E90C-C695-4A7B-B5A6-2F133AF88563}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E557E90C-C695-4A7B-B5A6-2F133AF88563}.Debug|Win32.Build.0 = Debug|Win32
+ {E557E90C-C695-4A7B-B5A6-2F133AF88563}.Release|Win32.ActiveCfg = Release|Win32
+ {E557E90C-C695-4A7B-B5A6-2F133AF88563}.Release|Win32.Build.0 = Release|Win32
+ {E557E90C-C695-4A7B-B5A6-2F133AF88563}.ReleaseSym|Win32.ActiveCfg = Release|Win32
+ {E557E90C-C695-4A7B-B5A6-2F133AF88563}.ReleaseSym|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Modified: sandbox/monotonic/libs/monotonic/test/monotonic.vcproj
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/monotonic.vcproj (original)
+++ sandbox/monotonic/libs/monotonic/test/monotonic.vcproj 2009-06-24 23:29:35 EDT (Wed, 24 Jun 2009)
@@ -391,6 +391,74 @@
>
                                 </File>
                         </Filter>
+ <Filter
+ Name="interprocess"
+ >
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\anonymous_shared_memory.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\creation_tags.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\errors.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\exceptions.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\file_mapping.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\interprocess_fwd.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\managed_external_buffer.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\managed_heap_memory.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\managed_mapped_file.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\managed_shared_memory.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\managed_windows_shared_memory.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\mapped_region.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\offset_ptr.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\segment_manager.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\shared_memory_object.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\..\..\Lib\boost_1_39_0\boost\interprocess\windows_shared_memory.hpp"
+ >
+ </File>
+ </Filter>
                 </Filter>
                 <Filter
                         Name="doc"

Added: sandbox/monotonic/libs/object_model/src/generic/class.cpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/libs/object_model/src/generic/class.cpp 2009-06-24 23:29:35 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,37 @@
+// (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
+
+namespace generic
+{
+ klass::klass(const label &ident, type::number num)
+ : name(ident), type_number(num)
+ {
+ }
+
+ bool klass::has_method(label const &name) const
+ {
+ return methods.find(name) != methods.end();
+ }
+
+ bool klass::has_field(label const &name) const
+ {
+ return properties.find(name) != properties.end();
+ }
+
+}
+
+BOOST_OM_END
+
+//EOF
+
+

Added: sandbox/monotonic/libs/object_model/src/generic/object.cpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/libs/object_model/src/generic/object.cpp 2009-06-24 23:29:35 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,50 @@
+// (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>
+
+BOOST_OM_BEGIN
+
+namespace generic
+{
+ object_base::object_base()
+ : reg(0), type(0), number(0)
+ {
+ }
+
+ object_base::object_base(const object_base &other)
+ : reg(other.reg), type(other.type), number(other.number)
+ {
+ }
+
+ void object_base::construct(registry &r, klass const &k, handle h)
+ {
+ reg = &r;
+ type = &k;
+ number = h;
+ }
+
+ const_object::const_object()
+ {
+ }
+
+ object::object()
+ {
+ }
+
+ object::object(const storage &store)
+ {
+ }
+
+}
+
+const generic::object null_object;
+
+BOOST_OM_END
+
+//EOF

Added: sandbox/monotonic/libs/object_model/src/label.cpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/libs/object_model/src/label.cpp 2009-06-24 23:29:35 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,25 @@
+// (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
+
+label::label(const char_type *text)
+{
+}
+
+label::label(const string_type &text)
+{
+}
+
+
+
+BOOST_OM_END
+
+//EOF

Added: sandbox/monotonic/libs/object_model/src/object_model.vcproj
==============================================================================
--- (empty file)
+++ sandbox/monotonic/libs/object_model/src/object_model.vcproj 2009-06-24 23:29:35 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="object_model"
+ ProjectGUID="{E557E90C-C695-4A7B-B5A6-2F133AF88563}"
+ RootNamespace="object_model"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(ProjectDir)/../../..;C:\Lib\tbb21_20080605oss\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(ProjectDir)/../../..;C:\Lib\tbb21_20080605oss\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="boost"
+ >
+ <Filter
+ Name="object_model"
+ >
+ <File
+ RelativePath="..\..\..\boost\object_model\builder.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\class.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\config.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\dereference.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\dictionary.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\exceptions.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\forward_declarations.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\handle.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\label.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\object.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\registry.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\storage.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\template_header.hpp"
+ >
+ </File>
+ <Filter
+ Name="detail"
+ >
+ <File
+ RelativePath="..\..\..\boost\object_model\detail\allocator.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\detail\postfix.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\detail\prefix.hpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="type"
+ >
+ <File
+ RelativePath="..\..\..\boost\object_model\type\builtins.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\type\number.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\type\traits.hpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="generic"
+ >
+ <File
+ RelativePath="..\..\..\boost\object_model\generic\base.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\generic\class.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\generic\object.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\generic\registry.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\object_model\generic\storage.hpp"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="src"
+ >
+ <File
+ RelativePath=".\label.cpp"
+ >
+ </File>
+ <Filter
+ Name="generic"
+ >
+ <File
+ RelativePath=".\generic\class.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\generic\object.cpp"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="doc"
+ >
+ </Filter>
+ <Filter
+ Name="test"
+ >
+ <File
+ RelativePath="..\test\basic_tests.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: sandbox/monotonic/libs/object_model/test/basic_tests.cpp
==============================================================================
--- (empty file)
+++ sandbox/monotonic/libs/object_model/test/basic_tests.cpp 2009-06-24 23:29:35 EDT (Wed, 24 Jun 2009)
@@ -0,0 +1,84 @@
+// (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/
+
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MAIN
+
+#define BOOST_TEST_MODULE basic_test test
+#include <boost/test/unit_test.hpp>
+
+#include <string>
+#include <boost/object_model/object.hpp>
+#include <boost/object_model/registry.hpp>
+#include <boost/object_model/type/builtins.hpp>
+#include <boost/object_model/builder.hpp>
+#include <boost/object_model/type/traits.hpp>
+
+using namespace std;
+using namespace boost;
+namespace om = boost::object_model;
+
+BOOST_AUTO_TEST_CASE(test_generic_object)
+{
+ om::registry<> reg;
+
+ om::generic::object obj = reg.create<void>();
+ BOOST_ASSERT(num.exists());
+
+ om::generic::const_object cobj = obj;
+// om::generic::mutable_object mobj = obj;
+}
+
+BOOST_AUTO_TEST_CASE(test_object)
+{
+ om::registry<> reg;
+ om::object<int> num = reg.create<int>();
+ BOOST_ASSERT(num.exists());
+ BOOST_ASSERT(num.is_type<int>());
+ *num = 42;
+ BOOST_ASSERT(deref<int>(num) == 42);
+}
+
+struct Foo
+{
+ int num;
+ std::string str;
+
+ void bar()
+ {
+ }
+ int spam(int n)
+ {
+ return n*2;
+ }
+};
+
+BOOST_OBJECT_MODEL_TRAITS_NUM(Foo, 666);
+
+BOOST_AUTO_TEST_CASE(test_builder)
+{
+ om::registry<> reg;
+ om::builder<Foo>(reg)
+ .methods
+ ("bar", &Foo::bar)
+ ("spam", &Foo::spam)
+ .fields
+ ("num", &Foo::num)
+ ("str", &Foo::str)
+ ;
+ om::object<Foo> foo = reg.create<Foo>();
+ BOOST_ASSERT(foo.exists());
+ BOOST_ASSERT(foo.is_type<Foo>());
+
+ BOOST_ASSERT(foo.get_class().has_method("bar"));
+ BOOST_ASSERT(foo.get_class().has_method("spam"));
+ BOOST_ASSERT(foo.get_class().has_field("num"));
+ BOOST_ASSERT(foo.get_class().has_field("str"));
+}
+
+//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