start using a typedef HashVal instead of size_t (#722)

This commit is contained in:
Fischlurch 2010-11-27 05:11:02 +01:00
parent f9bc292ac3
commit 1e2d4d90f6
16 changed files with 85 additions and 99 deletions

View file

@ -86,6 +86,7 @@ namespace asset {
//NOBUG_DECLARE_FLAG (assetmem);
typedef size_t HashVal; /////////////////TICKET #722
/**
* thin wrapper around a size_t hash ID
@ -103,10 +104,10 @@ namespace asset {
class ID
{
public:
const size_t hash;
ID (size_t id) : hash(id) {}
const HashVal hash;
ID (HashVal id) : hash(id) {}
ID (const KIND& asset) : hash(asset.getID()) {}
operator size_t() const { return hash; }
operator HashVal() const { return hash; }
};
class DB;

View file

@ -23,8 +23,7 @@
#include "proc/asset/codec.hpp"
namespace asset
{
namespace asset {

View file

@ -28,8 +28,7 @@
namespace asset
{
namespace asset {
/**
* description of some media data decoder or encoder facility
@ -38,8 +37,8 @@ namespace asset
{
};
} // namespace asset
#endif

View file

@ -32,8 +32,7 @@ using std::vector;
namespace asset
{
namespace asset {
/**

View file

@ -59,7 +59,7 @@ namespace asset {
class ID<Media> : public ID<Asset>
{
public:
ID (size_t id);
ID (HashVal id);
ID (const Media&);
};
@ -130,7 +130,7 @@ namespace asset {
// definition of ID<Media> ctors is possible now,
// after providing full definition of class Media
inline ID<Media>::ID(size_t id) : ID<Asset> (id) {};
inline ID<Media>::ID(HashVal id) : ID<Asset> (id) {};
inline ID<Media>::ID(const Media& media) : ID<Asset> (media.getID()) {};

View file

@ -55,7 +55,7 @@ namespace asset {
class ID<Meta> : public ID<Asset>
{
public:
ID (size_t id);
ID (HashVal id);
ID (const Meta&);
};
@ -84,7 +84,7 @@ namespace asset {
// definition of ID<Meta> ctors is possible now,
// after providing full definition of class Proc
inline ID<Meta>::ID(size_t id) : ID<Asset> (id) {};
inline ID<Meta>::ID(HashVal id) : ID<Asset> (id) {};
inline ID<Meta>::ID(const Meta& meta) : ID<Asset> (meta.getID()) {};
typedef P<Meta> PMeta;

View file

@ -44,7 +44,7 @@ namespace asset {
class ID<Pipe> : public ID<Struct>
{
public:
ID (size_t id);
ID (HashVal id);
ID (const Pipe&);
};
@ -95,7 +95,7 @@ namespace asset {
// catch up with postponed definition of ID<Struct> ctors...
//
inline ID<Pipe>::ID(size_t id) : ID<Struct> (id) {};
inline ID<Pipe>::ID(HashVal id) : ID<Struct> (id) {};
inline ID<Pipe>::ID(Pipe const& pipe) : ID<Struct> (pipe.getID()) {};

View file

@ -23,29 +23,27 @@
#include "proc/asset/preview.hpp"
namespace asset
{
namespace asset {
namespace
namespace {
/** @internal derive a sensible asset ident tuple when creating
* a proxy placeholder media based on some existing asset::Media
* @todo getting this one right is important for the handling
* of "proxy editing"....
*/
const Asset::Ident
createProxyIdent (const Asset::Ident& mediaref)
{
/** @internal derive a sensible asset ident tuple when creating
* a proxy placeholder media based on some existing asset::Media
* @todo getting this one right is important for the handling
* of "proxy editing"....
*/
const Asset::Ident
createProxyIdent (const Asset::Ident& mediaref)
{
string name (mediaref.name + "-proxy"); // TODO something sensible here; append number, sanitise etc.
Category category (mediaref.category);
TODO ("put it in another subfolder within the same category??");
return Asset::Ident (name, category,
mediaref.org,
mediaref.version );
}
string name (mediaref.name + "-proxy"); // TODO something sensible here; append number, sanitise etc.
Category category (mediaref.category);
TODO ("put it in another subfolder within the same category??");
return Asset::Ident (name, category,
mediaref.org,
mediaref.version );
}
}//(End)implementation helper
@ -62,8 +60,8 @@ namespace asset
this->defineDependency (mediaref);
UNIMPLEMENTED ("do something to setup proxy media");
}
} // namespace asset

View file

@ -28,9 +28,8 @@
namespace asset
{
namespace asset {
/**
* special placeholder denoting an alternative version of the media data,
* typically with lower resolution ("proxy media")
@ -41,8 +40,8 @@ namespace asset
Preview (Media& mediaref);
friend class MediaFactory;
};
} // namespace asset
#endif

View file

@ -27,15 +27,8 @@
#include "include/logging.h"
namespace asset
{
namespace asset {
namespace // Implementation details
{
/** helper: .....*/
}
ProcFactory Proc::create; ///< storage for the static ProcFactory instance

View file

@ -26,7 +26,7 @@
** For the different <i>Kinds</i> of Assets, we use sub-interfaces inheriting
** from the general Asset interface. To be able to get asset::Proc instances
** directly from the AssetManager, we define a specialisation of the Asset ID.
**
**
** @see asset.hpp for explanation
** @see ProcFactory creating concrete asset::Proc instances
**
@ -57,12 +57,12 @@ namespace asset {
class ID<Proc> : public ID<Asset>
{
public:
ID (size_t id);
ID (HashVal id);
ID (const Proc&);
};
/**
* key abstraction: data processing asset
* @todo just a stub, have to figure out what a asset::Proc is
@ -94,18 +94,18 @@ namespace asset {
virtual ProcFunc*
resolveProcessor() const =0;
protected:
Proc (const Asset::Ident& idi) : Asset(idi) {} //////////////TODO
friend class ProcFactory;
};
// definition of ID<Proc> ctors is possible now,
// after providing full definition of class Proc
inline ID<Proc>::ID(size_t id) : ID<Asset> (id) {};
inline ID<Proc>::ID(HashVal id) : ID<Asset> (id) {};
inline ID<Proc>::ID(const Proc& proc) : ID<Asset> (proc.getID()) {};
@ -120,11 +120,11 @@ namespace asset {
typedef P<asset::Proc> PType;
PType operator() (Asset::Ident& key); ////////////TODO define actual operation
};
} // namespace asset
#endif

View file

@ -37,15 +37,15 @@ namespace asset {
using lumiera::P;
using lib::Symbol;
class Proc;
class ProcPatt;
class BuildInstruct;
typedef P<const asset::Proc> PProc;
typedef P<const asset::ProcPatt> PProcPatt;
typedef vector<BuildInstruct> InstructionSequence;
typedef vector<BuildInstruct> InstructionSequence;
/**
* "Processing Pattern" is a structural Asset
* representing information how to build some part
@ -56,7 +56,7 @@ namespace asset {
{
InstructionSequence instructions_;
ProcPatt (const Asset::Ident&, const InstructionSequence&);
ProcPatt (const Asset::Ident&, const InstructionSequence&);
protected:
explicit ProcPatt (const Asset::Ident& idi);
@ -67,11 +67,11 @@ namespace asset {
ProcPatt& attach (Symbol where, PProc& node);
ProcPatt& operator+= (PProcPatt& toReuse);
};
} // namespace asset
#endif

View file

@ -86,7 +86,7 @@ namespace asset {
, public lib::AutoRegistered<Sequence>
{
typedef mobject::session::RTrack RTrack;
Sequence (Ident const&); //////////////////////////////////////////////TICKET #692 pass in track here
public:
@ -100,7 +100,7 @@ namespace asset {
typedef P<Sequence> PSequence;
///////////////////////////TODO currently just fleshing the API

View file

@ -87,12 +87,12 @@ namespace asset {
class ID<Struct> : public ID<Asset>
{
public:
ID (size_t id);
ID (HashVal id);
ID (const Struct&);
};
/**
* key abstraction: structural asset
* Created automatically as a sideeffect of building the structure
@ -125,7 +125,7 @@ namespace asset {
// definition of ID<Struct> ctors is possible now,
// after providing full definition of class Struct
inline ID<Struct>::ID(size_t id) : ID<Asset> (id) {};
inline ID<Struct>::ID(HashVal id) : ID<Asset> (id) {};
inline ID<Struct>::ID(const Struct& stru) : ID<Asset> (stru.getID()) {};

View file

@ -27,8 +27,9 @@
using boost::format;
namespace asset
{
namespace asset {
LUMIERA_ERROR_DEFINE (ORIG_NOT_FOUND, "Media referred by placeholder not found");
@ -60,8 +61,6 @@ namespace asset
);
}
LUMIERA_ERROR_DEFINE (ORIG_NOT_FOUND, "Media referred by placeholder not found");
} // namespace asset

View file

@ -28,12 +28,11 @@
namespace asset
{
namespace asset {
const lumiera::Time DUMMY_TIME (25); ///< @todo solve config management
/**
* Placeholder Asset for unknown or unavailable media source.
* @todo maybe do special handling of the media length, allowing
@ -50,11 +49,11 @@ namespace asset
virtual Media::PMedia getOrg() throw(lumiera::error::Invalid);
};
LUMIERA_ERROR_DECLARE (ORIG_NOT_FOUND);
} // namespace asset
#endif