FCF 2.0 development in progress...
> > > >
[News] [C++ Libraries API] [C++ Downloads] [Donate to the project] [Contacts]

fcf::TypeInfo class

Type:
class fcf::TypeInfo

Package: fcfBasis

File: bits/PartType/TypeInfoDefinition.hpp

Available from version: 1.0.1

Structure containing metadata and runtime information for a registered type.

Detailed description

fcf::TypeInfo is the core descriptor used by the fcf type system to perform dynamic type checking, conversions, and specificator-based operations.

The structure is initialized by the framework itself. Type information can be obtained using the fcf::getTypeInfo function or the fcf::Type::typeInfo method.

Typedef
typedef ConvertersType - The type is a map for storing converter functions.
typedef SpecificatorsType - Map type of the mapping from the specificator type index to the specificator information
Properties
unsigned int index
- Unique identifier for the type
std::string name
- Human-readable name of the type
unsigned char flags
- Internal flags for framework operation
size_t size
- The size of a data type in bytes.
fcf::TypeInfo::ConvertersType converters
- Map of conversion functions for converting FROM this type
fcf::TypeInfo::ConvertersType backConverters
- Map of conversion functions for converting TO this type
fcf::TypeInfo::SpecificatorsType specificators
- Registered specificators (e.g., Less, Equal, Add) for this type
fcf::UniversalCall containerAccessUniversalCall
- Universal call for the container access specifier for fast access.
fcf::ResolveSpecificator::CallType resolveCall
- The function pointer for the "resolve" specificator for fast access.
- Filled for type Variant, stores the size of the inner buffer. Necessary for internal framework work.
fcf::TypeFactoryBase* initializer
- Factory used to create/destroy instances of this type
Methods
template <typename TSpecificator>
TSpecificator::CallType specificatorCall()
template <typename TSpecificator>
TSpecificator::CallType specificatorCall(fcf::Exception* a_error)
- Retrieves a call specificator as a pointer to a specialized function for the given specificator.
template <typename TSpecificator>
fcf::UniversalCall specificatorUniversalCall()
template <typename TSpecificator>
fcf::UniversalCall specificatorUniversalCall(fcf::Exception* a_error)
- Retrieves a universal call function pointer for the given specificator.

Example:

#include <iostream> #define FCF_BASIS_IMPLEMENTATION #include <fcfBasis/basis.hpp> int main() { // We get information about the type const fcf::TypeInfo* ti = fcf::Type< std::string* >().typeInfo(); std::cout << "Type index: 0x" << std::hex << ti->index << std::dec << std::endl; std::cout << "Type name: " << ti->name << std::endl; std::cout << "Type size: " << ti->size << std::endl; return 0; }

Output:

Type index: 0x1000001e Type name: std::string* Type size: 8