|
TrioCFD 1.9.9_beta
TrioCFD documentation
|
Models type information for Objet_U objects. More...
#include <Type_info.h>
Public Member Functions | |
| ~Type_info () | |
| Type_info (const char *name, Objet_U *(*f)(), int nb_bases=0, const Type_info **bases=0) | |
| Constructor from a name, a factory function, and an array of base types. | |
| Type_info (const char *name, int nb_bases=0, const Type_info **bases=0) | |
| Constructor from a name and an array of base types. | |
| const Nom & | name () const |
| int | can_cast (const Type_info *p) const |
| Traverses the type hierarchy. Returns 1 if p points to a subtype of the current type. | |
| int | same (const Type_info *p) const |
| Returns 1 if this==p, 0 otherwise. | |
| int | same (const Nom &) const |
| Comparison on the name of a type. Returns 1 if the name string of the considered type and the given name are identical. | |
| int | has_base (const Type_info *p, int direct=0) const |
| Tests whether a type belongs to the base types of the considered type. If direct == 0,. | |
| int | has_base (const Nom &, int direct=0) const |
| Tests whether a type belongs to the base types of the considered type. The type to search for is identified by its name. | |
| Sortie & | bases (Sortie &) const |
| Writes the base types of the current type to an output stream. | |
| Objet_U * | instance () const |
| Creates an instance of the class associated with the type_info. | |
| int | instanciable () const |
| Returns 1 if the associated type is instantiable (cree_instance is non-null), 0 otherwise. | |
Static Public Member Functions | |
| static Sortie & | hierarchie (Sortie &) |
| Writes the full hierarchy of the considered type to an output stream. | |
| static int | est_un_type (const char *) |
| Tests whether a class of the given type exists. If a class T whose Type_info has the name nom exists,. | |
| static int | les_sous_types (const Nom &, Noms &sous_types) |
| Returns the names of the subtypes for a parent type identified by name. | |
| static int | les_sous_types (const Type_info &, Noms &sous_types) |
| Returns the names of the subtypes for a given parent type. | |
| static const Type_info * | type_info_from_name (const char *type_name) |
| Static method that returns a pointer to the Type_info whose name is "type_name". | |
| static Objet_U * | instance (const char *typ) |
| Instantiates an Objet_U of the given type. If a class T whose Type_info has the name typ exists,. | |
Models type information for Objet_U objects.
Definition at line 29 of file Type_info.h.
| Type_info::~Type_info | ( | ) |
Definition at line 57 of file Type_info.cpp.
| Type_info::Type_info | ( | const char * | un_nom, |
| Objet_U *(* | f )(), | ||
| int | nb_base = 0, | ||
| const Type_info ** | the_bases = 0 ) |
Constructor from a name, a factory function, and an array of base types.
The function is used to create an instance of the appropriate type.
| un_nom | The name of the type to create. |
| f | Factory function that creates an instance of this type. |
| nb_base | Number of base types in the bases array. |
| the_bases | Array specifying the base (parent) types of the type to create. |
| Exits | with an error if the name is null. |
Definition at line 164 of file Type_info.cpp.
| Type_info::Type_info | ( | const char * | un_nom, |
| int | nb_base = 0, | ||
| const Type_info ** | the_bases = 0 ) |
Constructor from a name and an array of base types.
| un_nom | The name of the type to create. |
| nb_base | Number of base types in the bases array. |
| the_bases | Array specifying the base (parent) types of the type to create. |
| Exits | with an error if the name is null. |
Definition at line 136 of file Type_info.cpp.
Writes the base types of the current type to an output stream.
| os | Output stream. |
Definition at line 302 of file Type_info.cpp.
|
inline |
Traverses the type hierarchy. Returns 1 if p points to a subtype of the current type.
| p | Pointer to the type to test. |
Definition at line 100 of file Type_info.h.
|
static |
Tests whether a class of the given type exists. If a class T whose Type_info has the name nom exists,.
est_un_type returns 1, null pointer otherwise.
| (const | char* nom) string associated with a type |
Definition at line 369 of file Type_info.cpp.
| int Type_info::has_base | ( | const Nom & | aname, |
| int | direct = 0 ) const |
Tests whether a type belongs to the base types of the considered type. The type to search for is identified by its name.
If direct == 0, returns 1 if the type named name is among the bases of (*this), 0 otherwise. If direct != 0, returns 1 if the type named name is among the bases of (*this) or any direct or indirect parent of (*this), 0 otherwise.
| (const | Nom& name) the name of the type to search for |
| (int | direct) 0 to search the entire base hierarchy, non-zero for a direct search |
Definition at line 429 of file Type_info.cpp.
| int Type_info::has_base | ( | const Type_info * | p, |
| int | direct = 0 ) const |
Tests whether a type belongs to the base types of the considered type. If direct == 0,.
returns 1 if (*p) is among the bases of (*this), 0 otherwise. If direct != 0, returns 1 if (*p) is among the bases of (*this) or any direct or indirect parent of (*this), 0 otherwise.
| (const | Type_info* p) pointer to the type to search for |
| (int | direct) 0 to search the entire base hierarchy, non-zero for a direct search |
Definition at line 385 of file Type_info.cpp.
Writes the full hierarchy of the considered type to an output stream.
| (Sortie& | os) output stream |
Definition at line 315 of file Type_info.cpp.
| Objet_U * Type_info::instance | ( | ) | const |
Creates an instance of the class associated with the type_info.
Definition at line 349 of file Type_info.cpp.
|
static |
Instantiates an Objet_U of the given type. If a class T whose Type_info has the name typ exists,.
instance returns a pointer to a new instance of T. Returns the null pointer otherwise.
| (const | char* typ) string associated with a type |
Definition at line 335 of file Type_info.cpp.
| int Type_info::instanciable | ( | ) | const |
Returns 1 if the associated type is instantiable (cree_instance is non-null), 0 otherwise.
Definition at line 558 of file Type_info.cpp.
Returns the names of the subtypes for a parent type identified by name.
| (const | Nom& type) the name of the parent type to search subtypes of |
| (Noms& | les_sous_types) the names of the subtypes |
| Exits | with an error if the given name does not correspond to a type known to TRUST |
Definition at line 505 of file Type_info.cpp.
Returns the names of the subtypes for a given parent type.
| (const | Type_info& mere) the parent type to search subtypes of |
| (Noms& | les_sous_types) the names of the subtypes |
Definition at line 467 of file Type_info.cpp.
|
inline |
Definition at line 36 of file Type_info.h.
| int Type_info::same | ( | const Nom & | other_name | ) | const |
Comparison on the name of a type. Returns 1 if the name string of the considered type and the given name are identical.
Returns 0 otherwise.
Definition at line 448 of file Type_info.cpp.
| int Type_info::same | ( | const Type_info * | p | ) | const |
Returns 1 if this==p, 0 otherwise.
Definition at line 456 of file Type_info.cpp.
|
static |
Static method that returns a pointer to the Type_info whose name is "type_name".
If type_name is not a known type, returns a null pointer.
Definition at line 530 of file Type_info.cpp.