some refacturing of the (preliminary) struct asset impl...
This commit is contained in:
parent
6346723069
commit
113678ff93
6 changed files with 55 additions and 41 deletions
2
doc/devel/.gitignore
vendored
Normal file
2
doc/devel/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
,doxylog
|
||||
html/*
|
||||
|
|
@ -32,46 +32,26 @@ using util::isnil;
|
|||
namespace asset
|
||||
{
|
||||
|
||||
namespace // ProcPattern implementation details
|
||||
{
|
||||
/** @internal derive a sensible asset ident tuple when creating
|
||||
* a processing pattern asset based on a query
|
||||
* @todo define the actual naming scheme of struct assets
|
||||
*/
|
||||
const Asset::Ident
|
||||
createPatternIdent (const string& properties)
|
||||
{
|
||||
string name ("pattern-" + properties); // TODO something sensible here; append number, sanitize etc.
|
||||
TODO ("Implement ProcPatt name scheme!!");
|
||||
Category category (STRUCT,"patterns");
|
||||
return Asset::Ident (name, category );
|
||||
}
|
||||
}
|
||||
|
||||
/** */
|
||||
ProcPatt::ProcPatt (const string& properties)
|
||||
: Struct (createPatternIdent (properties)),
|
||||
propDescriptor_ (properties)
|
||||
/** new processing pattern with empty instruction list.
|
||||
* @todo preliminary implementation, storing the capabilities
|
||||
* in the asset name field. We can do better, when
|
||||
* it's clear what capabilities we need
|
||||
*/
|
||||
ProcPatt::ProcPatt (const Asset::Ident& idi)
|
||||
: Struct (idi),
|
||||
instructions_()
|
||||
{ }
|
||||
|
||||
|
||||
/** @internal used for creating a clone copy */
|
||||
ProcPatt::ProcPatt (const Asset::Ident& idi, const InstructionSequence& instru)
|
||||
: Struct (idi),
|
||||
instructions_(instru)
|
||||
{
|
||||
TODO ("verify building instructions, maybe preprocess...");
|
||||
}
|
||||
|
||||
/** @internal used for creating a clone */
|
||||
ProcPatt::ProcPatt (const string& props, const InstructionSequence& instructs)
|
||||
: Struct (createPatternIdent (props)),
|
||||
propDescriptor_ (props),
|
||||
instructions_ (instructs)
|
||||
{ }
|
||||
|
||||
|
||||
/** query the currently defined properties of this
|
||||
processing pattern for a stream-ID predicate */
|
||||
const string&
|
||||
ProcPatt::queryStreamID() const
|
||||
{
|
||||
TODO ("really implement querying the properties");
|
||||
return propDescriptor_; /////////////////////////////TODO grober Unfug
|
||||
}
|
||||
|
||||
|
||||
/** create a new ProcPatt asset as a literal copy
|
||||
|
|
@ -84,7 +64,11 @@ namespace asset
|
|||
ProcPatt::newCopy (string newID) const
|
||||
{
|
||||
TODO ("implement the Pattern-ID within the propDescriptor!");
|
||||
ProcPatt* pP = new ProcPatt (this->propDescriptor_, this->instructions_);
|
||||
TODO ("implement a consitent struct asset naming scheme at one central location!!!!!");
|
||||
const Asset::Ident newIdi ( this->ident.name+".X"
|
||||
, this->ident.category
|
||||
);
|
||||
ProcPatt* pP = new ProcPatt (newIdi, this->instructions_);
|
||||
return AssetManager::instance().wrap (*pP);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,17 +52,15 @@ namespace asset
|
|||
*/
|
||||
class ProcPatt : public Struct
|
||||
{
|
||||
string propDescriptor_;
|
||||
InstructionSequence instructions_;
|
||||
|
||||
ProcPatt (const string& props, const InstructionSequence& instructs);
|
||||
ProcPatt (const Asset::Ident&, const InstructionSequence&);
|
||||
|
||||
protected:
|
||||
explicit ProcPatt (const string& propDescriptor);
|
||||
explicit ProcPatt (const Asset::Ident& idi);
|
||||
friend class StructFactoryImpl;
|
||||
|
||||
public:
|
||||
const string& queryStreamID() const;
|
||||
shared_ptr<ProcPatt> newCopy (string newID) const;
|
||||
|
||||
ProcPatt& attach (Symbol where, PProc& node);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,12 @@
|
|||
#include "common/util.hpp"
|
||||
#include "nobugcfg.h"
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
using boost::regex;
|
||||
using boost::smatch;
|
||||
using boost::regex_search;
|
||||
|
||||
using mobject::Session;
|
||||
using cinelerra::query::normalizeID;
|
||||
|
||||
|
|
@ -47,6 +53,25 @@ namespace asset
|
|||
|
||||
/****** NOTE: not really implemented yet. What follows is partially a hack to build simple tests *******/
|
||||
|
||||
namespace // Implementation details
|
||||
{
|
||||
regex streamID_pattern("stream\\(\\s*(\\w+)\\s*\\)");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** query the currently defined properties of this
|
||||
structural asset for a stream-ID predicate */
|
||||
const string
|
||||
Struct::queryStreamID() const
|
||||
{
|
||||
smatch match;
|
||||
|
||||
if (regex_search (this->ident.name, match, streamID_pattern))
|
||||
return string (match[1]);
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@ namespace asset
|
|||
return static_cast<const ID<Struct>& > (Asset::getID());
|
||||
}
|
||||
|
||||
const string queryStreamID() const;
|
||||
|
||||
|
||||
protected:
|
||||
Struct (const Asset::Ident& idi) : Asset(idi) {}
|
||||
friend class StructFactory;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,9 @@ namespace asset
|
|||
const Asset::Ident
|
||||
createIdent (const Query<STRU>& query)
|
||||
{
|
||||
string name (Traits<STRU>::namePrefix + query); // TODO something sensible here; append number, sanitize etc.
|
||||
static int i=0;
|
||||
static format namePattern ("%s%d-%s"); // TODO finally just use the capability string as name??
|
||||
string name = str(namePattern % Traits<STRU>::namePrefix % (++i) % query);
|
||||
TODO ("struct asset naming scheme??");
|
||||
Category cat (STRUCT, Traits<STRU>::catFolder);
|
||||
return Asset::Ident (name, cat );
|
||||
|
|
|
|||
Loading…
Reference in a new issue