Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
Typelib::Registry Class Reference

#include <registry.hh>

List of all members.

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)
void clear ()
void clearAliases ()
void copySourceIDs (Registry const &registry)
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
Typeget_ (const std::string &name)
Typeget_ (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 &registry)
Registryminimal (std::string const &name, bool with_aliases=true) const
Registryminimal (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

Detailed Description

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:

Definition at line 86 of file registry.hh.


Member Typedef Documentation

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.


Member Enumeration Documentation

Enumerator:
NameOnly 
AllType 
WithSourceId 
RecursiveTypeDump 

Definition at line 303 of file registry.hh.


Constructor & Destructor Documentation

Definition at line 66 of file typelib/registry.cc.

Definition at line 73 of file typelib/registry.cc.


Member Function Documentation

void Typelib::Registry::add ( std::string const &  name,
Type new_type,
bool  persistent,
std::string const &  source_id 
) [private]

Definition at line 319 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 363 of file typelib/registry.cc.

void Typelib::Registry::add ( Type type,
bool  persistent,
std::string const &  source_id 
)

Adds a new type

Returns:
true on success, false if the type was already defined in the registry

Definition at line 368 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

  • base the base type
  • alias the alias name
  • source_id a source ID for the newly created type

Definition at line 395 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 386 of file typelib/registry.cc.

Iterator pointing on the first type of the registry

Definition at line 512 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 514 of file typelib/registry.cc.

const Type * Typelib::Registry::build ( const std::string &  name)

Build a derived type from its canonical name

Definition at line 269 of file typelib/registry.cc.

Remove all types

Definition at line 444 of file typelib/registry.cc.

Removes all defined aliases

Definition at line 428 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 181 of file typelib/registry.cc.

void Typelib::Registry::dump ( std::ostream &  stream,
int  dumpmode = AllType,
const std::string &  source_filter = "*" 
) const

Definition at line 471 of file typelib/registry.cc.

Past-the-end iterator on the registry

Definition at line 513 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 522 of file typelib/registry.cc.

RegistryIterator Typelib::Registry::find ( std::string const &  name) const

Gets a RegistryIterator on a given type

  • name the type name
    Returns:
    the iterator, or end() if it is not found

Definition at line 297 of file typelib/registry.cc.

const Type * Typelib::Registry::get ( const std::string &  name) const

Gets a Type object

  • name the type name
    Returns:
    the type object if it exists, 0 otherwise

Definition at line 289 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 629 of file typelib/registry.cc.

Get the default namespace (if any). Returns '/' (i.e. the root) if no default namespace have been set

Definition at line 93 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

See also:
setDefaultNamespace getDefaultNamespace

Definition at line 121 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 the type name
  • build if true, the method returns true if name is a derived version (pointer or array) of a known type
Returns:
true if the Type exists, or if it is a derived type and build is true, false otherwise

Definition 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.

  • erase_existing controls the behaviour in case of name collision. If true, the type from the namespace being imported will have priority. If false, an already imported type will have priority.

Definition at line 104 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 140 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 304 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 532 of file typelib/registry.cc.

void Typelib::Registry::merge ( Registry const &  registry)

Merges the content of registry into this object

Definition at line 146 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 195 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 61 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.

Returns:
the set of types that have been removed. Their ownership is passed to the caller (i.e. the caller has to delete them)

Definition at line 606 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 551 of file typelib/registry.cc.

std::set< Type * > Typelib::Registry::reverseDepends ( Type const &  type) [private]

Returns the set of types that depend on type

Definition at line 593 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

Definition at line 574 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 94 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 641 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 443 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

Updates +m_current+ based on +m_global+ and the current default namespace

Definition at line 75 of file typelib/registry.cc.


Friends And Related Function Documentation

friend class RegistryIterator [friend]

Definition at line 88 of file registry.hh.


Member Data Documentation

Definition at line 106 of file registry.hh.

Definition at line 105 of file registry.hh.

std::string Typelib::Registry::m_namespace [private]

Definition at line 107 of file registry.hh.


The documentation for this class was generated from the following files:


typelib
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Mon Oct 6 2014 03:17:12