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

fcf::getTypeInfo() function

const fcf::TypeInfo* fcf::getTypeInfo(unsigned int a_typeIndex)
const fcf::TypeInfo* fcf::getTypeInfo(unsigned int a_typeIndex, fcf::Exception* a_errorDst)

Package: fcfBasis

File: bits/PartType/getTypeInfo.hpp

Available from version: 1.0.1

It extracts information about the type given in the function argument in the form of a type index.

If the function is called without the a_dstError parameter, an exception is thrown if an error occurs.

If the function is called with the a_dstError parameter, the exception data is written to a_dstError if an error occurs. If 0 is passed as a_dstError, the function simply aborts. If the function fails, it returns a null pointer to fcf::TypeInfo.

Thrown exceptions
fcf::TypeIndexNotRegisteredException
- If the type with the requested index is not registered in the system

Arguments

unsigned int a_typeIndex
- Integer type index

fcf::Exception* a_errorDst
- Pointer to an error object that will be filled in the event of a failure. May be zero.
Result
const fcf::TypeInfo*
- A pointer to an information object of the corresponding type.

Example:

#include <iostream> #define FCF_BASIS_IMPLEMENTATION #include <fcfBasis/basis.hpp> int main() { // We get information about the float type const fcf::TypeInfo* ti = fcf::getTypeInfo(FCF_FLOAT32_TYPE_INDEX); // The index of the float type std::cout << "Type index: " << ti->index << std::endl; // The name of the float type std::cout << "Type name: " << ti->name << std::endl; // The data size of the float type std::cout << "Type size: " << ti->size << std::endl; return 0; }

Output:

Type index: 9 Type name: float Type size: 4