Boost logo

Boost-Commit :

From: oryol_at_[hidden]
Date: 2008-07-19 23:19:11


Author: jeremypack
Date: 2008-07-19 23:19:10 EDT (Sat, 19 Jul 2008)
New Revision: 47617
URL: http://svn.boost.org/trac/boost/changeset/47617

Log:
Addition of type_map.

Text files modified:
   sandbox/boost/extension/convenience.hpp | 16 ++++++++++++++++
   sandbox/boost/extension/factory_map.hpp | 27 ---------------------------
   sandbox/boost/extension/impl/adaptable_factory_free_functions.hpp | 2 +-
   sandbox/boost/extension/impl/factory.hpp | 2 +-
   sandbox/libs/extension/test/Jamfile.v2 | 3 ++-
   sandbox/libs/extension/test/adaptable_factory_test.cpp | 2 +-
   6 files changed, 21 insertions(+), 31 deletions(-)

Modified: sandbox/boost/extension/convenience.hpp
==============================================================================
--- sandbox/boost/extension/convenience.hpp (original)
+++ sandbox/boost/extension/convenience.hpp 2008-07-19 23:19:10 EDT (Sat, 19 Jul 2008)
@@ -51,6 +51,22 @@
     (*func)(current_factory_map);
     return true;
 }
+
+inline bool load_single_library(type_map& current_type_map,
+ const std::string& library_path,
+ const std::string& external_function_name) {
+ shared_library lib(library_path);
+ if (!lib.open()) {
+ return false;
+ }
+ void (*func)(type_map&) =
+ lib.shared_library::get<void, type_map&>(external_function_name);
+ if (!func) {
+ return false;
+ }
+ (*func)(current_type_map);
+ return true;
+}
 } // namespace extensions
 } // namespace boost
 

Modified: sandbox/boost/extension/factory_map.hpp
==============================================================================
--- sandbox/boost/extension/factory_map.hpp (original)
+++ sandbox/boost/extension/factory_map.hpp 2008-07-19 23:19:10 EDT (Sat, 19 Jul 2008)
@@ -14,7 +14,6 @@
 #define BOOST_EXTENSION_FACTORY_MAP_HPP
 
 #include <map>
-#include <boost/extension/adaptable_factory.hpp>
 #include <boost/extension/factory.hpp>
 #include <boost/extension/impl/typeinfo.hpp>
 
@@ -36,32 +35,6 @@
     }
   }
 
-
- template <class Interface, class Info, class AdaptableInfo>
- std::map<
- Info,
- adaptable_factory<Interface, AdaptableInfo, TypeInfo> >&
- get_adaptable() {
- TypeInfo t = adaptable_factory<Interface>::get_class_type();
-
- typename std::map<TypeInfo, generic_map_holder*>::iterator
- it = maps_.find(t);
-
- typedef adaptable_factory<
- Interface, AdaptableInfo, TypeInfo
- > factory_type;
- typedef std::map<Info, factory_type> map_type;
-
- map_holder<map_type>* holder;
- if (it == maps_.end()) {
- holder = new map_holder<map_type>;
- it = maps_.insert(std::make_pair(t, holder)).first;
- }
- else {
- holder = static_cast<map_holder<map_type>* > (it->second);
- }
- return *(static_cast<map_type*>(holder));
- }
 /* Include simplified versions of the get and conversion member
  * functions for Doxygen, and to make it easier for readers of
  * this file.

Modified: sandbox/boost/extension/impl/adaptable_factory_free_functions.hpp
==============================================================================
--- sandbox/boost/extension/impl/adaptable_factory_free_functions.hpp (original)
+++ sandbox/boost/extension/impl/adaptable_factory_free_functions.hpp 2008-07-19 23:19:10 EDT (Sat, 19 Jul 2008)
@@ -1,5 +1,5 @@
 /*
- * Copyright Jeremy Pack 2007
+ * Copyright Jeremy Pack 2008
  * 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)

Modified: sandbox/boost/extension/impl/factory.hpp
==============================================================================
--- sandbox/boost/extension/impl/factory.hpp (original)
+++ sandbox/boost/extension/impl/factory.hpp 2008-07-19 23:19:10 EDT (Sat, 19 Jul 2008)
@@ -1,5 +1,5 @@
 /*
- * Copyright Jeremy Pack 2007
+ * Copyright Jeremy Pack 2008
  * 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)

Modified: sandbox/libs/extension/test/Jamfile.v2
==============================================================================
--- sandbox/libs/extension/test/Jamfile.v2 (original)
+++ sandbox/libs/extension/test/Jamfile.v2 2008-07-19 23:19:10 EDT (Sat, 19 Jul 2008)
@@ -1,6 +1,6 @@
 # Boost.Extension - tests Jamfile
 #
-# Copyright 2007 Jeremy Pack
+# Copyright 2008 Jeremy Pack
 # 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)
@@ -25,6 +25,7 @@
 
 test-suite extension_tests_all
 :
+ [ run type_map_test.cpp ]
   [ run adaptable_factory_test.cpp ]
   [ run factory_test.cpp ]
   [ run zone_test.cpp ]

Modified: sandbox/libs/extension/test/adaptable_factory_test.cpp
==============================================================================
--- sandbox/libs/extension/test/adaptable_factory_test.cpp (original)
+++ sandbox/libs/extension/test/adaptable_factory_test.cpp 2008-07-19 23:19:10 EDT (Sat, 19 Jul 2008)
@@ -1,7 +1,7 @@
 /*
  * Boost.Extension / testing of adapter class
  *
- * (C) Copyright Jeremy Pack 2007
+ * (C) Copyright Jeremy Pack 2008
  * 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)


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