diff --git a/src/common/singletonfactory.hpp b/src/common/singletonfactory.hpp index 0065227df..0f6a12755 100644 --- a/src/common/singletonfactory.hpp +++ b/src/common/singletonfactory.hpp @@ -35,7 +35,7 @@ This code is heavily inspired by #define LUMIERA_SINGLETONFACTORY_H -#include "common/singletonpolicies.hpp" ///< several Policies usable together with SingletonFactory +#include "common/singletonpolicies.hpp" // several Policies usable together with SingletonFactory #include "common/util.hpp" #include "proc/nobugcfg.hpp" diff --git a/src/proc/mobject/session/defsmanager.cpp b/src/proc/mobject/session/defsmanager.cpp index b60e38064..538e8c9a8 100644 --- a/src/proc/mobject/session/defsmanager.cpp +++ b/src/proc/mobject/session/defsmanager.cpp @@ -35,10 +35,9 @@ using lumiera::query::QueryHandler; using lumiera::query::LUMIERA_ERROR_CAPABILITY_QUERY; -namespace mobject - { - namespace session - { +namespace mobject { + namespace session { + using lumiera::P; @@ -51,6 +50,13 @@ namespace mobject } + + /** @internal causes boost::checked_delete from \c scoped_ptr + * to be placed here, where the declaration of DefsRegistry is available.*/ + DefsManager::~DefsManager() {} + + + template P DefsManager::search (const Query& capabilities) diff --git a/src/proc/mobject/session/defsmanager.hpp b/src/proc/mobject/session/defsmanager.hpp index eb2ca1502..276ed4c88 100644 --- a/src/proc/mobject/session/defsmanager.hpp +++ b/src/proc/mobject/session/defsmanager.hpp @@ -33,14 +33,14 @@ -namespace mobject - { - namespace session - { +namespace mobject { + namespace session { + + using lumiera::P; using boost::scoped_ptr; - class DefsRegistry; + namespace impl { class DefsRegistry; } /** @@ -55,7 +55,7 @@ namespace mobject */ class DefsManager : private boost::noncopyable { - scoped_ptr defsRegistry; + scoped_ptr defsRegistry; protected: @@ -63,6 +63,8 @@ namespace mobject friend class SessManagerImpl; public: + ~DefsManager (); + /** common access point: retrieve the default object fulfilling * some given conditions. May silently trigger object creation. * @throw error::Config in case no solution is possible, which diff --git a/src/proc/mobject/session/defsregistry.hpp b/src/proc/mobject/session/defsregistry.hpp index 73925e11a..75068ec92 100644 --- a/src/proc/mobject/session/defsregistry.hpp +++ b/src/proc/mobject/session/defsregistry.hpp @@ -21,6 +21,21 @@ */ +/** @file defsregistry.hpp + ** A piece of implementation code factored out into a separate header (include). + ** Only used in defsmanager.cpp and for the unit tests. We can't place it into + ** a separate compilation unit, because defsmanager.cpp defines some explicit + ** template instantiaton, which cause the different Slots of the DefsrRegistry#table_ + ** to be filled with data and defaults for the specific Types. + ** + ** @see mobject::session::DefsManager + ** @see defsregistryimpltest.cpp + ** + */ + + + + #ifndef MOBJECT_SESSION_DEFSREGISTRY_H #define MOBJECT_SESSION_DEFSREGISTRY_H @@ -52,9 +67,14 @@ namespace mobject using boost::lambda::_1; using boost::lambda::var; - namespace // Implementation details //////////////////TODO better a named implementation namespace (avoids warnings on gcc 4.3) -//////////////////////////////////////////////////////////FIXME this is a *real* problem, because this namespace create storage, which it shouldn't - { + namespace impl { + + namespace { + uint maxSlots (0); ///< number of different registered Types + format dumpRecord ("%2i| %64s --> %s\n"); + } + + struct TableEntry { virtual ~TableEntry() {}; @@ -64,9 +84,6 @@ namespace mobject * for every participating kind of objects */ typedef std::vector< P > Table; - uint maxSlots (0); ///< number of different registered Types - - format dumpRecord ("%2i| %64s --> %s\n"); /** * holding a single "default object" entry @@ -83,13 +100,13 @@ namespace mobject query (q), objRef (obj) { } - + struct Search ///< Functor searching for a specific object { Search (const P& obj) : obj_(obj) { } - + const P& obj_; bool @@ -160,9 +177,9 @@ namespace mobject template size_t Slot::index (0); - } // (End) impl namespace - - + + + /** * @internal Helper for organizing preconfigured default objects. * Maintaines a collection of objects known or encountered as "default" @@ -315,9 +332,14 @@ namespace mobject return res; } }; - - + + + } // (End) impl namespace + + using impl::DefsRegistry; + + } // namespace mobject::session } // namespace mobject diff --git a/src/proc/mobject/session/session.cpp b/src/proc/mobject/session/session.cpp index 5c4bb8592..d8d20ed4c 100644 --- a/src/proc/mobject/session/session.cpp +++ b/src/proc/mobject/session/session.cpp @@ -32,9 +32,8 @@ #include "proc/mobject/session.hpp" -#include "proc/mobject/session/sessionimpl.hpp" #include "proc/mobject/session/defsmanager.hpp" -#include "proc/mobject/session/defsregistry.hpp" +#include "proc/mobject/session/sessionimpl.hpp" #include "common/singleton.hpp" diff --git a/src/proc/mobject/session/sessionimpl.hpp b/src/proc/mobject/session/sessionimpl.hpp index 89e3c020a..a56fdb217 100644 --- a/src/proc/mobject/session/sessionimpl.hpp +++ b/src/proc/mobject/session/sessionimpl.hpp @@ -94,6 +94,8 @@ namespace mobject friend class lumiera::singleton::StaticCreate; public: + virtual ~SessManagerImpl() {} + virtual void clear () ; virtual void reset () ; virtual void load () ; diff --git a/src/proc/mobject/session/sessmanagerimpl.cpp b/src/proc/mobject/session/sessmanagerimpl.cpp index 8195e4fbe..7ac96bee4 100644 --- a/src/proc/mobject/session/sessmanagerimpl.cpp +++ b/src/proc/mobject/session/sessmanagerimpl.cpp @@ -39,7 +39,7 @@ #include "proc/mobject/session.hpp" #include "proc/mobject/session/sessionimpl.hpp" #include "proc/mobject/session/defsmanager.hpp" -#include "proc/mobject/session/defsregistry.hpp" +//#include "proc/mobject/session/defsregistry.hpp" #include "common/error.hpp" using boost::scoped_ptr;