template struct mrpt::typemeta::TEnumType

Overview

A helper class that can convert an enum value into its textual representation, and viceversa.

#include <mrpt/typemeta/TEnumType.h>

template <typename ENUMTYPE>
struct TEnumType
{
    // methods

    static ENUMTYPE name2value(const std::string& name);
    static std::string value2name(const ENUMTYPE val);
    static internal::bimap<ENUMTYPE, std::string>& getBimap();
};

Methods

static ENUMTYPE name2value(const std::string& name)

Gives the numerical name for a given enum text name.

Parameters:

std::exception

on unknown enum name

static std::string value2name(const ENUMTYPE val)

Gives the textual name for a given enum value.

Parameters:

std::exception

on unknown enum value name

static internal::bimap<ENUMTYPE, std::string>& getBimap()

Singleton access.