2007-09-02 18:48:22 +02:00
|
|
|
/*
|
|
|
|
|
META.hpp - key abstraction: metadata and organisational asset
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-03-10 04:25:03 +01:00
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2008, Hermann Vosseler <Ichthyostega@web.de>
|
2010-12-17 23:28:49 +01:00
|
|
|
|
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
|
2010-12-17 23:28:49 +01:00
|
|
|
published by the Free Software Foundation; either version 2 of
|
|
|
|
|
the License, or (at your option) any later version.
|
|
|
|
|
|
2007-09-02 18:48:22 +02:00
|
|
|
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.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2007-09-02 18:48:22 +02:00
|
|
|
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.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2007-09-02 18:48:22 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2017-04-02 04:22:51 +02:00
|
|
|
/** @file asset/meta.hpp
|
2010-12-31 05:59:53 +01:00
|
|
|
** Internal and organisational metadata. Some internally created data elements
|
|
|
|
|
** rather serve the purpose of controlling the way the application behaves, as
|
2017-04-02 04:22:51 +02:00
|
|
|
** opposed to organising the [structure](\ref struct.hpp) of the data the user
|
|
|
|
|
** works with. Lumiera exposes this self-referential control and customisation
|
2010-12-31 05:59:53 +01:00
|
|
|
** aspects as a special kind of Asset. Examples being types, scales and quantisation
|
|
|
|
|
** grids, decision rules, control data stores (automation data), annotations attached
|
2018-08-10 18:37:09 +02:00
|
|
|
** to labels, inventory entities etc.
|
2010-04-04 06:38:22 +02:00
|
|
|
**
|
2018-08-10 18:37:09 +02:00
|
|
|
** For the different _Kinds_ of Assets, we use sub-interfaces inheriting
|
2007-09-16 03:02:05 +02:00
|
|
|
** from the general Asset interface. To be able to get asset::Meta instances
|
2010-04-04 06:38:22 +02:00
|
|
|
** directly from the AssetManager, we define a specialisation of the Asset ID.
|
|
|
|
|
**
|
2021-01-23 16:45:04 +01:00
|
|
|
** # using meta assets
|
2018-08-10 18:37:09 +02:00
|
|
|
**
|
2010-12-31 05:59:53 +01:00
|
|
|
** The usage pattern of asset::Meta entities differs from the other assets,
|
|
|
|
|
** insofar they aren't created as individual entries, rather added as part
|
|
|
|
|
** of a larger scale configuration activity, or they are derived from category.
|
|
|
|
|
** The latter fits in with a prototype-like approach; initially, the individual
|
|
|
|
|
** entry just serves to keep track of a categorisation, while at some point,
|
|
|
|
|
** such a link into a describing category may evolve into a local
|
|
|
|
|
** differentiation of some settings (copy on modification).
|
|
|
|
|
**
|
|
|
|
|
** To cope with this special usage, the meta assets are defined to be immutable.
|
|
|
|
|
** They are created from a descriptor, which stands for a category or sub-category
|
|
|
|
|
** and can be another already existing asset::Meta (inheriting from meta::Descriptor)
|
|
|
|
|
** Generally this yields a Builder object, which can be used for outfitting the new
|
2018-08-10 18:37:09 +02:00
|
|
|
** or changed metadata entry, finally *committing* this builder to yield a new
|
2011-04-25 18:51:50 +02:00
|
|
|
** asset::Meta (which, in case of a mutation, might supersede an existing one).
|
2010-12-31 05:59:53 +01:00
|
|
|
**
|
2013-10-25 06:34:38 +02:00
|
|
|
** @ingroup asset
|
2010-04-04 06:38:22 +02:00
|
|
|
** @see asset.hpp explanation of assets in general
|
2007-09-16 03:02:05 +02:00
|
|
|
** @see MetaFactory creating concrete asset::Meta instances
|
|
|
|
|
**
|
|
|
|
|
*/
|
|
|
|
|
|
2007-09-02 18:48:22 +02:00
|
|
|
#ifndef ASSET_META_H
|
|
|
|
|
#define ASSET_META_H
|
|
|
|
|
|
2018-11-15 23:42:43 +01:00
|
|
|
#include "steam/asset.hpp"
|
|
|
|
|
#include "steam/asset/struct-scheme.hpp"
|
2015-07-02 19:24:44 +02:00
|
|
|
#include "lib/idi/entry-id.hpp"
|
2018-03-24 05:35:13 +01:00
|
|
|
#include "lib/nocopy.hpp"
|
2007-09-02 18:48:22 +02:00
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
namespace steam {
|
2010-04-04 06:38:22 +02:00
|
|
|
namespace asset {
|
2007-09-16 03:02:05 +02:00
|
|
|
|
|
|
|
|
class Meta;
|
|
|
|
|
class MetaFactory;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
class ID<Meta> : public ID<Asset>
|
|
|
|
|
{
|
|
|
|
|
public:
|
2010-11-27 05:11:02 +01:00
|
|
|
ID (HashVal id);
|
2007-09-16 03:02:05 +02:00
|
|
|
ID (const Meta&);
|
|
|
|
|
};
|
2010-04-04 06:38:22 +02:00
|
|
|
|
2010-12-30 04:30:33 +01:00
|
|
|
namespace meta {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Interface: the unspecific, reflective base of meta assets.
|
|
|
|
|
* Based on descriptors, meta assets form a self referential structure.
|
|
|
|
|
*/
|
|
|
|
|
class Descriptor
|
|
|
|
|
{
|
|
|
|
|
public:
|
2011-01-15 13:10:02 +01:00
|
|
|
virtual ~Descriptor(); ///< this is an Interface
|
2010-12-30 04:30:33 +01:00
|
|
|
};
|
2010-12-31 05:59:53 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Building and configuring a meta asset.
|
|
|
|
|
* The finished elements are defined to be immutable,
|
|
|
|
|
* thus, on creation or when changing / superseding a
|
|
|
|
|
* meta asset, the client gets a special builder instance,
|
|
|
|
|
* which is a value object for configuring the specific details
|
2018-08-10 18:37:09 +02:00
|
|
|
* to set. When done, the client invokes a `commit()` function,
|
2010-12-31 05:59:53 +01:00
|
|
|
* which yields a smart-ptr to the new meta asset.
|
2018-08-10 18:37:09 +02:00
|
|
|
* Individual meta asset subclasses are bound to define a
|
2010-12-31 05:59:53 +01:00
|
|
|
* specialisation of this Builder template, which will then be
|
|
|
|
|
* instantiated and provided by the MetaFactory.
|
|
|
|
|
*/
|
|
|
|
|
template<class MA>
|
|
|
|
|
struct Builder;
|
2010-12-30 04:30:33 +01:00
|
|
|
}
|
2010-04-04 06:38:22 +02:00
|
|
|
|
|
|
|
|
|
2007-09-02 18:48:22 +02:00
|
|
|
/**
|
2010-12-30 04:30:33 +01:00
|
|
|
* key abstraction: metadata, parametrisation, customisation and similar organisational traits.
|
2010-04-04 06:38:22 +02:00
|
|
|
* @todo just a stub, still have to figure out the distinctive properties of asset::Meta
|
2018-08-11 18:06:09 +02:00
|
|
|
* //////////////////////////////////TICKET #1156 : do we need the distinction between STRUCT and META?
|
2007-09-02 18:48:22 +02:00
|
|
|
*/
|
2010-12-30 04:30:33 +01:00
|
|
|
class Meta
|
|
|
|
|
: public Asset
|
|
|
|
|
, public meta::Descriptor
|
2007-09-02 18:48:22 +02:00
|
|
|
{
|
2007-09-16 03:02:05 +02:00
|
|
|
public:
|
|
|
|
|
static MetaFactory create;
|
|
|
|
|
|
2011-04-25 18:51:50 +02:00
|
|
|
/** @return ID of kind Meta */
|
2018-08-10 18:37:09 +02:00
|
|
|
virtual const ID<Meta>& getID() const
|
|
|
|
|
{
|
2011-01-15 13:10:02 +01:00
|
|
|
return static_cast<const ID<Meta>& > (Asset::getID());
|
2007-09-16 03:02:05 +02:00
|
|
|
}
|
2007-09-02 18:48:22 +02:00
|
|
|
|
2007-09-16 03:02:05 +02:00
|
|
|
protected:
|
2018-08-11 18:06:09 +02:00
|
|
|
Meta (Asset::Ident const& idi)
|
|
|
|
|
: Asset{idi}
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
template<typename TY>
|
|
|
|
|
Meta (lib::idi::EntryID<TY> const& nameID)
|
|
|
|
|
: Meta{idi::getAssetIdent (nameID, META)}
|
|
|
|
|
{ }
|
2010-12-30 04:30:33 +01:00
|
|
|
|
|
|
|
|
// friend class MetaFactory; ///////////////////////////////////TODO still necessary?
|
2007-09-02 18:48:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2007-09-16 03:02:05 +02:00
|
|
|
// definition of ID<Meta> ctors is possible now,
|
2010-12-30 04:30:33 +01:00
|
|
|
// after providing full definition of class Meta
|
2010-04-04 06:38:22 +02:00
|
|
|
|
2010-11-27 05:11:02 +01:00
|
|
|
inline ID<Meta>::ID(HashVal id) : ID<Asset> (id) {};
|
2007-09-16 03:02:05 +02:00
|
|
|
inline ID<Meta>::ID(const Meta& meta) : ID<Asset> (meta.getID()) {};
|
|
|
|
|
|
2015-07-02 19:16:46 +02:00
|
|
|
typedef lib::P<Meta> PMeta;
|
2007-09-16 03:02:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-08-10 18:37:09 +02:00
|
|
|
/**
|
2009-09-30 00:27:14 +02:00
|
|
|
* Factory specialised for creating Metadata Asset objects.
|
2018-08-10 18:37:09 +02:00
|
|
|
*/
|
2012-10-14 01:30:08 +02:00
|
|
|
class MetaFactory
|
2018-03-24 05:35:13 +01:00
|
|
|
: util::NonCopyable
|
2007-09-16 03:02:05 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2015-07-02 19:16:46 +02:00
|
|
|
typedef lib::P<asset::Meta> PType;
|
2010-12-30 04:30:33 +01:00
|
|
|
|
|
|
|
|
template<class MA>
|
2015-07-02 19:13:50 +02:00
|
|
|
meta::Builder<MA> operator() (lib::idi::EntryID<MA> elementIdentity);
|
2010-12-30 04:30:33 +01:00
|
|
|
|
|
|
|
|
template<class MA>
|
2015-07-02 19:13:50 +02:00
|
|
|
meta::Builder<MA> operator() (meta::Descriptor const& prototype, lib::idi::EntryID<MA> elementIdentity);
|
2010-04-04 06:38:22 +02:00
|
|
|
|
2007-09-16 03:02:05 +02:00
|
|
|
};
|
2010-04-04 06:38:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
}} // namespace steam::asset
|
2007-09-02 18:48:22 +02:00
|
|
|
#endif
|