WIP draft for a generic hash based and typed id, similar to asset::ID
This commit is contained in:
parent
35ebe966b5
commit
87362a4b0d
2 changed files with 46 additions and 0 deletions
|
|
@ -45,6 +45,45 @@ namespace mobject {
|
|||
// using std::tr1::shared_ptr;
|
||||
|
||||
|
||||
/** @todo WIP a generic hash-index, maybe also usable for assets */
|
||||
struct LuidH
|
||||
{
|
||||
long dummy_;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct HaID;
|
||||
|
||||
struct TestA
|
||||
{
|
||||
LuidH id_;
|
||||
HaID<TestA> const& getID() const;
|
||||
};
|
||||
struct TestBA : TestA {};
|
||||
struct TestBB : TestA {};
|
||||
|
||||
template<>
|
||||
struct HaID<TestA> : LuidH
|
||||
{
|
||||
HaID () : LuidH () {}
|
||||
HaID (TestA const& ref) : LuidH (ref.getID()) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct HaID : HaID<TestA>
|
||||
{
|
||||
HaID () : HaID<TestA> () {}
|
||||
HaID (T const& ref) : HaID<TestA> (ref) {}
|
||||
};
|
||||
|
||||
inline
|
||||
HaID<TestA> const&
|
||||
TestA::getID() const
|
||||
{
|
||||
return *(static_cast<const HaID<TestA>*> (&id_));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
//#include "proc/mobject/session/edl.hpp"
|
||||
//#include "proc/mobject/session/testclip.hpp"
|
||||
#include "proc/mobject/placement.hpp"
|
||||
#include "proc/mobject/placement-ref.hpp"
|
||||
//#include "proc/mobject/explicitplacement.hpp"
|
||||
//#include "lib/util.hpp"
|
||||
|
||||
|
|
@ -46,6 +47,12 @@ namespace test {
|
|||
|
||||
using asset::VIDEO;
|
||||
|
||||
/** @todo WIP a generic hash-index, maybe also usable for assets */
|
||||
HaID<TestBB> hahaBB1;
|
||||
|
||||
TestBA bab;
|
||||
HaID<TestBA> hahaBA1 (bab);
|
||||
///////////////////////////////TODO (Experimentation)
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
|
|
|||
Loading…
Reference in a new issue