IECore::Enum Namespace Reference


Functions

def create
 Creates a new class which provides enum-like functionality.

Variables

 __value

Function Documentation

def IECore::Enum::create (   names  ) 

Creates a new class which provides enum-like functionality.

The class has an attribute for each name passed, whose value is the instance of the Enum for that name. Enum instances hold an integer value which can be retrieved using int( e ), and the name that value signifies can be retrieved using str( e ). Enum instances can be compared for equality and hashed to allow their use in dictionaries etc.

For example :

> E = IECore.Enum.create( "Apple", "Orange" ) > a = E.Apple > print a, int( a )

Apple, 0

assert( E.Orange == E( 1 ) ) assert( E.Orange != E.Apple )

Todo:
Add a classmethod to return a tuple of all values.


Variable Documentation


Generated on Mon Jan 24 11:13:28 2011 for Cortex by doxygen 1.5.8