Main MRPT website > C++ reference
MRPT logo
Static Public Member Functions
mrpt::utils::TTypeName Struct Reference

Detailed Description

A template to obtain the type of its argument as a string at compile time.

It works with all classes derived from CSerializable, plus many specializations for the plain data types (bool, double, uint8_t, etc...) For example:

     cout << TTypeName<double>::get() << endl;                          // "double"
        cout << TTypeName<CPose2D>::get() << endl;                         // "CPose2D"
        cout << TTypeName<mrpt::slam::COccupancyGridMap2D>::get() << endl; // "COccupancyGridMap2D"

Users can extend this for custom structs/classes with the macro DECLARE_CUSTOM_TTYPENAME:

     class MyClass { ... };
     DECLARE_CUSTOM_TTYPENAME(MyClass)
     cout << TTypeName<MyClass>::get() << endl;                          // "MyClass"

The following types are NOT ALLOWED since they have platform-dependant sizes:

#include <mrpt/utils/CSerializable.h>

List of all members.

Static Public Member Functions

static std::string get ()

Member Function Documentation

static std::string mrpt::utils::TTypeName::get ( ) [inline, static]

Definition at line 171 of file CSerializable.h.




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011