Lumiera  0.pre.03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
EntryID< TY > Struct Template Reference

#include "lib/idi/entry-id.hpp"


template<class TY>
struct lib::idi::EntryID< TY >

typed symbolic and hash ID for asset-like position accounting.

Allows for creating an entry with symbolic id and distinct type, combined with an derived hash value, without the overhead in storage and instance management imposed by using a full-fledged Asset.

Similar to an Asset, an identification tuple is available (generated on the fly), as is an unique LUID and total ordering. The type information is attached as template parameter, but included into the hash calculation. All instantiations of the EntryID template share a common baseclass, usable for type erased common registration.

currently storing the symbolic-ID as string. It should be a lib::Symbol, but this isn't possible unless we use a symbol table. //////TICKET #158
there is a weakness in boost::hash applied to strings. EntryID by default generates symbolic IDs from a type prefix plus a running number, which causes collisions already with less than 100000 entries.
As a temporary workaround, we hash the symbolic ID twice, but we should look into using a better hash function ////////////TICKET #865
See also

Definition at line 128 of file entry-id.hpp.

Public Member Functions

 EntryID ()
 case-1: auto generated symbolic ID More...
 EntryID (string const &symbolID)
 case-2: explicitly specify a symbolic ID to use. More...
 EntryID (const char *symbolID)
 EntryID (Symbol const &internalSymbol)
 case-2b: rely on an internal, already sanitised symbol. More...
 operator string () const
- Public Member Functions inherited from BareEntryID
LuidH const & getHash () const
string const & getSym () const
bool isValid () const
 operator string () const
template<typename TAR >
EntryID< TAR > const & recast () const
 try to upcast this BareEntryID to a fully typed EntryID. More...

Static Public Member Functions

static bool canRecast (BareEntryID const &bID)
static EntryID const & recast (BareEntryID const &bID)


bool operator< (EntryID const &i1, EntryID const &i2)

Additional Inherited Members

- Protected Member Functions inherited from BareEntryID
 BareEntryID (string const &symbolID, HashVal seed=0)
 Not to be created stand-alone. More...

Constructor & Destructor Documentation

EntryID ( )

case-1: auto generated symbolic ID

Definition at line 220 of file entry-id.hpp.

EntryID ( string const &  symbolID)

case-2: explicitly specify a symbolic ID to use.

The type information TY will be included automatically into the generated hash-ID. This hash is reproducible.

Definition at line 229 of file entry-id.hpp.

EntryID ( const char *  symbolID)

Definition at line 233 of file entry-id.hpp.

EntryID ( Symbol const &  internalSymbol)

case-2b: rely on an internal, already sanitised symbol.

The symbol string will be passed through as-is, while the type information from TY will be hashed in.

Definition at line 242 of file entry-id.hpp.

Member Function Documentation

static bool canRecast ( BareEntryID< TY > const &  bID)
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 by re-calculating the hash.

Definition at line 253 of file entry-id.hpp.

Referenced by EntryID< StreamType >::recast().

+ Here is the caller graph for this function:

static EntryID const& recast ( BareEntryID< TY > const &  bID)

Definition at line 259 of file entry-id.hpp.

Referenced by EntryID_test::checkErasure().

+ Here is the caller graph for this function:

operator string ( ) const

Definition at line 311 of file entry-id.hpp.

References BareEntryID::getSym().

+ Here is the call graph for this function:

Friends And Related Function Documentation

bool operator< ( EntryID< TY > const &  i1,
EntryID< TY > const &  i2 

Definition at line 271 of file entry-id.hpp.

+ Inheritance diagram for EntryID< TY >:
+ Collaboration diagram for EntryID< TY >:

The documentation for this struct was generated from the following file: