reverse dependency order of Asset::Ident and EntryID
This commit is contained in:
parent
dccc41f156
commit
7285c6f4d5
6 changed files with 40 additions and 34 deletions
|
|
@ -43,8 +43,7 @@
|
|||
#define ASSET_ENTRY_ID_H
|
||||
|
||||
|
||||
#include "proc/asset.hpp"
|
||||
#include "proc/asset/struct-scheme.hpp"
|
||||
#include "lib/error.hpp"
|
||||
#include "lib/hash-indexed.hpp"
|
||||
#include "lib/idi/genfunc.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
|
@ -58,11 +57,14 @@
|
|||
namespace proc {
|
||||
namespace asset {
|
||||
|
||||
namespace error = lumiera::error;
|
||||
|
||||
using std::string;
|
||||
using std::ostream;
|
||||
|
||||
using lib::idi::generateSymbolicID;
|
||||
using lib::idi::getTypeHash;
|
||||
using lib::idi::typeSymbol;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -219,21 +221,6 @@ namespace asset {
|
|||
{ }
|
||||
|
||||
|
||||
/** generate an Asset identification tuple
|
||||
* based on this EntryID's symbolic ID and type information.
|
||||
* The remaining fields are filled in with hardwired defaults.
|
||||
* @note there is a twist, as this asset identity tuple generates
|
||||
* a different hash as the EntryID. It would be desirable
|
||||
* to make those two addressing systems interchangeable. /////////////TICKET #739
|
||||
*/
|
||||
Asset::Ident
|
||||
getIdent() const
|
||||
{
|
||||
Category cat (STRUCT, idi::StructTraits<TY>::catFolder());
|
||||
return Asset::Ident (this->getSym(), cat);
|
||||
}
|
||||
|
||||
|
||||
/** @return true if the upcast would yield exactly the same
|
||||
* tuple (symbol,type) as was used on original definition
|
||||
* of an ID, based on the given BareEntryID. Implemented
|
||||
|
|
@ -258,7 +245,7 @@ namespace asset {
|
|||
|
||||
operator string () const
|
||||
{
|
||||
return "ID<"+idi::StructTraits<TY>::idSymbol()+">-"+EntryID::getSym();
|
||||
return "ID<"+typeSymbol<TY>()+">-"+EntryID::getSym();
|
||||
}
|
||||
|
||||
friend ostream& operator<< (ostream& os, EntryID const& id) { return os << string(id); }
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
|
||||
#include "proc/asset/meta/time-grid.hpp"
|
||||
#include "proc/asset/struct-scheme.hpp"
|
||||
#include "proc/asset/entry-id.hpp"
|
||||
#include "proc/assetmanager.hpp"
|
||||
#include "lib/time/quantiser.hpp"
|
||||
|
|
@ -36,7 +37,6 @@
|
|||
using util::_Fmt;
|
||||
using util::cStr;
|
||||
using util::isnil;
|
||||
using boost::str;
|
||||
using std::string;
|
||||
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ namespace meta {
|
|||
|
||||
/** */
|
||||
TimeGrid::TimeGrid (EntryID<TimeGrid> const& nameID)
|
||||
: Meta (nameID.getIdent())
|
||||
: Meta (idi::getAssetIdent (nameID))
|
||||
{ }
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@
|
|||
|
||||
|
||||
#include "lib/symbol.hpp"
|
||||
#include "proc/asset.hpp"
|
||||
#include "proc/asset/entry-id.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
|
@ -45,11 +47,9 @@
|
|||
using boost::format;
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
class StreamType;
|
||||
}
|
||||
|
||||
namespace proc {
|
||||
class StreamType;
|
||||
|
||||
namespace mobject {
|
||||
namespace session {
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ namespace asset{
|
|||
static Symbol catFolder() { return "pipes";}
|
||||
static Symbol idSymbol() { return "pipe"; }
|
||||
};
|
||||
template<> struct StructTraits<lumiera::StreamType>
|
||||
template<> struct StructTraits<proc::StreamType>
|
||||
{
|
||||
static Symbol namePrefix() { return "type"; }
|
||||
static Symbol catFolder() { return "stream-types";}
|
||||
|
|
@ -147,7 +147,21 @@ namespace asset{
|
|||
|
||||
|
||||
|
||||
|
||||
/** generate an Asset identification tuple
|
||||
* based on this EntryID's symbolic ID and type information.
|
||||
* The remaining fields are filled in with hardwired defaults.
|
||||
* @note there is a twist, as this asset identity tuple generates
|
||||
* a different hash as the EntryID. It would be desirable
|
||||
* to make those two addressing systems interchangeable. /////////////TICKET #739
|
||||
*/
|
||||
template<typename TY>
|
||||
inline Asset::Ident
|
||||
getAssetIdent (EntryID<TY> const& entryID)
|
||||
{
|
||||
Category cat (STRUCT, idi::StructTraits<TY>::catFolder());
|
||||
return Asset::Ident (entryID.getSym(), cat);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}}} // namespace asset::idi
|
||||
|
|
|
|||
|
|
@ -83,8 +83,6 @@ namespace session {
|
|||
DEFINE_PROCESSABLE_BY (builder::BuilderTool);
|
||||
|
||||
};
|
||||
|
||||
typedef Placement<Clip> PClipMO;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -191,4 +191,10 @@ namespace proc {
|
|||
|
||||
|
||||
} // namespace proc
|
||||
#endif
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
using proc::StreamType;
|
||||
}
|
||||
|
||||
#endif /*PROC_STREAMTYPE_H*/
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "lib/test/test-helper.hpp"
|
||||
|
||||
#include "proc/asset/entry-id.hpp"
|
||||
#include "proc/asset/struct-scheme.hpp"
|
||||
#include "proc/mobject/session/clip.hpp"
|
||||
#include "proc/mobject/session/fork.hpp"
|
||||
#include "lib/meta/trait-special.hpp"
|
||||
|
|
@ -133,13 +134,13 @@ namespace test {
|
|||
checkBasicProperties ()
|
||||
{
|
||||
ForkID tID(" test ⚡ ☠ ☭ ⚡ track ");
|
||||
CHECK (tID.getIdent() == Asset::Ident("test_track", Category(STRUCT,"forks"), "lumi", 0));
|
||||
CHECK (idi::getAssetIdent(tID) == Asset::Ident("test_track", Category(STRUCT,"forks"), "lumi", 0));
|
||||
|
||||
CHECK (tID.getHash() == ForkID("☢ test ☢ track ☢").getHash());
|
||||
|
||||
CHECK (tID.getSym() == tID.getIdent().name);
|
||||
CHECK (ForkID().getIdent().category == Category (STRUCT,"forks"));
|
||||
CHECK (ClipID().getIdent().category == Category (STRUCT,"clips"));
|
||||
CHECK (tID.getSym() == idi::getAssetIdent(tID).name);
|
||||
CHECK (idi::getAssetIdent(ForkID()).category == Category (STRUCT,"forks"));
|
||||
CHECK (idi::getAssetIdent(ClipID()).category == Category (STRUCT,"clips"));
|
||||
|
||||
ClipID cID2,cID3;
|
||||
CHECK (cID2.getSym() < cID3.getSym());
|
||||
|
|
@ -153,7 +154,7 @@ namespace test {
|
|||
tID = arbitrary;
|
||||
CHECK (tID.getHash() == arbitrary.getHash());
|
||||
CHECK (tID.getSym() == arbitrary.getSym());
|
||||
CHECK (tID.getIdent()== arbitrary.getIdent());
|
||||
CHECK (idi::getAssetIdent(tID)== idi::getAssetIdent(arbitrary));
|
||||
}
|
||||
|
||||
cout << showSizeof<ForkID>() << endl;
|
||||
|
|
|
|||
Loading…
Reference in a new issue