#include <registry.hh>
Classes | |
struct | RegistryType |
Public Types | |
enum | DumpMode { NameOnly = 0, AllType = 1, WithSourceId = 2, RecursiveTypeDump = 4 } |
typedef RegistryIterator | Iterator |
Public Member Functions | |
void | add (Type *type, std::string const &source_id="") |
void | add (Type *type, bool persistent, std::string const &source_id) |
void | alias (std::string const &base, std::string const &alias, bool persistent, std::string const &source_id="") |
void | alias (std::string const &base, std::string const &alias, std::string const &source_id="") |
RegistryIterator | begin () const |
RegistryIterator | begin (std::string const &prefix) const |
Type const * | build (const std::string &name, std::size_t size=0) |
void | clear () |
void | clearAliases () |
void | copySourceIDs (Registry const ®istry) |
void | dump (std::ostream &stream, int dumpmode=AllType, const std::string &source_filter="*") const |
RegistryIterator | end () const |
RegistryIterator | end (std::string const &prefix) const |
RegistryIterator | find (std::string const &name) const |
Type const * | get (const std::string &name) const |
Type * | get_ (const std::string &name) |
Type & | get_ (Type const &type) |
std::set< std::string > | getAliasesOf (Type const &type) const |
std::string | getDefaultNamespace () const |
std::string | getFullName (const std::string &name) const |
bool | has (const std::string &name, bool build=true) const |
void | importNamespace (const std::string &name, bool erase_existing=false) |
bool | isIncluded (Type const &type) const |
bool | isSame (Registry const &other) const |
void | merge (Registry const ®istry) |
void | mergeMetaData (Registry const ®istry) |
Registry * | minimal (std::string const &name, bool with_aliases=true) const |
Registry * | minimal (Registry const &auto_types) const |
Registry () | |
std::set< Type * > | remove (Type const &type) |
void | resize (std::map< std::string, size_t > const &new_sizes) |
std::set< Type const * > | reverseDepends (Type const &type) const |
bool | setDefaultNamespace (const std::string &name) |
void | setSourceID (Type const &type, std::string const &source_id) |
size_t | size () const |
std::string | source (Type const *type) const |
~Registry () | |
Static Public Member Functions | |
static Type const & | null () |
Private Types | |
typedef std::map< const std::string, RegistryType > | NameMap |
typedef std::map< const std::string, RegistryType, bool(*)(const std::string &, const std::string &) | TypeMap ) |
Private Member Functions | |
void | add (std::string const &name, Type *new_type, bool persistent, std::string const &source_id) |
std::set< Type * > | reverseDepends (Type const &type) |
void | updateCurrentNameMap () |
Static Private Member Functions | |
static bool | isPersistent (std::string const &name, Type const &type, std::string const &source_id) |
Private Attributes | |
NameMap | m_current |
TypeMap | m_global |
std::string | m_namespace |
Friends | |
class | RegistryIterator |
Manipulation of a set of types Any complex type in a Registry object can only reference types in the same registry. No duplicates are allowed.
Registry objects provide the following services:
using namespace
in C++) Definition at line 86 of file registry.hh.
Definition at line 122 of file registry.hh.
typedef std::map<const std::string, RegistryType> Typelib::Registry::NameMap [private] |
Definition at line 103 of file registry.hh.
typedef std::map< const std::string , RegistryType , bool (*) (const std::string&, const std::string&) Typelib::Registry::TypeMap) [private] |
Definition at line 101 of file registry.hh.
Definition at line 307 of file registry.hh.
Definition at line 53 of file typelib/registry.cc.
Definition at line 60 of file typelib/registry.cc.
void Typelib::Registry::add | ( | std::string const & | name, |
Type * | new_type, | ||
bool | persistent, | ||
std::string const & | source_id | ||
) | [private] |
Definition at line 324 of file typelib/registry.cc.
void Typelib::Registry::add | ( | Type * | type, |
std::string const & | source_id = "" |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 368 of file typelib/registry.cc.
void Typelib::Registry::add | ( | Type * | type, |
bool | persistent, | ||
std::string const & | source_id | ||
) |
Adds a new type
Definition at line 373 of file typelib/registry.cc.
void Typelib::Registry::alias | ( | std::string const & | base, |
std::string const & | alias, | ||
bool | persistent, | ||
std::string const & | source_id = "" |
||
) |
Creates an alias While base can be a derived type, all aliases are considered persistent since they can be referenced by their name in other types
Definition at line 400 of file typelib/registry.cc.
void Typelib::Registry::alias | ( | std::string const & | base, |
std::string const & | alias, | ||
std::string const & | source_id = "" |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 391 of file typelib/registry.cc.
RegistryIterator Typelib::Registry::begin | ( | ) | const |
Iterator pointing on the first type of the registry
Definition at line 515 of file typelib/registry.cc.
RegistryIterator Typelib::Registry::begin | ( | std::string const & | prefix | ) | const |
Returns an iterator on the first type whose name starts with +prefix+. If +prefix+ is a namespace name, it will be the first type in that namespace
Definition at line 517 of file typelib/registry.cc.
const Type * Typelib::Registry::build | ( | const std::string & | name, |
std::size_t | size = 0 |
||
) |
Build a derived type from its canonical name
Definition at line 269 of file typelib/registry.cc.
void Typelib::Registry::clear | ( | ) |
Remove all types
Definition at line 449 of file typelib/registry.cc.
void Typelib::Registry::clearAliases | ( | ) |
Removes all defined aliases
Definition at line 433 of file typelib/registry.cc.
void Typelib::Registry::copySourceIDs | ( | Registry const & | registry | ) |
Get from the provided all registry all source IDs from types in +this+ which have no source ID yet
Definition at line 180 of file typelib/registry.cc.
void Typelib::Registry::dump | ( | std::ostream & | stream, |
int | dumpmode = AllType , |
||
const std::string & | source_filter = "*" |
||
) | const |
Definition at line 476 of file typelib/registry.cc.
RegistryIterator Typelib::Registry::end | ( | ) | const |
Past-the-end iterator on the registry
Definition at line 516 of file typelib/registry.cc.
RegistryIterator Typelib::Registry::end | ( | std::string const & | prefix | ) | const |
Returns an iterator on the first type whose name does not start with +prefix+ and which is preceded by a type whose name starts with +prefix
If +prefix+ is a namespace name, it will be the past-the-end iterator allowing you to iterate on the namespace types:
RegistryIterator const end = registry.end("/A"); for (RegistryIterator it = registry.begin("/A"); it != end; ++it) { // iterates on all types in namespace A }
Definition at line 525 of file typelib/registry.cc.
RegistryIterator Typelib::Registry::find | ( | std::string const & | name | ) | const |
Gets a RegistryIterator on a given type
Definition at line 302 of file typelib/registry.cc.
const Type * Typelib::Registry::get | ( | const std::string & | name | ) | const |
Gets a Type object
Definition at line 294 of file typelib/registry.cc.
Type * Typelib::Registry::get_ | ( | const std::string & | name | ) |
Definition at line 278 of file typelib/registry.cc.
Type & Typelib::Registry::get_ | ( | Type const & | type | ) |
Definition at line 286 of file typelib/registry.cc.
std::set< std::string > Typelib::Registry::getAliasesOf | ( | Type const & | type | ) | const |
Returns the set of aliases that exist for +type+
Definition at line 646 of file typelib/registry.cc.
std::string Typelib::Registry::getDefaultNamespace | ( | ) | const |
Get the default namespace (if any). Returns '/' (i.e. the root) if no default namespace have been set
Definition at line 80 of file typelib/registry.cc.
std::string Typelib::Registry::getFullName | ( | const std::string & | name | ) | const |
Get the absolute type name of name
, taking the default namespace into account
Definition at line 108 of file typelib/registry.cc.
bool Typelib::Registry::has | ( | const std::string & | name, |
bool | build = true |
||
) | const |
Checks for the availability of a particular type
name
is a derived version (pointer or array) of a known typeDefinition at line 257 of file typelib/registry.cc.
void Typelib::Registry::importNamespace | ( | const std::string & | name, |
bool | erase_existing = false |
||
) |
Import the name
namespace into the current namespace.
Definition at line 91 of file typelib/registry.cc.
bool Typelib::Registry::isIncluded | ( | Type const & | type | ) | const |
Returns true if +type+ is a type included in this registry
Definition at line 127 of file typelib/registry.cc.
bool Typelib::Registry::isPersistent | ( | std::string const & | name, |
Type const & | type, | ||
std::string const & | source_id | ||
) | [static, private] |
Definition at line 309 of file typelib/registry.cc.
bool Typelib::Registry::isSame | ( | Registry const & | other | ) | const |
Compares the two registries. Returns true if they contain the same set of types, referenced under the same name
Note that for now, if this contains a type 'A' aliased to 'B' and other
contains the same type but named 'B' and aliased to 'A', the method will return false.
Definition at line 535 of file typelib/registry.cc.
void Typelib::Registry::merge | ( | Registry const & | registry | ) |
Merges the content of registry
into this object
Definition at line 133 of file typelib/registry.cc.
void Typelib::Registry::mergeMetaData | ( | Registry const & | registry | ) |
Merge the metadata information contained in a registry into this one
Definition at line 169 of file typelib/registry.cc.
Registry * Typelib::Registry::minimal | ( | std::string const & | name, |
bool | with_aliases = true |
||
) | const |
Returns a registry containing the minimal set of types needed to define name
Definition at line 194 of file typelib/registry.cc.
Registry * Typelib::Registry::minimal | ( | Registry const & | auto_types | ) | const |
Returns a registry containing the minimal set of types needed to define the types that are in this
and not in auto_types
Definition at line 219 of file typelib/registry.cc.
Type const & Typelib::Registry::null | ( | ) | [static] |
Returns a null type
Definition at line 48 of file typelib/registry.cc.
std::set< Type * > Typelib::Registry::remove | ( | Type const & | type | ) |
Removes the given type from the registry, along with all the types that depend on it.
Definition at line 623 of file typelib/registry.cc.
void Typelib::Registry::resize | ( | std::map< std::string, size_t > const & | new_sizes | ) |
Modifies the size of a subset of the types, and propagate this size change to the other types
Definition at line 554 of file typelib/registry.cc.
std::set< Type * > Typelib::Registry::reverseDepends | ( | Type const & | type | ) | [private] |
Returns the set of types that depend on type
recursively
Definition at line 610 of file typelib/registry.cc.
std::set< Type const * > Typelib::Registry::reverseDepends | ( | Type const & | type | ) | const |
Returns the set of types that depend on type
recursively
Definition at line 577 of file typelib/registry.cc.
bool Typelib::Registry::setDefaultNamespace | ( | const std::string & | name | ) |
Sets the default namespace. This removes all namespace import and imports name
in the current namespace
Definition at line 81 of file typelib/registry.cc.
void Typelib::Registry::setSourceID | ( | Type const & | type, |
std::string const & | source_id | ||
) |
Changes the source ID of a particular type
Definition at line 658 of file typelib/registry.cc.
size_t Typelib::Registry::size | ( | ) | const |
Returns the count of types defined in this registry, including non-persistent and aliases
Definition at line 448 of file typelib/registry.cc.
std::string Typelib::Registry::source | ( | Type const * | type | ) | const |
Get the source ID of type
. Throws Undefined if type
is not a registered type
void Typelib::Registry::updateCurrentNameMap | ( | ) | [private] |
Updates +m_current+ based on +m_global+ and the current default namespace
Definition at line 62 of file typelib/registry.cc.
friend class RegistryIterator [friend] |
Definition at line 88 of file registry.hh.
NameMap Typelib::Registry::m_current [private] |
Definition at line 106 of file registry.hh.
TypeMap Typelib::Registry::m_global [private] |
Definition at line 105 of file registry.hh.
std::string Typelib::Registry::m_namespace [private] |
Definition at line 107 of file registry.hh.