Typelib::Type Class Reference

#include <typelib/typemodel.hh>

Inheritance diagram for Typelib::Type:

Inheritance graph
[legend]
Collaboration diagram for Typelib::Type:

Collaboration graph
[legend]

List of all members.

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 &registry) const
virtual Type const & merge (Registry &registry, 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 &registry, RecursionStack &stack) const
virtual Typedo_merge (Registry &registry, RecursionStack &stack) const =0


Detailed Description

Base class for all type definitions

Member Typedef Documentation

typedef std::map<Type const*, Type const*> Typelib::Type::RecursionStack [protected]


Member Enumeration Documentation

Enumerator:
NullType 
Array 
Pointer 
Numeric 
Enum 
Compound 
Opaque 
Container 


Constructor & Destructor Documentation

Typelib::Type::Type ( const std::string &  name,
size_t  size,
Category  category 
) [protected]

References setName().

Typelib::Type::~Type (  )  [virtual]


Member Function Documentation

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

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

Type::Category Typelib::Type::getCategory (  )  const

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==().

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

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]

virtual bool Typelib::Type::do_isSame ( Type const &  other,
std::map< Type const *, Type const * > &  stack 
) const [protected, virtual]

bool Typelib::Type::rec_isSame ( Type const &  left,
Type const &  right,
RecursionStack stack 
) const [protected]

References do_isSame().

Referenced by Typelib::Indirect::do_isSame().

Type const * Typelib::Type::try_merge ( Registry registry,
RecursionStack stack 
) const [protected]

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().


Member Data Documentation

const int Typelib::Type::ValidCategories = Compound + 1 [static]

Reimplemented in Typelib::Numeric.


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

Generated on Thu Jan 22 16:37:59 2009 for typeLib by doxygen 1.5.6
SourceForge.net Project Page