diff --git a/src/proc/mobject/mobject.hpp b/src/proc/mobject/mobject.hpp index a91dbe179..b670d1e47 100644 --- a/src/proc/mobject/mobject.hpp +++ b/src/proc/mobject/mobject.hpp @@ -29,11 +29,16 @@ #include "cinelerra.h" #include "proc/mobject/buildable.hpp" +#include "proc/asset.hpp" // TODO finally not needed? using std::list; using std::tr1::shared_ptr; +#include "proc/assetmanager.hpp" +using proc_interface::IDA; // TODO finally not needed? +using proc_interface::PAsset; //TODO: only temporarily +using proc_interface::AssetManager; namespace mobject { @@ -54,8 +59,13 @@ namespace mobject // TODO: how to represent time intervals best? Time length; - - list placement; + + virtual ~MObject() {}; + + public: + virtual shared_ptr& getPlacement () =0; + virtual PAsset getMedia () =0; ///< @todo solve the reference/Interface problem concerning Placements, then push down + virtual Time& getLength() =0; ///< @todo how to deal with the time/length field?? }; diff --git a/src/proc/mobject/placement.cpp b/src/proc/mobject/placement.cpp index eccd34e80..a887eb771 100644 --- a/src/proc/mobject/placement.cpp +++ b/src/proc/mobject/placement.cpp @@ -28,6 +28,9 @@ namespace mobject { + /** factory for creating the corretct Placement subclass */ + PlacementFactory Placement::create; + /** create an actual (explicit) placement while trying to * satisfy the network of adjacent objects and placements. @@ -37,6 +40,18 @@ namespace mobject Placement::resolve () { } + + + + /** implements the logic for selecting the correct + * Placement subclass. + * @return smart ptr owning the created placement object + */ + PlacementFactory::PType + PlacementFactory::operator() (Placement::Style, Time, PMO subject) + { + UNIMPLEMENTED ("create correct Placement subclass"); + } diff --git a/src/proc/mobject/placement.hpp b/src/proc/mobject/placement.hpp index 726379ffb..1293b9745 100644 --- a/src/proc/mobject/placement.hpp +++ b/src/proc/mobject/placement.hpp @@ -45,10 +45,10 @@ namespace mobject typedef cinelerra::Time Time; typedef session::Track Track; - MObject* subject; - public: + MObject* subject; + /** * styles of placement. */ diff --git a/src/proc/mobject/session.hpp b/src/proc/mobject/session.hpp new file mode 100644 index 000000000..b83affe14 --- /dev/null +++ b/src/proc/mobject/session.hpp @@ -0,0 +1,145 @@ +/* + SESSION.hpp - holds the complete session to be edited by the user + + Copyright (C) CinelerraCV + 2007, Christian Thaeter + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + + +/** @file session.hpp + ** Primary Interface to the current Session. + ** The Interface Session is abstract and only accessible via the + ** static field Session::current, which actually refers to a SessManager + ** singleton instance. The latter acts as smart ptr-to-Impl. + ** + */ + + +#ifndef MOBJECT_SESSION_H +#define MOBJECT_SESSION_H + +#include "proc/mobject/placement.hpp" +#include "common/singleton.hpp" + +#include +#include + + + +namespace mobject + { + namespace session + { + class SessManager; + class EDL; + class Fixture; + typedef std::tr1::shared_ptr PFix; + } + + typedef session::SessManager& PSess; ///< acts as a "PImpl" smart ptr + + + /** + * The (current) Session holds all the user + * visible content to be edited and manipulated + * within the Cinelerra Application. From a users + * perspective, it is a collection of Media Objects + * (--> MObject) placed (--> Placement) onto virtual + * Tracks. + * + * Opening a Session has effectively global consequences, + * because the Session defines the available Assets, and some + * kinds of Assets define default behaviour. Thus, access to + * the Session is similar to a Singleton instance. + * + * @note Any client should be aware that the Session can be closed, + * replaced and loaded. The only way to accees the Session is + * via a "PImpl" smart pointer session::PSess (which indeed is + * a reference to the SessManager and is accessible as the static + * field Session::current). You will never be able to get a direct + * pointer or reference to the Session object. + * + */ + class Session : private boost::noncopyable + { + protected: + Session () throw(); + virtual ~Session () = 0; + + public: + static session::SessManager& current; + + virtual bool isValid () = 0; + virtual void add (PPla& placement) = 0; + virtual bool remove (PPla& placement) = 0; + + /// @deprecated Ichthyo doubts it is good design to hand out the EDL?? + virtual session::EDL& currEDL () = 0; + + virtual session::PFix& getFixture () = 0; + virtual void rebuildFixture () = 0; + + }; + + + namespace session + { + + /** + * creation, access and Session lifecycle Interface. + * An instance is accessible via Session::current + */ + class SessManager : private boost::noncopyable + { + public: + /** clear current session contents + * without resetting overall session config. + * Afterwards, the session will contain only one + * empty EDL, while all Assets are retained. + */ + virtual void clear () =0; + + /** reset all session config and + * start with a pristine default session. + */ + virtual void reset () =0; + + /** replace the current session by a new + * session loaded from serialized state. + */ + virtual void load () =0; + + /** create a complete, serialized representation + * of the current session config and contents. + * @todo how to serialize, prameters, return value? + */ + virtual void save () =0; + + /** access to the current session object instance. + * This is the sole access path available for clients. + * @note there is no operator* + */ + virtual Session* operator-> () throw() =0; + + virtual ~SessManager() {}; + }; + + } // namespace mobject::session + +} // namespace mobject +#endif diff --git a/src/proc/mobject/session/abstractmo.hpp b/src/proc/mobject/session/abstractmo.hpp index 560e4e7b6..3ea6da648 100644 --- a/src/proc/mobject/session/abstractmo.hpp +++ b/src/proc/mobject/session/abstractmo.hpp @@ -37,7 +37,19 @@ namespace mobject class AbstractMO : public MObject { ////////////// TODO: work out common services to provide!!!! - }; + shared_ptr placement_; + + public: + /* some dummy implementations used to make the code compile... */ + + virtual shared_ptr& getPlacement () { return placement_; } + virtual Time& getLength() { return length; } + virtual PAsset getMedia () + { + UNIMPLEMENTED ("how to relate MObjects and media assets..."); + return AssetManager::instance().getAsset(IDA(0)); // KABOOM! (just to make it compile) + } + }; diff --git a/src/proc/mobject/session/edl.cpp b/src/proc/mobject/session/edl.cpp index 8fc76bb0c..4b577e059 100644 --- a/src/proc/mobject/session/edl.cpp +++ b/src/proc/mobject/session/edl.cpp @@ -23,6 +23,7 @@ #include "proc/mobject/session/edl.hpp" #include "proc/mobject/session/track.hpp" +#include "proc/mobject/placement.hpp" #include "proc/mobject/mobject.hpp" namespace mobject @@ -30,7 +31,22 @@ namespace mobject namespace session { - /** */ + /** @deprecated not sure if it is a good idea + * to have this on the interface + */ + bool + EDL::contains (const PPla& placement) + { + UNIMPLEMENTED ("test if a given placement is contained within this EDL"); + } + + + PPla& + EDL::find (const string& id) + { + UNIMPLEMENTED ("serch for a given 'thing' within the EDL"); + } + diff --git a/src/proc/mobject/session/edl.hpp b/src/proc/mobject/session/edl.hpp index 31b0319a4..24a7a136f 100644 --- a/src/proc/mobject/session/edl.hpp +++ b/src/proc/mobject/session/edl.hpp @@ -24,26 +24,39 @@ #ifndef MOBJECT_SESSION_EDL_H #define MOBJECT_SESSION_EDL_H -#include +#include +#include #include "proc/mobject/mobject.hpp" -#include "proc/mobject/session/track.hpp" +#include "proc/mobject/placement.hpp" +#include "proc/asset/track.hpp" +using proc_interface::PAsset; // TODO better methot to refer to a track? -using std::list; +using std::vector; +using std::string; namespace mobject { namespace session { - class EDL { protected: - list tracks; - list clips; + vector tracks; + vector clips; + public: + bool contains (const PPla& placement); + PPla& find (const string& id); ///< @todo how to refer to clips? using asset IDs?? + + vector& getTracks () { return tracks; } ///< @todo use track assets correct, make const! + size_t size () + { + UNIMPLEMENTED ("what ist the 'size' of an EDL?"); + return 0; + } }; diff --git a/src/proc/mobject/session/fixture.cpp b/src/proc/mobject/session/fixture.cpp index 73fa72e7e..ed1682168 100644 --- a/src/proc/mobject/session/fixture.cpp +++ b/src/proc/mobject/session/fixture.cpp @@ -1,5 +1,5 @@ /* - Fixture - the (low level) representation of the EDL with concrete placement data + Fixture - the (low level) representation of the EDL with explicit placement data Copyright (C) CinelerraCV 2007, Christian Thaeter @@ -22,6 +22,7 @@ #include "proc/mobject/session/fixture.hpp" +#include "nobugcfg.h" namespace mobject { @@ -33,7 +34,7 @@ namespace mobject list & Fixture::getPlaylistForRender () { - abort();/////////////////////TODO + UNIMPLEMENTED ("get Playlist For Render"); } @@ -43,7 +44,8 @@ namespace mobject Auto* Fixture::getAutomation () { - return 0;/////////////////////TODO + UNIMPLEMENTED ("getAutomation from Fixture"); + return 0; } diff --git a/src/proc/mobject/session/fixture.hpp b/src/proc/mobject/session/fixture.hpp index eebdc87af..4467abd8b 100644 --- a/src/proc/mobject/session/fixture.hpp +++ b/src/proc/mobject/session/fixture.hpp @@ -1,5 +1,5 @@ /* - FIXTURE.hpp - the (low level) representation of the EDL with concrete placement data + FIXTURE.hpp - the (low level) representation of the EDL with explicit placement data Copyright (C) CinelerraCV 2007, Christian Thaeter @@ -25,6 +25,7 @@ #define MOBJECT_SESSION_FIXTURE_H #include +#include #include "proc/mobject/session/edl.hpp" #include "proc/mobject/session/track.hpp" @@ -33,6 +34,7 @@ using std::list; +using std::tr1::shared_ptr; @@ -52,8 +54,12 @@ namespace mobject public: list & getPlaylistForRender () ; - Auto* getAutomation () ; /////TODO: just a placeholder at the moment!!! + Auto* getAutomation () ; ///< @todo: just a placeholder at the moment!!! }; + + + + typedef shared_ptr PFix; diff --git a/src/proc/mobject/session/session.cpp b/src/proc/mobject/session/session.cpp index e926c72ad..136347bf5 100644 --- a/src/proc/mobject/session/session.cpp +++ b/src/proc/mobject/session/session.cpp @@ -21,36 +21,46 @@ * *****************************************************/ -#include "proc/mobject/session/session.hpp" -#include "proc/mobject/session/edl.hpp" -#include "proc/mobject/session/fixture.hpp" +/** @file session.cpp + ** Actual connection between the Session interface and its Implementation. + ** Holds the storage for the SessionManager implementation (singleton) + ** + ** @see session::SessionImpl + ** @see session::SessionManagerImpl + ** + */ + + +#include "proc/mobject/session.hpp" +#include "proc/mobject/session/sessionimpl.hpp" + +#include "common/singleton.hpp" using cinelerra::Singleton; +using mobject::session::SessManager; +using mobject::session::SessManagerImpl; namespace mobject { - namespace session - { - /** @return the system-wide current session. - * Implemented as singleton. - */ - Singleton Session::getCurrent; + /** the sole acces point for all client code to the system-wide + * "current session". Implemented as smart pointer to singleton + * implementation object, where the smart pointer is actually + * the SessionManager (which is singleton as well...). + * + * Consequently, if you want to talk to the session manager, + * you use dot-notation, while you access the session object + * via arrow notaion (e.g. \code Session::current->getFixture() ) + */ + SessManager& Session::current = Singleton()(); + - /** create a new empty session with default values. - */ - Session::Session () - : edl(), - fixture() - { - - } + Session::Session () throw() { } + Session::~Session () { } - } // namespace mobject::session - } // namespace mobject diff --git a/src/proc/mobject/session/session.hpp b/src/proc/mobject/session/session.hpp deleted file mode 100644 index f17ea1b00..000000000 --- a/src/proc/mobject/session/session.hpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - SESSION.hpp - holds the complete session to be edited by the user - - Copyright (C) CinelerraCV - 2007, Christian Thaeter - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - - -#ifndef MOBJECT_SESSION_SESSION_H -#define MOBJECT_SESSION_SESSION_H - -#include "common/singleton.hpp" -#include "proc/mobject/placement.hpp" - -#include - - - -namespace mobject - { - namespace session - { - - class EDL; - class Fixture; - - /** - * The (current) Session holds all the user - * visible content to be edited and manipulated - * within the Cinelerra Application. From a users - * perspective, it is a collection of Media Objects - * (--> MObject) placed (--> Placement) onto virtual - * Tracks. - * - * Opening a Session has effectively global consequences, - * because the Session defines the available Assets, and some - * kinds of Assets define default behaviour. Thus, access to - * the Session is similar to a Singleton instance. - * - */ - class Session : private boost::noncopyable - { - protected: - vector edls; - Fixture fixture; - - Session (); - friend class cinelerra::singleton::StaticCreate; //TODO use PImpl or just covariance?? - - public: - static cinelerra::Singleton getCurrent; - - void add (PPla placement); - - - EDL& currEDL () { return edl; } - Fixture& getFixture () { return fixture; } - - }; - - - - } // namespace mobject::session - -} // namespace mobject -#endif diff --git a/src/proc/mobject/session/sessionimpl.cpp b/src/proc/mobject/session/sessionimpl.cpp index d8a946002..056732116 100644 --- a/src/proc/mobject/session/sessionimpl.cpp +++ b/src/proc/mobject/session/sessionimpl.cpp @@ -22,16 +22,92 @@ #include "proc/mobject/session/sessionimpl.hpp" -#include "proc/mobject/session/edl.hpp" -#include "proc/mobject/session/fixture.hpp" +#include "proc/mobject/placement.hpp" +#include "common/error.hpp" namespace mobject { - namespace session { - /** */ + /** create a new empty session with default values. + * @note any exception arising while creating this + * default session will inevitably halt the + * system (and this is desirable) + */ + SessionImpl::SessionImpl () throw() + : Session(), + focusEDL_(0), + edls(1), + fixture(new Fixture) + { + } + + + /** @internal used by SessionManager#clear + * discard all EDL content, without + * touching global configuration. + */ + void + SessionImpl::clear () + { + try + { + edls.clear(); + edls.resize(1); + focusEDL_ = 0; + } + catch (...) + { + focusEDL_ = 0; + throw cinelerra::error::Fatal ("unexpected exception while clearing EDLs"); + } + } + + + bool + SessionImpl::isValid () + { + UNIMPLEMENTED ("session self test"); + return false; // TODO + } + + + void + SessionImpl::add (PPla& placement) + { + UNIMPLEMENTED ("add Placement to the current EDL"); + } + + + bool + SessionImpl::remove (PPla& placement) + { + UNIMPLEMENTED ("search and remove a given Placement from current EDL"); + return false; // TODO + } + + /// @deprecated should not grant direct access to EDL objects + EDL& + SessionImpl::currEDL () + { + ASSERT (focusEDL_ < edls.size()); + return edls[focusEDL_]; + } + + + PFix& + SessionImpl::getFixture () + { + return fixture; + } + + + void + SessionImpl::rebuildFixture () + { + UNIMPLEMENTED ("rebuild Fixture"); + } diff --git a/src/proc/mobject/session/sessionimpl.hpp b/src/proc/mobject/session/sessionimpl.hpp index 5f4aedb1c..658f5d56a 100644 --- a/src/proc/mobject/session/sessionimpl.hpp +++ b/src/proc/mobject/session/sessionimpl.hpp @@ -21,13 +21,21 @@ */ +/** @file sessionimpl.hpp + ** Session and SessionManager Implemention classes. + ** These are primary Interfaces and we hide all implementaion complexities, + ** + */ + + #ifndef MOBJECT_SESSION_SESSIONIMPL_H #define MOBJECT_SESSION_SESSIONIMPL_H -#include "proc/mobject/session/session.hpp" +#include "proc/mobject/session.hpp" #include "proc/mobject/session/edl.hpp" #include "proc/mobject/session/fixture.hpp" +#include #include using std::vector; @@ -46,18 +54,48 @@ namespace mobject class SessionImpl : public mobject::Session { protected: + uint focusEDL_; vector edls; - Fixture fixture; + PFix fixture; - SessionImpl (); - friend class cinelerra::singleton::StaticCreate; + SessionImpl () throw(); + friend class SessManagerImpl; - void add (PPla placement); + void clear (); - EDL& currEDL () { return edl; } - Fixture& getFixture () { return fixture; } + public: + virtual bool isValid (); + virtual void add (PPla& placement); + virtual bool remove (PPla& placement); + + virtual EDL& currEDL (); + + virtual PFix& getFixture (); + virtual void rebuildFixture (); }; + + + /** + * Session manager implementation class holding the + * actual smart pointer to the current Session impl. + */ + class SessManagerImpl : public SessManager + { + boost::scoped_ptr pImpl_; + + SessManagerImpl() throw(); + friend class cinelerra::singleton::StaticCreate; + + public: + virtual void clear () ; + virtual void reset () ; + virtual void load () ; + virtual void save () ; + virtual Session* operator-> () throw() { return pImpl_.get(); } + }; + + } // namespace mobject::session diff --git a/src/proc/mobject/session/sessmanagerimpl.cpp b/src/proc/mobject/session/sessmanagerimpl.cpp new file mode 100644 index 000000000..85998b8c6 --- /dev/null +++ b/src/proc/mobject/session/sessmanagerimpl.cpp @@ -0,0 +1,114 @@ +/* + SessManagerImpl - global session access and lifecycle + + Copyright (C) CinelerraCV + 2007, Christian Thaeter + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + + +/** @file sessmanagerimpl.cpp + ** Implemention of the Session management functions. + ** The Class SessManager is declared alongside with mobject::Session, + ** because it serves as smart ptr-to-Impl at the same time. Effectively, + ** the session manager owns the current session object and only grants + ** access via his overloaded operator->() . Because there is no operator*(), + ** no one can get at the address of the current session object. (correct?) + ** + ** @see sessionimpl.hpp + ** @see mobject::Session#current + ** @see mobject::session::SessionManager_test + ** + */ + + +#include "proc/mobject/session.hpp" +#include "proc/mobject/session/sessionimpl.hpp" + +using boost::scoped_ptr; + + + +namespace mobject + { + namespace session + { + + /** Besides creating the single system-wide Session manger instance, + * creates an empty default Session as well. + * @note any exceptions arising in the course of this will halt + * the system (and this behaviour is desirable). + */ + SessManagerImpl::SessManagerImpl () throw() + : pImpl_ (new SessionImpl) + { + } + + /** @note no transactional behaviour. + * may succeed partial. + */ + void + SessManagerImpl::clear () + { + pImpl_->clear(); + } + + + /** @note this operation is atomic and either succeeds or + * failes completely, in which case the current session + * remains unaltered. + * @todo for this to work, we need to change the implementation of + * AssetManager so support this kind of transactional switch! + */ + void + SessManagerImpl::reset () + { + scoped_ptr tmp (new SessionImpl); + + TODO ("reset the assets registered with AssetManager"); + // Ichthyo-intern: ticket #95 + + pImpl_.swap (tmp); + } + + + void + SessManagerImpl::load () + { + UNIMPLEMENTED ("load serialized session"); + } + + + /** \par Implementation details + * We intend to have several switchable object serialisers. + * One of these serializers should genarate a comprehensible + * text based representation suitable for checking into + * SCM systems. + * Sessions can be saved into one single file or be splitted + * to several files (master file and edl files) + */ + void + SessManagerImpl::save () + { + UNIMPLEMENTED ("save session (serialized)"); + } + + + + } // namespace mobject::session + +} // namespace mobject diff --git a/tests/51asset.tests b/tests/51asset.tests index f13edb706..e105623eb 100644 --- a/tests/51asset.tests +++ b/tests/51asset.tests @@ -11,12 +11,12 @@ return: 0 END -TEST "CreateAsset_test" CreateAsset_test <createClip(); - PM cm = cc->getMedia(); + PM cm = static_pointer_cast (cc->getMedia()); //TODO: solve the reference/interface Problem on MObject, push down to Clip... ASSERT (cm); - ASSERT (0 < cc->length); + ASSERT (0 < cc->getLength()); ASSERT (cm->ident.category.hasKind (VIDEO)); ASSERT (cm->getFilename() == mm->getFilename()); ASSERT (cm->howtoProc() == mm->howtoProc()); @@ -79,7 +80,7 @@ namespace asset return (0 < clip->getParents().size()) && (media == clip->getParents()[0]) - && (contains (media->getDependant(), clip)); +// && (contains (media->getDependant(), clip)); //TODO implement Asset dependecies ; } diff --git a/tests/components/proc/engine/sourcenodetest.cpp b/tests/components/proc/engine/sourcenodetest.cpp index e7fab2279..9bbe30f30 100644 --- a/tests/components/proc/engine/sourcenodetest.cpp +++ b/tests/components/proc/engine/sourcenodetest.cpp @@ -48,6 +48,7 @@ namespace engine { virtual void run(Arg arg) { + UNIMPLEMENTED ("render node pulling source data from backend"); } }; diff --git a/tests/components/proc/mobject/controller/rendersegmenttest.cpp b/tests/components/proc/mobject/controller/rendersegmenttest.cpp index 5ef4064f1..c0ca3259d 100644 --- a/tests/components/proc/mobject/controller/rendersegmenttest.cpp +++ b/tests/components/proc/mobject/controller/rendersegmenttest.cpp @@ -57,6 +57,7 @@ namespace mobject { virtual void run(Arg arg) { + UNIMPLEMENTED ("complete render process for a given test segment of the EDL"); } }; diff --git a/tests/components/proc/mobject/session/addcliptest.cpp b/tests/components/proc/mobject/session/addcliptest.cpp index 6d2d0c7f0..a88b36db9 100644 --- a/tests/components/proc/mobject/session/addcliptest.cpp +++ b/tests/components/proc/mobject/session/addcliptest.cpp @@ -22,7 +22,8 @@ #include "common/test/run.hpp" -#include "proc/mobject/session/session.hpp" +#include "proc/mobject/session.hpp" +#include "proc/mobject/session/edl.hpp" #include "proc/mobject/session/testclip.hpp" #include "proc/mobject/placement.hpp" #include "common/util.hpp" @@ -56,12 +57,12 @@ namespace mobject { virtual void run(Arg arg) { - Session& sess = Session::getCurrent(); + PSess sess = Session::current; PMO clip = TestClip::create(); PPla pla = Placement::create(Placement::FIXED, Time(1), clip); - sess.add (pla); + sess->add (pla); - ASSERT (contains (sess.getEDL(), pla)); + ASSERT (sess->currEDL().contains (pla)); // TODO: Clip-Asset and Placement magic?? } }; diff --git a/tests/components/proc/mobject/session/deletecliptest.cpp b/tests/components/proc/mobject/session/deletecliptest.cpp index 167ef2577..0275992b0 100644 --- a/tests/components/proc/mobject/session/deletecliptest.cpp +++ b/tests/components/proc/mobject/session/deletecliptest.cpp @@ -23,7 +23,8 @@ #include "common/test/run.hpp" #include "proc/assetmanager.hpp" -#include "proc/mobject/session/session.hpp" +#include "proc/mobject/session.hpp" +#include "proc/mobject/session/edl.hpp" // TODO: really neded? #include "proc/mobject/session/testsession1.hpp" //#include "common/util.hpp" @@ -34,6 +35,9 @@ using std::string; using std::cout; +using proc_interface::AssetManager; +using proc_interface::PAsset; +using proc_interface::IDA; namespace mobject { @@ -55,19 +59,19 @@ namespace mobject virtual void run(Arg arg) { buildTestseesion1(); - Session& sess = Session::getCurrent(); + PSess sess = Session::current; AssetManager& aMang = AssetManager::instance(); - PPla clipPlacement = sess.getEDL().find(SESSION1_CLIP); // global Var asigned in buildTestsession1() - PAsset clipAsset = aMang.getAsset(clipPlacement->subject->getMedia()); + PPla clipPlacement = sess->currEDL().find(SESSION1_CLIP); // global Var asigned in buildTestsession1() + PAsset clipAsset = clipPlacement->subject->getMedia(); IDA clipAID = clipAsset->getID(); ASSERT (clipPlacement); - sess.remove (clipPlacement); + sess->remove (clipPlacement); - ASSERT (!sess.getEDL().find(SESSION1_CLIP)); // EDL forgot the Clip/Placement - ASSERT (!aMang.known (clipAID)); // corresponding Clip Asset has disappeared - ASSERT (!aMang.getAsset(clipPlacement->subject->getMedia())); // internal cross-links removed + ASSERT (!sess->currEDL().find(SESSION1_CLIP)); // EDL forgot the Clip/Placement + ASSERT (!aMang.known (clipAID)); // corresponding Clip Asset has disappeared + ASSERT (!clipPlacement->subject->getMedia()); // internal cross-links removed } }; diff --git a/tests/components/proc/mobject/session/rebuildfixturetest.cpp b/tests/components/proc/mobject/session/rebuildfixturetest.cpp index 7af4be5e7..62c77fe11 100644 --- a/tests/components/proc/mobject/session/rebuildfixturetest.cpp +++ b/tests/components/proc/mobject/session/rebuildfixturetest.cpp @@ -22,7 +22,8 @@ #include "common/test/run.hpp" -#include "proc/mobject/session/session.hpp" +#include "proc/mobject/session.hpp" +#include "proc/mobject/session/edl.hpp" #include "proc/mobject/session/testsession1.hpp" #include "common/util.hpp" @@ -58,16 +59,18 @@ namespace mobject { virtual void run(Arg arg) { - clearSession(); + PSess sess = Session::current; + sess.clear(); buildTestseesion1(); - Session& sess = Session::getCurrent(); - ASSERT (sess.isValid()); - sess.rebuildFixture(); + ASSERT (sess->isValid()); + sess->rebuildFixture(); TODO ("check the fixture has been touched. e.g. by hash."); TODO ("query all Placements of all Clips (via AssetManager). Verify explicit plac contained in Fixture."); - - for_each (sess.getFixture(), - bind (&check_is_from_EDL, _1, sess.getEDL())); + + UNIMPLEMENTED ("iterate over fixture"); +// TODO +// for_each (sess->getFixture(), +// bind (&check_is_from_EDL, _1, sess.getEDL())); TODO ("can we check the other direction, from EDL to Fixture??"); } @@ -75,8 +78,8 @@ namespace mobject static void check_is_from_EDL (PPla explicitPlacement, EDL& edl) { - PPla originalPlacement = explicitPlacement->subject->placement; - ASSERT (contains(edl, originalPlacement)); + PPla originalPlacement = explicitPlacement->subject->getPlacement(); + ASSERT (edl.contains(originalPlacement)); } }; diff --git a/tests/components/proc/mobject/session/sessionmanagertest.cpp b/tests/components/proc/mobject/session/sessionmanagertest.cpp index f6f8169e4..db42c9703 100644 --- a/tests/components/proc/mobject/session/sessionmanagertest.cpp +++ b/tests/components/proc/mobject/session/sessionmanagertest.cpp @@ -22,7 +22,7 @@ #include "common/test/run.hpp" -#include "proc/mobject/session/session.hpp" +#include "proc/mobject/session.hpp" #include "proc/mobject/session/testsession1.hpp" //#include "common/util.hpp" //#include @@ -68,8 +68,8 @@ namespace mobject */ void getCurrentSession () { - Session& sess = Session::getCurrent(); - ASSERT (sess.isValid()); + PSess sess = Session::current; + ASSERT (sess->isValid()); } /** @test clear current session contents @@ -80,6 +80,7 @@ namespace mobject void clearSession () { UNIMPLEMENTED ("clear objects in current session"); + Session::current.clear(); } /** @test reset global session config and start with @@ -89,6 +90,7 @@ namespace mobject void resetSession () { UNIMPLEMENTED ("construct a pristine session"); + Session::current.reset(); } /** @test use a mock session serializer to load diff --git a/tests/components/proc/mobject/session/sessionstructuretest.cpp b/tests/components/proc/mobject/session/sessionstructuretest.cpp index 18ee496e0..d2bbe5477 100644 --- a/tests/components/proc/mobject/session/sessionstructuretest.cpp +++ b/tests/components/proc/mobject/session/sessionstructuretest.cpp @@ -22,7 +22,9 @@ #include "common/test/run.hpp" -#include "proc/mobject/session/session.hpp" +#include "proc/mobject/session.hpp" +#include "proc/mobject/session/edl.hpp" // TODO only temporarily needed +#include "proc/mobject/session/fixture.hpp" // TODO only temporarily needed #include "proc/assetmanager.hpp" //#include "common/util.hpp" //#include @@ -55,12 +57,12 @@ namespace mobject { virtual void run(Arg arg) { - Session& sess = Session::getCurrent(); - ASSERT (0 <= sess.getEDL().size()); // TODO implement - ASSERT (0 <= sess.getFixture().size()); // TODO implement - ASSERT (0 < sess.getTracks().size()); // TODO implement + PSess sess = Session::current; + ASSERT (0 <= sess->currEDL().size()); // TODO implement + ASSERT (0 <= sess->getFixture()->size()); // TODO implement + ASSERT (0 < sess->currEDL().getTracks().size()); // TODO implement - PAsset track = sess.getTracks()[0]; + PAsset track = sess->currEDL().getTracks()[0]; AssetManager& aMang = AssetManager::instance(); ASSERT (track == aMang.getAsset (track->getID())); } diff --git a/tests/components/proc/mobject/session/testclip.cpp b/tests/components/proc/mobject/session/testclip.cpp index fb33be2ec..0fefffad8 100644 --- a/tests/components/proc/mobject/session/testclip.cpp +++ b/tests/components/proc/mobject/session/testclip.cpp @@ -22,6 +22,8 @@ #include "proc/mobject/session/testclip.hpp" +#include "backend/mediaaccessfacade.hpp" +#include "backend/mediaaccessmock.hpp" #include "proc/asset/media.hpp" #include "proc/asset/clip.hpp" @@ -33,7 +35,9 @@ namespace mobject { typedef shared_ptr PC; typedef shared_ptr PM; - typedef MediaAccessFacade MAF; + typedef backend_interface::MediaAccessFacade MAF; + using backend_interface::test::MediaAccessMock; + using asset::VIDEO; /** @todo find a way to link to an existing clip object. diff --git a/tests/components/proc/mobject/session/testclip.hpp b/tests/components/proc/mobject/session/testclip.hpp index 3128a623d..39ed7df17 100644 --- a/tests/components/proc/mobject/session/testclip.hpp +++ b/tests/components/proc/mobject/session/testclip.hpp @@ -27,8 +27,11 @@ #include "common/test/run.hpp" #include "common/factory.hpp" + +#include "proc/mobject/session/clip.hpp" //#include "common/util.hpp" + //#include #include @@ -51,7 +54,7 @@ namespace mobject * Can be used as Mock object to record invoked operations. * */ - class TestClip ////TODO inherit from mobject::session::Clip + class TestClip : public mobject::session::Clip /////////////TODO how this???? { /** smart ptr factory allowed to invoke TestClip's ctor */ diff --git a/tests/components/proc/mobject/session/testsession1.hpp b/tests/components/proc/mobject/session/testsession1.hpp index 97a93719f..3e6ad3d25 100644 --- a/tests/components/proc/mobject/session/testsession1.hpp +++ b/tests/components/proc/mobject/session/testsession1.hpp @@ -25,7 +25,7 @@ #define MOBJECT_SESSION_TESTSESSION_H -#include "proc/mobject/session/session.hpp" +#include "proc/mobject/session.hpp" #include "common/error.hpp" //#include "common/factory.hpp" //#include "common/util.hpp" @@ -49,7 +49,8 @@ namespace mobject * in the UML design. All changes are done to the (global) * current session. */ - void buildTestseesion1 () + inline void + buildTestseesion1 () { UNIMPLEMENTED ("Test-Session 1"); }; @@ -59,13 +60,15 @@ namespace mobject * Analyze the current (gloal) Session to verify the * configuration of "Test-Session 1" */ - bool checkTestseesion1 () + inline bool + checkTestsession1 () { UNIMPLEMENTED ("Test-Session 1"); return false; }; - + + const string SESSION1_CLIP("TODO: some sensible way to refer to a clip"); } // namespace session