#include <typelib/typemodel.hh>


Public Types | |
| enum | Category { NullType = 0, Array, Pointer, Numeric, Enum, Compound, Opaque, Container } |
Public Member Functions | |
| virtual | ~Type () |
| void | setName (const std::string &name) |
| void | setSize (size_t size) |
| std::string | getName () const |
| std::string | getBasename () const |
| std::string | getNamespace () const |
| size_t | getSize () const |
| Category | getCategory () const |
| bool | isNull () const |
| virtual std::set< Type const * > | dependsOn () const =0 |
| bool | operator== (Type const &with) const |
| bool | operator!= (Type const &with) const |
| bool | isSame (Type const &other) const |
| Type const & | merge (Registry ®istry) const |
| virtual Type const & | merge (Registry ®istry, RecursionStack &stack) const |
Static Public Attributes | |
| static const int | ValidCategories = Compound + 1 |
Protected Types | |
| typedef std::map< Type const *, Type const * > | RecursionStack |
Protected Member Functions | |
| Type (const std::string &name, size_t size, Category category) | |
| virtual bool | do_isSame (Type const &other, std::map< Type const *, Type const * > &stack) const |
| bool | rec_isSame (Type const &left, Type const &right, RecursionStack &stack) const |
| Type const * | try_merge (Registry ®istry, RecursionStack &stack) const |
| virtual Type * | do_merge (Registry ®istry, RecursionStack &stack) const =0 |
typedef std::map<Type const*, Type const*> Typelib::Type::RecursionStack [protected] |
| Typelib::Type::Type | ( | const std::string & | name, | |
| size_t | size, | |||
| Category | category | |||
| ) | [protected] |
References setName().
| Typelib::Type::~Type | ( | ) | [virtual] |
| void Typelib::Type::setName | ( | const std::string & | name | ) |
Changes the type name. Never use once the type has been added to a registry
Referenced by Type().
| void Typelib::Type::setSize | ( | size_t | size | ) |
Changes the type size. Don't use that unless you know what you are doing. In particular, don't use it once the type is used in a Compound.
Referenced by Typelib::Compound::addField().
| std::string Typelib::Type::getName | ( | ) | const |
The type full name (including namespace)
Referenced by Typelib::Registry::add(), Typelib::TypeBuilder::addArrayMajor(), Typelib::TypeBuilder::addPointer(), Typelib::Registry::dump(), Typelib::Compound::getField(), try_merge(), and Typelib::TypeDisplayVisitor::visit_().
| std::string Typelib::Type::getBasename | ( | ) | const |
The type name without the namespace
References Typelib::getTypename().
| std::string Typelib::Type::getNamespace | ( | ) | const |
The type namespace
References Typelib::getNamespace().
| size_t Typelib::Type::getSize | ( | ) | const |
Size in bytes of a value
Referenced by Typelib::Compound::addField(), Typelib::ValueOps::compare(), Typelib::ValueOps::copy(), Typelib::ValueOps::destroy(), Typelib::ValueOps::dump(), Typelib::MemLayout::Visitor::generic_visit(), Typelib::ValueOps::init(), Typelib::ValueOps::load(), Typelib::ValueVisitor::TypeDispatch::visit_(), Typelib::TypeDisplayVisitor::visit_(), Typelib::MemLayout::Visitor::visit_(), and Typelib::CompileEndianSwapVisitor::visit_().
| Type::Category Typelib::Type::getCategory | ( | ) | const |
The type category
Referenced by Typelib::TypeBuilder::addArrayMinor(), Typelib::TypeVisitor::dispatch(), and Typelib::CompileEndianSwapVisitor::visit_().
| bool Typelib::Type::isNull | ( | ) | const |
true if this type is null
| virtual std::set<Type const*> Typelib::Type::dependsOn | ( | ) | const [pure virtual] |
The set of types this type depends upon
Implemented in Typelib::NullType, Typelib::OpaqueType, Typelib::Numeric, Typelib::Enum, Typelib::Compound, and Typelib::Indirect.
| bool Typelib::Type::operator== | ( | Type const & | with | ) | const |
| bool Typelib::Type::operator!= | ( | Type const & | with | ) | const |
| bool Typelib::Type::isSame | ( | Type const & | other | ) | const |
Deep check that other defines the same type than self. Basic checks on name, size and category are performed by ==
References do_isSame().
Referenced by Typelib::Registry::merge(), Typelib::Registry::minimal(), and Typelib::Field::operator==().
Merges this type into registry: creates a type equivalent to this one in the target registry, reusing possible equivalent types already present in +registry+.
Referenced by Typelib::Container::do_merge(), and Typelib::Indirect::merge().
| Type const & Typelib::Type::merge | ( | Registry & | registry, | |
| RecursionStack & | stack | |||
| ) | const [virtual] |
References Typelib::Registry::add(), do_merge(), and try_merge().
| virtual bool Typelib::Type::do_isSame | ( | Type const & | other, | |
| std::map< Type const *, Type const * > & | stack | |||
| ) | const [protected, virtual] |
Referenced by Typelib::Container::do_isSame(), Typelib::Indirect::do_isSame(), isSame(), and rec_isSame().
| bool Typelib::Type::rec_isSame | ( | Type const & | left, | |
| Type const & | right, | |||
| RecursionStack & | stack | |||
| ) | const [protected] |
| Type const * Typelib::Type::try_merge | ( | Registry & | registry, | |
| RecursionStack & | stack | |||
| ) | const [protected] |
References Typelib::Registry::get(), and getName().
Referenced by Typelib::Indirect::merge(), and merge().
| virtual Type* Typelib::Type::do_merge | ( | Registry & | registry, | |
| RecursionStack & | stack | |||
| ) | const [protected, pure virtual] |
Called by Type::merge when the type does not exist in registry already. This is needed for types to update their subtypes (pointed-to type, ...) to the definitions found in registry
Referenced by merge().
const int Typelib::Type::ValidCategories = Compound + 1 [static] |
Reimplemented in Typelib::Numeric.
1.5.6