WIP start implementing the DefaultsManager by the (Mock)ConfigRules.
pass compiler, but loooots of undefined linker refs....
This commit is contained in:
parent
000538f6ef
commit
1614769664
7 changed files with 61 additions and 26 deletions
|
|
@ -34,7 +34,8 @@ namespace cinelerra
|
|||
namespace query
|
||||
{
|
||||
|
||||
|
||||
CINELERRA_ERROR_DEFINE (CAPABILITY_QUERY, "unresolvable capability query");
|
||||
|
||||
|
||||
} // namespace query
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
** they want to provide, together with functors carrying out the neccessary configuration steps.
|
||||
** All details and consequences of this approach still have to be worked out...
|
||||
**
|
||||
** @note this is rather a scrapbook and in flux... don't take this code too literal!
|
||||
**
|
||||
** @see cinelerra::Query
|
||||
** @see mobject::session::DefsManager
|
||||
** @see asset::StructFactory
|
||||
|
|
@ -49,17 +51,21 @@
|
|||
#include "common/typelist.hpp"
|
||||
|
||||
#include "proc/mobject/session/track.hpp"
|
||||
#include "proc/asset/procpatt.hpp"
|
||||
#include "proc/asset/port.hpp"
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <tr1/memory>
|
||||
|
||||
|
||||
|
||||
namespace cinelerra
|
||||
{
|
||||
using std::string;
|
||||
namespace query { class MockConfigRules; }
|
||||
using std::tr1::shared_ptr;
|
||||
|
||||
namespace query { class MockConfigRules; } // TODO: need a better way to return a sub-type from a singleton
|
||||
|
||||
|
||||
|
||||
|
|
@ -114,7 +120,7 @@ namespace cinelerra
|
|||
protected:
|
||||
virtual ~QueryHandler();
|
||||
public:
|
||||
virtual TY resolve (Query<TY> q);
|
||||
virtual shared_ptr<TY> resolve (Query<TY> q);
|
||||
};
|
||||
|
||||
// TODO: the Idea is to provide specialisations for the concrete types
|
||||
|
|
@ -179,6 +185,8 @@ namespace cinelerra
|
|||
cinelerra::Singleton<IMPL> ConfigRules<TYPES,IMPL>::instance;
|
||||
|
||||
|
||||
|
||||
CINELERRA_ERROR_DECLARE (CAPABILITY_QUERY); ///< unresolvable capability query.
|
||||
|
||||
} // namespace query
|
||||
|
||||
|
|
@ -194,6 +202,7 @@ namespace cinelerra
|
|||
*/
|
||||
typedef cinelerra::typelist::Types < mobject::session::Track
|
||||
, asset::Port
|
||||
, const asset::ProcPatt
|
||||
>
|
||||
InterfaceTypes;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,11 @@ namespace cinelerra
|
|||
namespace query
|
||||
{
|
||||
|
||||
MockConfigRules::MockConfigRules ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace query
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ namespace cinelerra
|
|||
{
|
||||
using mobject::session::Track;
|
||||
using asset::Port;
|
||||
using asset::ProcPatt;
|
||||
using asset::PProcPatt;
|
||||
|
||||
/**
|
||||
* Dummy Implementation of the query interface.
|
||||
|
|
@ -67,8 +69,9 @@ namespace cinelerra
|
|||
|
||||
public:
|
||||
|
||||
virtual Track resolve (Query<Track> q);
|
||||
virtual Port resolve (Query<Port> q);
|
||||
virtual shared_ptr<Track> resolve (Query<Track> q);
|
||||
virtual shared_ptr<Port> resolve (Query<Port> q);
|
||||
virtual PProcPatt resolve (Query<const ProcPatt> q);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ namespace asset
|
|||
{
|
||||
normalizeID (portID);
|
||||
normalizeID (streamID);
|
||||
PProcPatt processingPattern = Session::current->defaults (Query<ProcPatt>("stream("+streamID+")"));
|
||||
PProcPatt processingPattern = Session::current->defaults (Query<const ProcPatt>("stream("+streamID+")"));
|
||||
Port* pP = new Port (processingPattern, portID);
|
||||
return AssetManager::instance().wrap (*pP);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,21 @@
|
|||
#include "proc/mobject/session/defsmanager.hpp"
|
||||
#include "proc/asset/procpatt.hpp"
|
||||
#include "proc/asset/port.hpp"
|
||||
#include "common/configrules.hpp"
|
||||
#include "common/query/mockconfigrules.hpp" // TODO: better way to handle the includes (rework singleton template?)
|
||||
#include "common/error.hpp"
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
using boost::format;
|
||||
|
||||
using asset::Query;
|
||||
using asset::Port;
|
||||
using asset::ProcPatt;
|
||||
using asset::PProcPatt;
|
||||
|
||||
using cinelerra::ConfigRules;
|
||||
using cinelerra::query::CINELERRA_ERROR_CAPABILITY_QUERY;
|
||||
|
||||
namespace mobject
|
||||
{
|
||||
|
|
@ -40,27 +51,31 @@ namespace mobject
|
|||
|
||||
}
|
||||
|
||||
|
||||
/** create or retrieve a default-configured port asset.
|
||||
*/
|
||||
template<>
|
||||
shared_ptr<Port>
|
||||
DefsManager::operator() (const Query<Port>& capabilities)
|
||||
|
||||
template<class TAR>
|
||||
shared_ptr<TAR>
|
||||
DefsManager::operator() (const Query<TAR>& capabilities)
|
||||
{
|
||||
UNIMPLEMENTED ("query for default port with capabilities");
|
||||
shared_ptr<TAR> res = cinelerra::ConfigRules::instance().resolve (capabilities);
|
||||
|
||||
if (!res)
|
||||
throw cinelerra::error::Config ( str(format("The following Query could not be resolved: %s.")
|
||||
% capabilities)
|
||||
, CINELERRA_ERROR_CAPABILITY_QUERY );
|
||||
else
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
/* explicit template instantiations for querying various Types */
|
||||
/***************************************************************/
|
||||
|
||||
/** create or retrieve a default-configured processing pattern.
|
||||
*/
|
||||
template<>
|
||||
shared_ptr<ProcPatt>
|
||||
DefsManager::operator() (const Query<ProcPatt>& capabilities)
|
||||
{
|
||||
UNIMPLEMENTED ("query for default processing pattern with capabilities");
|
||||
}
|
||||
|
||||
template shared_ptr<Port> DefsManager::operator ()(const Query<Port>&);
|
||||
template PProcPatt DefsManager::operator ()(const Query<const ProcPatt>&);
|
||||
|
||||
} // namespace mobject::session
|
||||
|
||||
} // namespace mobject
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@
|
|||
|
||||
#include "common/query.hpp"
|
||||
|
||||
//#include <boost/scoped_ptr.hpp>
|
||||
//#include <vector>
|
||||
|
||||
//using std::vector;
|
||||
#include <tr1/memory>
|
||||
|
||||
|
||||
|
|
@ -63,6 +59,12 @@ namespace mobject
|
|||
template<class TAR>
|
||||
shared_ptr<TAR> operator() (const cinelerra::Query<TAR>&);
|
||||
|
||||
// template
|
||||
// < class TAR, ///< the target to query for
|
||||
// template <class> class SMP ///< smart pointer class to wrap the result
|
||||
// >
|
||||
// SMP<TAR> operator() (const cinelerra::Query<TAR>&);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue