Scopira
20080306
|
#include <objflowloader.h>
Public Types | |
typedef scopira::tool::iterator_g< object * > | note_iterator |
typedef object *(* | loadfunc_t) (void) |
a loader function type | |
Public Member Functions | |
objflowloader (void) | |
~objflowloader () | |
destructor | |
void | add_type (const std::type_info &id, const std::string &name, loadfunc_t loader) |
void | add_type (const std::type_info &id, const char *name, loadfunc_t loader) |
alternate just for performance reasons | |
const std::string & | get_name (const std::type_info &id) const |
gets the name, based on typeid | |
bool | has_typeinfo (const std::type_info &id) const |
do i have this type? | |
bool | has_typeinfo (const std::string &name) const |
do I know about this type? | |
const std::type_info & | get_typeinfo (const std::string &name) const |
gets the typeid, based on the unique name, the name must exist | |
object * | load_object (const std::type_info &id) const |
invokes a loader, null on fail | |
void | set_note (const std::type_info &id, scopira::tool::object *o) |
scopira::tool::object * | get_note (const std::type_info &id) const |
gets the optional note object for the given name, might return null for none | |
note_iterator | get_note_iterator (void) |
Public Member Functions inherited from scopira::tool::object | |
virtual | ~object () |
int | add_ref (void) const |
bool | sub_ref (void) const |
void | auto_ref (void) const |
int | current_ref (void) const |
virtual scopira::tool::oflow_i & | print (scopira::tool::oflow_i &o) const |
virtual bool | load (scopira::tool::iobjflow_i &in) |
virtual void | save (scopira::tool::oobjflow_i &out) const |
bool | is_alive_object (void) const |
bool | is_dead_object (void) const |
Static Public Member Functions | |
static objflowloader * | instance (void) |
Protected Attributes | |
scopira::tool::count_ptr< impl_t > | dm_imp |
Static Protected Attributes | |
static objflowloader * | dm_loader |
Additional Inherited Members | |
Protected Member Functions inherited from scopira::tool::object | |
object (void) | |
object (bool neverusecounter) | |
A flow object loader and type registry.
Basically, a registration of an object contains: it's C++ type_info a universally unique name (usually the fully qualified C++ name) the loader function (in some rare cases, this is null) an optional note object
The internal maps names -> type_info -> the full payload.
scopira::tool::objflowloader::objflowloader | ( | void | ) |
constructor. the objflowloader constructed will automatically register itself as the global objflowloader
it will automaitcally call scopira::tool::register_flowtypes on itself. you should explictly register any other classes
void scopira::tool::objflowloader::add_type | ( | const std::type_info & | id, |
const std::string & | name, | ||
loadfunc_t | loader | ||
) |
adds a type to the registry. calling this one the same type is fine, as it simply does replacement
note_iterator scopira::tool::objflowloader::get_note_iterator | ( | void | ) |
Get a iterator of all the notes in the system.
|
static |
Gets the current loader. This will never return null (that is, it'll create one if need be).
However, this method ends up creating it, it will put it in a reference counted state.
void scopira::tool::objflowloader::set_note | ( | const std::type_info & | id, |
scopira::tool::object * | o | ||
) |
sets the optional annotation object for the given name if the object already has a annotation object, it will be replaced the object will be ref counted.
Notes should have used they object(bool = true) ctor (go look it up) as notes may live outside the rec coutning debug system's lifetime.