HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TfPyWrapEnum< T, IsScopedEnum > Class Template Reference

#include <pyEnum.h>

Public Member Functions

 TfPyWrapEnum (std::string const &name=std::string())
 

Detailed Description

template<typename T, bool IsScopedEnum = !std::is_convertible<T, int>::value>
class TfPyWrapEnum< T, IsScopedEnum >

Used to wrap enum types for script.

TfPyWrapEnum provides a way to wrap enums for python, tying in with the TfEnum system, and potentially providing automatic wrapping by using names registered with the TfEnum system and by making some assumptions about the way we structure our code. Enums that are not registered with TfEnum may be manually wrapped using hboost::python::enum_ instead.

Example usage. For an enum that looks like this:

enum FooChoices {
FooFirst,
FooSecond,
FooThird
};

Which has been registered in the TfEnum system and has names provided for all values, it may be wrapped like this:

The enum will appear in script as Foo.Choices.{First, Second, Third} and the values will also appear as Foo.{First, Second, Third}.

An enum may be given an explicit name by passing a string to TfPyWrapEnum's constructor.

If the enum is a C++11 scoped enum (aka enum class), the values will appear as Foo.Choices.{First, Second, Third} in the following example:

enum class FooChoices {
First,
Second,
Third
};

Definition at line 380 of file pyEnum.h.

Constructor & Destructor Documentation

template<typename T , bool IsScopedEnum = !std::is_convertible<T, int>::value>
TfPyWrapEnum< T, IsScopedEnum >::TfPyWrapEnum ( std::string const &  name = std::string())
inlineexplicit

Construct an enum wrapper object. If name is provided, it is used as the name of the enum. Otherwise the type name of T is used, with a leading MFB package name stripped.

Definition at line 393 of file pyEnum.h.


The documentation for this class was generated from the following file: