2007-09-02 18:48:22 +02:00
|
|
|
/*
|
|
|
|
|
STRUCT.hpp - key abstraction: structural asset
|
|
|
|
|
|
2008-03-10 04:25:03 +01:00
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2008, Hermann Vosseler <Ichthyostega@web.de>
|
2007-09-02 18:48:22 +02:00
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2007-09-16 03:02:05 +02:00
|
|
|
/** @file struct.hpp
|
2010-02-22 03:52:52 +01:00
|
|
|
** Structural parts of the Session (e.g. Tracks) can be reflected
|
|
|
|
|
** into the "bookkeeping view" as a specific Kind of Asset.
|
2010-03-06 04:30:12 +01:00
|
|
|
** For the different \em kinds of Assets, we use sub-interfaces inheriting
|
|
|
|
|
** from the general Asset interface, each of which expose a distinguishing feature.
|
|
|
|
|
** In the case of structural assets, the key point is a naming scheme allowing for
|
|
|
|
|
** retrieval of instances with specific capabilities; structural assets are created
|
|
|
|
|
** on demand, just by referral. Thus, the collection of these assets provides a map
|
|
|
|
|
** for exploring the current session's structure and allow for tweaking of the
|
|
|
|
|
** default behaviour.
|
|
|
|
|
** - Track acts as unique track ID
|
|
|
|
|
** - Timeline and Sequence are facades, part of the session API
|
|
|
|
|
** - Pipe is an attachment point for wiring connections and defines a StreamType
|
|
|
|
|
** - ProcPatt is used as a blueprint in the build process, a standard connection pattern
|
|
|
|
|
**
|
|
|
|
|
** \par access and creation
|
|
|
|
|
** asset::Struct instances are created on demand; the interface is to invoke the
|
|
|
|
|
** StructFactory with a (typed) Query describing properties or capabilities.
|
|
|
|
|
** In case this query succeeds, an existing asset will be returned, otherwise
|
|
|
|
|
** a suitable new instance is created automatically. Typically, structural assets
|
|
|
|
|
** aren't deleted. Doing so would require a dedicated function which not only drops
|
|
|
|
|
** an asset instance from AssetManager, but also ensures removal of all properties
|
|
|
|
|
** within the model which could cause automatic re-creation of this asset. E.g.
|
|
|
|
|
** purging a track asset (=unique trackID) requires removing or disconnecting
|
|
|
|
|
** all placements referring to this track, which could be sub tracks, clips,
|
|
|
|
|
** effects, automation or labels.
|
|
|
|
|
**
|
|
|
|
|
** @see asset.hpp for explanation regarding asset IDs
|
2007-09-16 03:02:05 +02:00
|
|
|
** @see StructFactory creating concrete asset::Struct instances
|
|
|
|
|
**
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2007-09-02 18:48:22 +02:00
|
|
|
#ifndef ASSET_STRUCT_H
|
|
|
|
|
#define ASSET_STRUCT_H
|
|
|
|
|
|
2008-04-12 04:55:18 +02:00
|
|
|
#include "pre_a.hpp"
|
|
|
|
|
|
2007-09-02 18:48:22 +02:00
|
|
|
#include "proc/asset.hpp"
|
2008-12-17 17:53:32 +01:00
|
|
|
#include "lib/query.hpp"
|
|
|
|
|
#include "lib/factory.hpp"
|
|
|
|
|
#include "lib/singleton.hpp"
|
2007-09-02 18:48:22 +02:00
|
|
|
|
2008-02-10 17:23:16 +01:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
|
#include <string>
|
2008-01-07 18:16:03 +01:00
|
|
|
|
2007-09-02 18:48:22 +02:00
|
|
|
|
|
|
|
|
|
2009-01-05 16:17:17 +01:00
|
|
|
namespace asset {
|
|
|
|
|
|
2008-03-31 03:21:28 +02:00
|
|
|
using std::string;
|
|
|
|
|
using std::wstring;
|
|
|
|
|
using boost::scoped_ptr;
|
2008-03-10 08:38:59 +01:00
|
|
|
using lumiera::Query;
|
2007-09-16 03:02:05 +02:00
|
|
|
|
|
|
|
|
class Struct;
|
|
|
|
|
class StructFactory;
|
2008-02-10 17:23:16 +01:00
|
|
|
class StructFactoryImpl;
|
2008-02-14 04:12:30 +01:00
|
|
|
class Pipe;
|
2007-09-16 03:02:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
class ID<Struct> : public ID<Asset>
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ID (size_t id);
|
|
|
|
|
ID (const Struct&);
|
|
|
|
|
};
|
2007-09-02 18:48:22 +02:00
|
|
|
|
2007-09-16 03:02:05 +02:00
|
|
|
|
|
|
|
|
|
2007-09-02 18:48:22 +02:00
|
|
|
/**
|
|
|
|
|
* key abstraction: structural asset
|
2010-03-06 04:30:12 +01:00
|
|
|
* Created automatically as a sideeffect of building the structure
|
|
|
|
|
* of the high-level-model (session contents), thus providing IDs
|
|
|
|
|
* for later referral, search and attachment of metadata.
|
|
|
|
|
*
|
|
|
|
|
* Examples being tracks, sequences, timelines, pipes, processing patterns
|
|
|
|
|
*
|
2010-02-28 07:17:12 +01:00
|
|
|
* @todo WIP as of 1/2010. Need to integrate Sequences and Timelines
|
2007-09-02 18:48:22 +02:00
|
|
|
*/
|
|
|
|
|
class Struct : public Asset
|
|
|
|
|
{
|
2007-09-16 03:02:05 +02:00
|
|
|
public:
|
|
|
|
|
static StructFactory create;
|
2007-09-02 18:48:22 +02:00
|
|
|
|
2010-02-28 07:17:12 +01:00
|
|
|
virtual const ID<Struct>&
|
|
|
|
|
getID() const ///< @return ID of kind asset::Struct
|
2007-09-16 03:02:05 +02:00
|
|
|
{
|
|
|
|
|
return static_cast<const ID<Struct>& > (Asset::getID());
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-15 02:56:25 +01:00
|
|
|
const string queryStreamID() const;
|
2008-02-18 04:16:53 +01:00
|
|
|
const string queryPipeID() const;
|
2008-02-15 02:56:25 +01:00
|
|
|
|
|
|
|
|
|
2007-09-16 03:02:05 +02:00
|
|
|
protected:
|
2008-01-12 18:19:37 +01:00
|
|
|
Struct (const Asset::Ident& idi) : Asset(idi) {}
|
2007-09-16 03:02:05 +02:00
|
|
|
friend class StructFactory;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// definition of ID<Struct> ctors is possible now,
|
2010-02-28 07:17:12 +01:00
|
|
|
// after providing full definition of class Struct
|
2007-09-16 03:02:05 +02:00
|
|
|
|
|
|
|
|
inline ID<Struct>::ID(size_t id) : ID<Asset> (id) {};
|
|
|
|
|
inline ID<Struct>::ID(const Struct& stru) : ID<Asset> (stru.getID()) {};
|
|
|
|
|
|
|
|
|
|
|
2008-01-14 01:01:11 +01:00
|
|
|
|
|
|
|
|
|
2007-09-16 03:02:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-01-05 16:17:17 +01:00
|
|
|
* Factory specialised for creating Structural Asset objects.
|
2007-09-16 03:02:05 +02:00
|
|
|
*/
|
2009-09-30 00:27:14 +02:00
|
|
|
class StructFactory : public lib::Factory<asset::Struct>
|
2007-09-16 03:02:05 +02:00
|
|
|
{
|
2008-02-10 17:23:16 +01:00
|
|
|
scoped_ptr<StructFactoryImpl> impl_;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
StructFactory ();
|
|
|
|
|
friend class Struct;
|
|
|
|
|
|
|
|
|
|
|
2007-09-16 03:02:05 +02:00
|
|
|
public:
|
2008-05-19 08:46:19 +02:00
|
|
|
typedef P<asset::Struct> PType;
|
2008-01-07 18:16:03 +01:00
|
|
|
|
|
|
|
|
template<class STRU>
|
2010-02-28 07:17:12 +01:00
|
|
|
P<STRU> operator() (const Query<STRU>& query); ////////////TODO for now we're just using a fake config query with preconfigured hardwired answers
|
2008-01-14 01:01:11 +01:00
|
|
|
|
2008-05-19 08:46:19 +02:00
|
|
|
P<Pipe> operator() (string pipeID, string streamID);
|
2010-03-21 05:25:52 +01:00
|
|
|
P<Timeline> operator() (MORef<Binding>); ///////////TODO doesn't this create circular includes?? Any better idea how to refer to an existing binding?
|
2008-02-10 17:23:16 +01:00
|
|
|
|
2007-09-02 18:48:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace asset
|
|
|
|
|
#endif
|