From aea5ed323a577035cb0947dde8f625f96ac1f575 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 23 Apr 2008 04:16:45 +0200 Subject: [PATCH] refactor to use the customized lumiera::P instead of shared_ptr --- src/common/configrules.hpp | 8 ++-- src/common/query/mockconfigrules.hpp | 2 +- src/proc/asset/buildinstruct.hpp | 5 ++- src/proc/asset/clip.hpp | 2 +- src/proc/asset/db.hpp | 2 +- src/proc/asset/media.cpp | 2 +- src/proc/asset/media.hpp | 11 +++--- src/proc/asset/meta.hpp | 2 +- src/proc/asset/pipe.hpp | 3 +- src/proc/asset/proc.hpp | 4 +- src/proc/asset/procpatt.cpp | 2 +- src/proc/asset/procpatt.hpp | 8 ++-- src/proc/asset/struct.cpp | 12 +++--- src/proc/asset/struct.hpp | 6 +-- src/proc/asset/track.hpp | 2 +- src/proc/assetmanager.cpp | 32 ++++++++-------- src/proc/assetmanager.hpp | 6 +-- src/proc/lumiera.hpp | 1 + src/proc/mobject/mobject.hpp | 15 ++++++-- src/proc/mobject/session/abstractmo.cpp | 10 ++++- src/proc/mobject/session/abstractmo.hpp | 2 + src/proc/mobject/session/clip.hpp | 4 +- src/proc/mobject/session/defsmanager.cpp | 20 +++++----- src/proc/mobject/session/defsmanager.hpp | 14 +++---- src/proc/mobject/session/defsregistry.hpp | 37 ++++++++++--------- src/proc/mobject/session/mobjectfactory.hpp | 2 +- src/proc/mobject/session/track.hpp | 6 ++- .../mobject/session/defsregistryimpltest.cpp | 11 ++++-- 28 files changed, 128 insertions(+), 103 deletions(-) diff --git a/src/common/configrules.hpp b/src/common/configrules.hpp index 81da041ae..0968c88d4 100644 --- a/src/common/configrules.hpp +++ b/src/common/configrules.hpp @@ -46,6 +46,7 @@ #ifndef LUMIERA_CONFIGRULES_H #define LUMIERA_CONFIGRULES_H +#include "common/p.hpp" #include "common/query.hpp" #include "common/typelistutil.hpp" #include "common/singletonsubclass.hpp" @@ -57,14 +58,13 @@ #include "proc/asset/track.hpp" #include -#include namespace lumiera { using std::string; - using std::tr1::shared_ptr; + using lumiera::P; @@ -148,13 +148,13 @@ namespace lumiera * @query any goals to be fulfilled by the solution. * @return false if resolution failed. In this case, solution ptr is empty. */ - virtual bool resolve (shared_ptr& solution, const Query& q) = 0; + virtual bool resolve (P& solution, const Query& q) = 0; }; // TODO: the Idea is to provide specialisations for the concrete types // we want to participate in the ConfigRules system.... // Thus we get the possibility to create a specific return type, - // e.g. return a shared_ptr but a Placement, using the appropriate factory. + // e.g. return a P but a Placement, using the appropriate factory. // Of course then the definitions need to be split up in separate headers. diff --git a/src/common/query/mockconfigrules.hpp b/src/common/query/mockconfigrules.hpp index f5bea3264..f56519ed6 100644 --- a/src/common/query/mockconfigrules.hpp +++ b/src/common/query/mockconfigrules.hpp @@ -74,7 +74,7 @@ namespace lumiera /** a traits-class to define the smart-ptr to wrap the result */ template - struct WrapReturn { typedef shared_ptr Wrapper; }; + struct WrapReturn { typedef P Wrapper; }; template<> struct WrapReturn { typedef PProcPatt Wrapper; }; diff --git a/src/proc/asset/buildinstruct.hpp b/src/proc/asset/buildinstruct.hpp index 577a108c1..8b1162103 100644 --- a/src/proc/asset/buildinstruct.hpp +++ b/src/proc/asset/buildinstruct.hpp @@ -41,12 +41,13 @@ using std::string; namespace asset { + using lumiera::P; class Proc; class ProcPatt; - typedef shared_ptr PProc; - typedef shared_ptr PProcPatt; + typedef P PProc; + typedef P PProcPatt; static Symbol CURRENT = "current"; diff --git a/src/proc/asset/clip.hpp b/src/proc/asset/clip.hpp index f5e1ea629..53a74faa5 100644 --- a/src/proc/asset/clip.hpp +++ b/src/proc/asset/clip.hpp @@ -53,7 +53,7 @@ namespace asset }; - typedef shared_ptr PClipAsset; + typedef P PClipAsset; const string CLIP_SUBFOLDER = "clips"; // TODO: handling of hard-wired constants.... diff --git a/src/proc/asset/db.hpp b/src/proc/asset/db.hpp index cb32868d7..f35785e5e 100644 --- a/src/proc/asset/db.hpp +++ b/src/proc/asset/db.hpp @@ -100,7 +100,7 @@ namespace asset bool del (ID hash) { return table.erase (hash); } template - shared_ptr + P get (ID hash) const { return dynamic_pointer_cast (find (hash)); diff --git a/src/proc/asset/media.cpp b/src/proc/asset/media.cpp index a91e8284b..68fcb0b56 100644 --- a/src/proc/asset/media.cpp +++ b/src/proc/asset/media.cpp @@ -219,7 +219,7 @@ namespace asset * @throw Invalid if the given media asset is not top-level, * but rather part or a multichannel (compound) media */ - shared_ptr + P MediaFactory::operator() (asset::Media& mediaref) throw(lumiera::error::Invalid) { if (mediaref.checkCompound()) diff --git a/src/proc/asset/media.hpp b/src/proc/asset/media.hpp index 4e122cd53..b14399ce5 100644 --- a/src/proc/asset/media.hpp +++ b/src/proc/asset/media.hpp @@ -52,6 +52,7 @@ namespace asset class MediaFactory; class ProcPatt; + using lumiera::P; using lumiera::Time; @@ -74,9 +75,9 @@ namespace asset const Time len_; public: - typedef shared_ptr PMedia; - typedef shared_ptr PClip; - typedef shared_ptr PProcPatt; + typedef P PMedia; + typedef P PClip; + typedef P PProcPatt; typedef mobject::session::PClipMO PClipMO; @@ -142,7 +143,7 @@ namespace asset class MediaFactory : public lumiera::Factory { public: - typedef shared_ptr PType; + typedef P PType; PType operator() (Asset::Ident& key, const string& file=""); PType operator() (const string& file, const Category& cat); @@ -152,7 +153,7 @@ namespace asset PType operator() (const char* file, const Category& cat); PType operator() (const char* file, asset::Kind); - shared_ptr + P operator() (asset::Media& mediaref) throw(lumiera::error::Invalid); }; diff --git a/src/proc/asset/meta.hpp b/src/proc/asset/meta.hpp index 02be992db..c15f14fbf 100644 --- a/src/proc/asset/meta.hpp +++ b/src/proc/asset/meta.hpp @@ -95,7 +95,7 @@ namespace asset class MetaFactory : public lumiera::Factory { public: - typedef shared_ptr PType; + typedef P PType; PType operator() (Asset::Ident& key); ////////////TODO define actual operation diff --git a/src/proc/asset/pipe.hpp b/src/proc/asset/pipe.hpp index 110dd1975..c2a9a8ff0 100644 --- a/src/proc/asset/pipe.hpp +++ b/src/proc/asset/pipe.hpp @@ -31,9 +31,10 @@ namespace asset { + using lumiera::P; class Pipe; - typedef shared_ptr PPipe; + typedef P PPipe; template<> diff --git a/src/proc/asset/proc.hpp b/src/proc/asset/proc.hpp index 05eca4ddf..724c8a786 100644 --- a/src/proc/asset/proc.hpp +++ b/src/proc/asset/proc.hpp @@ -48,7 +48,7 @@ namespace asset class Proc; class ProcFactory; - typedef shared_ptr PProc; + typedef P PProc; @@ -97,7 +97,7 @@ namespace asset class ProcFactory : public lumiera::Factory { public: - typedef shared_ptr PType; + typedef P PType; PType operator() (Asset::Ident& key); ////////////TODO define actual operation diff --git a/src/proc/asset/procpatt.cpp b/src/proc/asset/procpatt.cpp index 1adf8736c..d5173b9ea 100644 --- a/src/proc/asset/procpatt.cpp +++ b/src/proc/asset/procpatt.cpp @@ -60,7 +60,7 @@ namespace asset * some ProcPatt as a template for creating more * spezialized patterns. */ - shared_ptr + P ProcPatt::newCopy (string newID) const { TODO ("implement the Pattern-ID within the propDescriptor!"); diff --git a/src/proc/asset/procpatt.hpp b/src/proc/asset/procpatt.hpp index 6c8cf37e0..65f832b41 100644 --- a/src/proc/asset/procpatt.hpp +++ b/src/proc/asset/procpatt.hpp @@ -35,13 +35,14 @@ using std::vector; namespace asset { + using lumiera::P; using lumiera::Symbol; class Proc; class ProcPatt; class BuildInstruct; - typedef shared_ptr PProc; - typedef shared_ptr PProcPatt; + typedef P PProc; + typedef P PProcPatt; typedef vector InstructionSequence; @@ -61,14 +62,13 @@ namespace asset friend class StructFactoryImpl; public: - shared_ptr newCopy (string newID) const; + P newCopy (string newID) const; ProcPatt& attach (Symbol where, PProc& node); ProcPatt& operator+= (PProcPatt& toReuse); }; - typedef shared_ptr PProcPatt; diff --git a/src/proc/asset/struct.cpp b/src/proc/asset/struct.cpp index 6e85c50c2..5813ce339 100644 --- a/src/proc/asset/struct.cpp +++ b/src/proc/asset/struct.cpp @@ -89,10 +89,10 @@ namespace asset * created as a side effect of calling the concrete Struct subclass ctor. */ template - shared_ptr + P StructFactory::operator() (const Query& capabilities) { - shared_ptr res; + P res; QueryHandler& typeHandler = ConfigRules::instance(); typeHandler.resolve (res, capabilities); @@ -117,7 +117,7 @@ namespace asset * @see ProcPatt * @see DefaultsManager */ - shared_ptr + P StructFactory::operator() (string pipeID, string streamID) { normalizeID (pipeID); @@ -147,9 +147,9 @@ namespace asset namespace asset { - template shared_ptr StructFactory::operator() (const Query& query); - template shared_ptr StructFactory::operator() (const Query& query); - template PProcPatt StructFactory::operator() (const Query& query); + template P StructFactory::operator() (const Query& query); + template P StructFactory::operator() (const Query& query); + template PProcPatt StructFactory::operator() (const Query& query); } // namespace asset diff --git a/src/proc/asset/struct.hpp b/src/proc/asset/struct.hpp index 7c4c4367b..5941bd13a 100644 --- a/src/proc/asset/struct.hpp +++ b/src/proc/asset/struct.hpp @@ -120,12 +120,12 @@ namespace asset public: - typedef shared_ptr PType; + typedef P PType; template - shared_ptr operator() (const Query& query); ////////////TODO actually do something sensible here + P operator() (const Query& query); ////////////TODO actually do something sensible here - shared_ptr operator() (string pipeID, string streamID); + P operator() (string pipeID, string streamID); }; diff --git a/src/proc/asset/track.hpp b/src/proc/asset/track.hpp index a36a6242c..01abe5e8e 100644 --- a/src/proc/asset/track.hpp +++ b/src/proc/asset/track.hpp @@ -48,7 +48,7 @@ namespace asset }; - typedef shared_ptr PTrack; + typedef P PTrack; diff --git a/src/proc/assetmanager.cpp b/src/proc/assetmanager.cpp index fcdf45dc0..9acb29daa 100644 --- a/src/proc/assetmanager.cpp +++ b/src/proc/assetmanager.cpp @@ -130,11 +130,11 @@ namespace asset * of the stored object differs and can't be casted. */ template - shared_ptr + P AssetManager::getAsset (const ID& id) throw(lumiera::error::Invalid) { - if (shared_ptr obj = registry.get (id)) + if (P obj = registry.get (id)) return obj; else if (known (id)) // provide Ident tuple of existing Asset @@ -143,14 +143,14 @@ namespace asset throw UnknownID (id); } - /** convienience shortcut for fetching the registered shared_ptr + /** convienience shortcut for fetching the registered smart-ptr * which is in charge of the given asset instance. By querying * directly asset.id (of type ID), the call to registry.get() * can bypass the dynamic cast, because the type of the asset * is explicitely given by type KIND. */ template - shared_ptr + P AssetManager::wrap (const KIND& asset) { ENSURE (instance().known(asset.id), @@ -169,7 +169,7 @@ namespace asset { return ( registry.get (ID(id)) ); } // query most general Asset ID-kind and use implicit - // conversion from shared_ptr to bool (test if empty) + // conversion from smart-ptr to bool (test if empty) /** @@ -245,18 +245,18 @@ namespace asset template ID AssetManager::reg (Asset* obj, const Asset::Ident& idi); - template shared_ptr AssetManager::getAsset (const ID& id) throw(lumiera::error::Invalid); - template shared_ptr AssetManager::getAsset (const ID& id) throw(lumiera::error::Invalid); - template shared_ptr AssetManager::getAsset (const ID& id) throw(lumiera::error::Invalid); - template shared_ptr AssetManager::getAsset (const ID& id) throw(lumiera::error::Invalid); - template shared_ptr AssetManager::getAsset (const ID& id) throw(lumiera::error::Invalid); + template P AssetManager::getAsset (const ID& id) throw(lumiera::error::Invalid); + template P AssetManager::getAsset (const ID& id) throw(lumiera::error::Invalid); + template P AssetManager::getAsset (const ID& id) throw(lumiera::error::Invalid); + template P AssetManager::getAsset (const ID& id) throw(lumiera::error::Invalid); + template P AssetManager::getAsset (const ID& id) throw(lumiera::error::Invalid); - template shared_ptr AssetManager::wrap (const Asset& asset); - template shared_ptr AssetManager::wrap (const Media& asset); - template shared_ptr AssetManager::wrap (const Clip& asset); - template shared_ptr AssetManager::wrap (const Track& asset); - template shared_ptr AssetManager::wrap (const Pipe& asset); - template shared_ptr AssetManager::wrap (const ProcPatt& asset); + template P AssetManager::wrap (const Asset& asset); + template P AssetManager::wrap (const Media& asset); + template P AssetManager::wrap (const Clip& asset); + template P AssetManager::wrap (const Track& asset); + template P AssetManager::wrap (const Pipe& asset); + template P AssetManager::wrap (const ProcPatt& asset); } // namespace asset diff --git a/src/proc/assetmanager.hpp b/src/proc/assetmanager.hpp index 22138065d..3f62d2ecd 100644 --- a/src/proc/assetmanager.hpp +++ b/src/proc/assetmanager.hpp @@ -73,13 +73,13 @@ namespace asset /** provide the unique ID for given Asset::Ident tuple */ static ID getID (const Asset::Ident&); - /** retrieve the registerd shared_ptr for any asset */ + /** retrieve the registerd smart-ptr for any asset */ template - static shared_ptr wrap (const KIND& asset); + static P wrap (const KIND& asset); /** find and return corresponging object */ template - shared_ptr getAsset (const ID& id) throw(lumiera::error::Invalid); + P getAsset (const ID& id) throw(lumiera::error::Invalid); /** @return true if the given id is registered in the internal asset DB */ diff --git a/src/proc/lumiera.hpp b/src/proc/lumiera.hpp index b56ab69b6..c00a70254 100644 --- a/src/proc/lumiera.hpp +++ b/src/proc/lumiera.hpp @@ -30,6 +30,7 @@ /* common types frequently used... */ +#include "common/p.hpp" #include "common/util.hpp" #include "common/time.hpp" #include "common/error.hpp" ///< pulls in NoBug via nobugcfg.hpp diff --git a/src/proc/mobject/mobject.hpp b/src/proc/mobject/mobject.hpp index a8c02c761..28ab788ed 100644 --- a/src/proc/mobject/mobject.hpp +++ b/src/proc/mobject/mobject.hpp @@ -26,17 +26,18 @@ #include "pre.hpp" -#include -#include #include "proc/lumiera.hpp" #include "proc/mobject/builder/buildertool.hpp" #include "proc/mobject/placement.hpp" #include "proc/asset.hpp" // TODO finally not needed? +#include +#include +#include + using std::list; -using std::tr1::shared_ptr; #include "proc/assetmanager.hpp" using proc_interface::IDA; // TODO finally not needed? @@ -45,6 +46,7 @@ using proc_interface::AssetManager; namespace mobject { + using lumiera::P; namespace session { @@ -58,7 +60,10 @@ namespace mobject * manipulated and finally rendered within Lumiera's EDL * are MObjects. */ - class MObject : public Buildable + class MObject + : public Buildable, + boost::noncopyable, + boost::equality_comparable< MObject > { protected: typedef lumiera::Time Time; @@ -79,6 +84,8 @@ namespace mobject virtual bool isValid() const =0; virtual Time& getLength() =0; ///< @todo how to deal with the time/length field?? + + virtual bool operator== (const MObject& oo) const =0; }; diff --git a/src/proc/mobject/session/abstractmo.cpp b/src/proc/mobject/session/abstractmo.cpp index e484eee6e..e3ebffd4f 100644 --- a/src/proc/mobject/session/abstractmo.cpp +++ b/src/proc/mobject/session/abstractmo.cpp @@ -28,8 +28,14 @@ namespace mobject namespace session { - /** */ - + /** default/fallback implementation of equality + * using literal object identity (same address) + */ + bool + AbstractMO::operator== (const MObject& oo) const + { + return (this == &oo); + } } // namespace mobject::session diff --git a/src/proc/mobject/session/abstractmo.hpp b/src/proc/mobject/session/abstractmo.hpp index 45942986d..5de61737f 100644 --- a/src/proc/mobject/session/abstractmo.hpp +++ b/src/proc/mobject/session/abstractmo.hpp @@ -49,6 +49,8 @@ namespace mobject DEFINE_PROCESSABLE_BY (builder::BuilderTool); + virtual bool operator== (const MObject& oo) const; + }; diff --git a/src/proc/mobject/session/clip.hpp b/src/proc/mobject/session/clip.hpp index 75cac3ef7..cf15cbd27 100644 --- a/src/proc/mobject/session/clip.hpp +++ b/src/proc/mobject/session/clip.hpp @@ -38,8 +38,8 @@ namespace mobject namespace session { using asset::Media; - typedef shared_ptr PMedia; - typedef shared_ptr PClipAsset; + typedef P PMedia; + typedef P PClipAsset; /** diff --git a/src/proc/mobject/session/defsmanager.cpp b/src/proc/mobject/session/defsmanager.cpp index c84e5116d..b60e38064 100644 --- a/src/proc/mobject/session/defsmanager.cpp +++ b/src/proc/mobject/session/defsmanager.cpp @@ -39,7 +39,7 @@ namespace mobject { namespace session { - using std::tr1::shared_ptr; + using lumiera::P; @@ -52,10 +52,10 @@ namespace mobject template - shared_ptr + P DefsManager::search (const Query& capabilities) { - shared_ptr res; + P res; QueryHandler& typeHandler = ConfigRules::instance(); for (DefsRegistry::Iter i = defsRegistry->candidates(capabilities); res = *i ; ++i ) @@ -69,10 +69,10 @@ namespace mobject template - shared_ptr + P DefsManager::create (const Query& capabilities) { - shared_ptr res; + P res; QueryHandler& typeHandler = ConfigRules::instance(); typeHandler.resolve (res, capabilities); if (res) @@ -83,9 +83,9 @@ namespace mobject template bool - DefsManager::define (const shared_ptr& defaultObj, const Query& capabilities) + DefsManager::define (const P& defaultObj, const Query& capabilities) { - shared_ptr candidate (defaultObj); + P candidate (defaultObj); QueryHandler& typeHandler = ConfigRules::instance(); typeHandler.resolve (candidate, capabilities); if (!candidate) @@ -97,17 +97,17 @@ namespace mobject template bool - DefsManager::forget (const shared_ptr& defaultObj) + DefsManager::forget (const P& defaultObj) { return defsRegistry->forget (defaultObj); } template - shared_ptr + P DefsManager::operator() (const Query& capabilities) { - shared_ptr res (search (capabilities)); + P res (search (capabilities)); if (res) return res; else diff --git a/src/proc/mobject/session/defsmanager.hpp b/src/proc/mobject/session/defsmanager.hpp index 753b452d2..eb2ca1502 100644 --- a/src/proc/mobject/session/defsmanager.hpp +++ b/src/proc/mobject/session/defsmanager.hpp @@ -25,11 +25,11 @@ #define MOBJECT_SESSION_DEFSMANAGER_H +#include "common/p.hpp" #include "common/query.hpp" #include #include -#include @@ -37,7 +37,7 @@ namespace mobject { namespace session { - using std::tr1::shared_ptr; + using lumiera::P; using boost::scoped_ptr; class DefsRegistry; @@ -69,14 +69,14 @@ namespace mobject * is considered \e misconfiguration. */ template - shared_ptr operator() (const lumiera::Query&); + P operator() (const lumiera::Query&); /** search through the registered defaults, never create anything. * @return object fulfilling the query, \c empty ptr if not found. */ template - shared_ptr search (const lumiera::Query&); + P search (const lumiera::Query&); /** retrieve an object fulfilling the query and register it as default. * The resolution is delegated to the ConfigQuery system (which may cause @@ -84,7 +84,7 @@ namespace mobject * @return object fulfilling the query, \c empty ptr if no solution. */ template - shared_ptr create (const lumiera::Query&); + P create (const lumiera::Query&); /** register the given object as default, after ensuring it fulfills the * query. The latter may cause some properties of the object to be set, @@ -93,13 +93,13 @@ namespace mobject * @note only a weak ref to the object is stored */ template - bool define (const shared_ptr&, const lumiera::Query&); + bool define (const P&, const lumiera::Query&); /** remove the defaults registration of the given object, if there was such * @return false if nothing has been changed because the object wasn't registered */ template - bool forget (const shared_ptr&); + bool forget (const P&); // Q: can we have something along the line of...? diff --git a/src/proc/mobject/session/defsregistry.hpp b/src/proc/mobject/session/defsregistry.hpp index 4aca10868..7d7589110 100644 --- a/src/proc/mobject/session/defsregistry.hpp +++ b/src/proc/mobject/session/defsregistry.hpp @@ -28,6 +28,7 @@ #include "common/multithread.hpp" #include "common/query.hpp" #include "common/util.hpp" +#include "common/p.hpp" #include #include @@ -41,10 +42,10 @@ namespace mobject { namespace session { - using std::tr1::shared_ptr; - using std::tr1::weak_ptr; - using lumiera::Thread; + using lumiera::P; using lumiera::Query; + using lumiera::Thread; + using std::tr1::weak_ptr; using std::string; using boost::format; @@ -60,7 +61,7 @@ namespace mobject /** we maintain an independent defaults registry * for every participating kind of objects */ - typedef std::vector > Table; + typedef std::vector< P > Table; uint maxSlots (0); ///< number of different registered Types @@ -76,7 +77,7 @@ namespace mobject Query query; weak_ptr objRef; - Record (const Query& q, const shared_ptr& obj) + Record (const Query& q, const P& obj) : degree (lumiera::query::countPraed (q)), query (q), objRef (obj) @@ -85,15 +86,15 @@ namespace mobject struct Search ///< Functor searching for a specific object { - Search (const shared_ptr& obj) + Search (const P& obj) : obj_(obj) { } - const shared_ptr& obj_; + const P& obj_; bool operator() (const Record& rec) { - shared_ptr storedObj (rec.objRef.lock()); + P storedObj (rec.objRef.lock()); return storedObj && (storedObj == obj_); } }; @@ -110,7 +111,7 @@ namespace mobject }; operator string () const { return str (dumpRecord % degree % query % dumpObj()); } - string dumpObj () const { shared_ptr o (objRef.lock()); return o? string(*o):"dead"; } + string dumpObj () const { P o (objRef.lock()); return o? string(*o):"dead"; } }; /** every new kind of object (Type) creates a new @@ -186,7 +187,7 @@ namespace mobject typedef typename Slot::Registry::iterator II; II p,i,e; - shared_ptr next, ptr; + P next, ptr; Iter (II from, II to) ///< just ennumerates the given range : p(from), i(from), e(to) @@ -201,7 +202,7 @@ namespace mobject operator++ (); // init to first element (or to null if emty) } - shared_ptr findNext () throw() + P findNext () throw() { while (!next) { @@ -214,9 +215,9 @@ namespace mobject public: - shared_ptr operator* () { return ptr; } - bool hasNext () { return next || findNext(); } - Iter operator++ (int) { Iter tmp=*this; operator++(); return tmp; } + P operator* () { return ptr; } + bool hasNext () { return next || findNext(); } + Iter operator++ (int) { Iter tmp=*this; operator++(); return tmp; } Iter& operator++ () { ptr=findNext(); @@ -237,7 +238,7 @@ namespace mobject template Iter candidates (const Query& query) { - shared_ptr dummy; + P dummy; Record entry (query, dummy); typedef typename Slot::Registry Registry; Registry& registry = Slot::access(table_); @@ -261,7 +262,7 @@ namespace mobject * case, also the param obj shared-ptr is rebound! */ template - bool put (shared_ptr& obj, const Query& query) + bool put (P& obj, const Query& query) { Record entry (query, obj); typedef typename Slot::Registry Registry; @@ -272,7 +273,7 @@ namespace mobject if ( pos!=registry.end() && pos->query == query) { - shared_ptr storedObj (pos->objRef.lock()); + P storedObj (pos->objRef.lock()); if (storedObj) return (storedObj == obj); else @@ -290,7 +291,7 @@ namespace mobject * @return false if the object wasn't registered at all. */ template - bool forget (const shared_ptr& obj) + bool forget (const P& obj) { typedef typename Slot::Registry Registry; typedef typename Record::Search SearchFunc; diff --git a/src/proc/mobject/session/mobjectfactory.hpp b/src/proc/mobject/session/mobjectfactory.hpp index cff884ca7..427385194 100644 --- a/src/proc/mobject/session/mobjectfactory.hpp +++ b/src/proc/mobject/session/mobjectfactory.hpp @@ -45,7 +45,7 @@ namespace mobject class Track; class Effect; - typedef shared_ptr PTrackAsset; + typedef P PTrackAsset; class MObjectFactory diff --git a/src/proc/mobject/session/track.hpp b/src/proc/mobject/session/track.hpp index 2b8f090b9..2b9801273 100644 --- a/src/proc/mobject/session/track.hpp +++ b/src/proc/mobject/session/track.hpp @@ -34,11 +34,13 @@ namespace mobject { namespace session { + using lumiera::P; + class Track; typedef asset::Track TrackAsset; - typedef shared_ptr PTrack; - typedef shared_ptr PTrackAsset; + typedef P PTrack; + typedef P PTrackAsset; /** diff --git a/tests/components/proc/mobject/session/defsregistryimpltest.cpp b/tests/components/proc/mobject/session/defsregistryimpltest.cpp index 0aae90b3a..e605880a1 100644 --- a/tests/components/proc/mobject/session/defsregistryimpltest.cpp +++ b/tests/components/proc/mobject/session/defsregistryimpltest.cpp @@ -27,6 +27,7 @@ #include "proc/mobject/session/defsregistry.hpp" #include "common/factory.hpp" #include "common/query.hpp" +#include "common/p.hpp" #include "../common/query/querydiagnostics.hpp" @@ -35,11 +36,11 @@ #include #include +using lumiera::P; using lumiera::Query; using lumiera::query::test::garbage_query; using util::isnil; -using std::tr1::shared_ptr; using boost::scoped_ptr; using boost::format; using std::string; @@ -75,7 +76,9 @@ namespace mobject { static string name; string instanceID; - operator string () const { return instanceID; } + operator string () const { return instanceID; } + bool operator== (const Dummy& odu) const { return this == &odu; } + Dummy () : instanceID (newID (name)) {} }; @@ -99,8 +102,8 @@ namespace mobject { scoped_ptr reg_; - typedef shared_ptr > O; - typedef shared_ptr > P; + typedef P > O; + typedef P > P; typedef Query > Q13; typedef Query > Q23;