Open Inventor Reference
SoMFEnum Class Reference

Multiple-value field containing any number of enumerated type values. More...

#include <Inventor/fields/SoMFEnum.h>

Inheritance diagram for SoMFEnum:
SoMField SoField SoMFBitMask

Public Member Functions

void setValue (const SbName &name)
 Sets this field to contain one and only one value, which is the mnemonic name as a string.
 
void set1Value (int index, const SbName &name)
 Sets the index'th value to be the integer corresponding to the mnemonic name in the given string.
 
void setEnums (int num, int *vals, SbName *names)
 Sets up value/name correspondances.
 
- Public Member Functions inherited from SoMField
virtual ~SoMField ()
 Destructor.
 
int getNum () const
 Returns the number of values currently in the field.
 
void setNum (int num)
 Forces this field to have exactly num values, inserting or deleting values as necessary.
 
virtual void deleteValues (int start, int num=-1)
 Deletes num values beginning at index start (index start through start+num-1 will be deleted, and any leftover values will be moved down to fill in the gap created).
 
virtual void insertSpace (int start, int num)
 Inserts space for num values at index start.
 
bool set1 (int index, const char *valueString)
 This is equivalent to the set() method of SoField, but operates on only one value.
 
void get1 (int index, SbString &valueString)
 This is equivalent to the get() method of SoField, but operates on only one value.
 
- Public Member Functions inherited from SoField
virtual ~SoField ()
 Destructor.
 
void setIgnored (bool ig)
 Sets the ignore flag for this field.
 
bool isIgnored () const
 Gets the ignore flag for this field.
 
bool isDefault () const
 Gets the state of default flag of the field.
 
virtual SoType getTypeId () const =0
 Return the type identifier for this field instance (SoField *).
 
bool isOfType (SoType type) const
 Returns TRUE if this field is the given type or derived from that type.
 
void enableConnection (bool flag)
 Field connections may be enabled and disabled.
 
bool isConnectionEnabled () const
 Returns FALSE if connections to this field are disabled.
 
bool connectFrom (SoEngineOutput *engineOutput)
 Connects the field to the given output of an engine or to another field.
 
bool connectFrom (SoField *field)
 
void disconnect ()
 Disconnect the field from whatever it was connected to.
 
bool isConnected () const
 Returns TRUE if the field is connected to anything.
 
bool isConnectedFromEngine () const
 Returns TRUE if the field is connected to an engine's output.
 
bool isConnectedFromField () const
 Returns TRUE if the field is connected to another field.
 
bool getConnectedEngine (SoEngineOutput *&engineOutput) const
 Returns TRUE if this field is being written into by an engine, and returns the engine output it is connected to in engineOutput.
 
bool getConnectedField (SoField *&field) const
 Returns TRUE if this field is being written into by another field, and returns the field it is connected to in writingField.
 
int getForwardConnections (SoFieldList &list) const
 Adds pointers to all of the fields that this field is writing into (either fields in nodes, global fields or engine inputs) to the given field list, and returns the number of forward connections.
 
SoFieldContainergetContainer () const
 Returns the containing node or engine.
 
bool set (const char *valueString)
 Sets the field to the given value, which is an ASCII string in the Inventor file format.
 
void get (SbString &valueString)
 Returns the value of the field in the Inventor file format, even if the field has its default value.
 
virtual void touch ()
 Simulates a change to the field, causing attached sensors to fire, connected fields and engines to be marked as needing evaluation, and so forth.
 
bool operator== (const SoField &f) const
 Return TRUE (FALSE) if this field is of the same type and has the same value as f.
 
bool operator!= (const SoField &f) const
 Return TRUE (FALSE) if this field is of the same type and has the same value as f.
 
void setDefault (bool def)
 Sets default flag.
 
virtual void startNotify ()
 Initiates or propagates notification through container.
 
virtual void notify (SoNotList *list)
 
void setContainer (SoFieldContainer *cont)
 Sets the containing node.
 
bool shouldWrite () const
 Returns TRUE if the field really needs to be written out.
 
void addAuditor (void *auditor, SoNotRec::Type type)
 Adds/removes an auditor to/from list.
 
void removeAuditor (void *auditor, SoNotRec::Type type)
 
bool enableNotify (bool flag)
 Indicates whether notification will propagate as the result of setting the field value.
 
bool isNotifyEnabled () const
 
bool enableContainerNotify (bool flag)
 Indicates whether notification will propagate to the SoFieldContainer that owns the field.
 
bool isContainerNotifyEnabled () const
 
virtual void connectionStatusChanged (int numConnections)
 Indicates to a field that a change has been made involving a connection from it (as source) to another field.
 
bool isReadOnly () const
 If this returns TRUE, it means we're in the middle of doing a setValue()+valueChanged() and values from an upstream connection shouldn't write into this field.
 
virtual bool isSame (const SoField &f) const =0
 Returns TRUE if the given field is of the same type and has the same value(s) as this.
 
virtual void copyFrom (const SoField &f)=0
 Copies the value from one field to another, assuming same subclass.
 
virtual void fixCopy (bool copyConnections)
 After a field value has been copied using copyFrom(), this is called to allow fields to update the copy.
 
virtual bool referencesCopy () const
 This returns TRUE if this field contains a reference to a node or engine that is copied during a copy operation (i.e., it is "inside").
 
void copyConnection (const SoField *fromField)
 Copies connection from one field to another.
 
virtual bool read (SoInput *in, const SbName &name)
 Reads value of field (with given name) from file as defined by SoInput.
 
virtual void write (SoOutput *out, const SbName &name) const
 Writes field (with given name) to file as defined by SoOutput.
 
virtual void countWriteRefs (SoOutput *out) const
 Counts write-references on field to prepare for writing.
 
void evaluate () const
 Evaluates the field from whatever it's connected to.
 

Static Public Member Functions

static void initClass ()
 
- Static Public Member Functions inherited from SoMField
static SoType getClassTypeId ()
 Return the type identifier for this field class.
 
static void initClass ()
 
static void * createInstance ()
 
- Static Public Member Functions inherited from SoField
static SoType getClassTypeId ()
 Return the type identifier for this field class.
 
static void initClass ()
 
static void initClasses ()
 Initialize ALL Inventor node classes.
 

Protected Member Functions

virtual bool findEnumValue (const SbName &name, int &val)
 Looks up enum name, returns value. Returns FALSE if not found.
 
virtual bool findEnumName (int val, const SbName *&name) const
 Looks up enum value, returns ptr to name. Returns FALSE if not found.
 
- Protected Member Functions inherited from SoMField
 SoMField ()
 Constructor.
 
virtual void makeRoom (int newNum)
 Make sure there is room for newNum vals.
 
- Protected Member Functions inherited from SoField
 SoField ()
 Constuctor:
 
void valueChanged (bool resetDefault=TRUE)
 Called by an instance to indicate that a value has changed.
 
virtual void evaluateConnection () const
 Evaluates the field or engine the field is connected to, storing the result in the field.
 
virtual bool readValue (SoInput *in)=0
 Reads value(s) of field.
 
virtual bool readConnection (SoInput *in)
 Reads connection.
 
virtual void writeValue (SoOutput *out) const =0
 Writes value(s) of field.
 
virtual void writeConnection (SoOutput *out) const
 Writes field connection.
 

Protected Attributes

bool legalValuesSet
 TRUE if setEnums called.
 
int numEnums
 Number of enumeration values.
 
int * enumValues
 Enumeration values.
 
SbNameenumNames
 Mnemonic names of values.
 
- Protected Attributes inherited from SoMField
int num
 Number of values.
 
int maxNum
 Number of values allocated.
 

Detailed Description

A multiple-value field that contains any number of enumerated type values, stored as ints. Nodes that use this field class define mnemonic names for values. These names should be used when setting or testing the values of the field, even though the values are treated as integers in the methods.

SoMFEnums are written to file as a set of mnemonic enumerated type names. These names differ among uses of this field in various node classes. See the reference pages for specific nodes for the names.

When more than one value is present, all of the values are enclosed in square brackets and separated by commas.

Definition at line 93 of file SoMFEnum.h.

Member Function Documentation

◆ findEnumName()

virtual bool SoMFEnum::findEnumName ( int  val,
const SbName *&  name 
) const
protectedvirtual

◆ findEnumValue()

virtual bool SoMFEnum::findEnumValue ( const SbName name,
int &  val 
)
protectedvirtual

Reimplemented in SoMFBitMask.

◆ initClass()

static void SoMFEnum::initClass ( )
static

◆ set1Value()

void SoMFEnum::set1Value ( int  index,
const SbName name 
)

◆ setEnums()

void SoMFEnum::setEnums ( int  num,
int *  vals,
SbName names 
)

◆ setValue()

void SoMFEnum::setValue ( const SbName name)

Member Data Documentation

◆ enumNames

SbName* SoMFEnum::enumNames
protected

Definition at line 119 of file SoMFEnum.h.

◆ enumValues

int* SoMFEnum::enumValues
protected

Definition at line 118 of file SoMFEnum.h.

◆ legalValuesSet

bool SoMFEnum::legalValuesSet
protected

Definition at line 116 of file SoMFEnum.h.

◆ numEnums

int SoMFEnum::numEnums
protected

Definition at line 117 of file SoMFEnum.h.


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