Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoFieldContainer Class Reference

Abstract base class for objects that contain fields. More...

#include <Inventor/fields/SoFieldContainer.h>

+ Inheritance diagram for SoFieldContainer:

Public Member Functions

void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
virtual SoType getTypeId () const =0
 Returns the type identifier for a specific instance.
 
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Friends

class SoFieldContainerExt
 

Detailed Description

Abstract base class for objects that contain fields.

SoFieldContainer is the base class for engines and nodes. It contains methods for finding out what fields an object has, controlling notification, and for dealing with all of the fields of an object at once.

The fields of an engine are its inputs. Note that even though an engine's output corresponds to a specific type of field, an engine output is not a field.

SEE ALSO

SoSField, SoMField, SoNode, SoDB

Definition at line 94 of file SoFieldContainer.h.

Member Function Documentation

◆ copyFieldValues()

void SoFieldContainer::copyFieldValues ( const SoFieldContainer fc,
SbBool  copyConnections = FALSE 
)

Copies the contents of fc's fields into this object's fields.

fc must be the same type as this object. If copyConnections is TRUE, then if any of fc's fields are connected then this object's fields will also be connected to the same source.

◆ enableNotify()

SbBool SoFieldContainer::enableNotify ( SbBool  flag)
inline

Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).

The returned Boolean value indicates whether notification was enabled immediately prior to applying this method.

Definition at line 223 of file SoFieldContainer.h.

◆ fieldsAreEqual()

SbBool SoFieldContainer::fieldsAreEqual ( const SoFieldContainer fc) const

Returns TRUE if this object's fields are exactly equal to fc's fields.

If fc is not exactly same type as this object, FALSE is returned.

◆ get()

void SoFieldContainer::get ( SbString fieldDataString)
inline

Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.

Fields whose isDefault() bit is set will not be part of the string. You can use the SoField::get() method to get a field's value as a string even if has its default value.

Definition at line 174 of file SoFieldContainer.h.

◆ getAllFields()

virtual int SoFieldContainer::getAllFields ( SoFieldList list) const
virtual

Returns a list of fields, including the eventIn's and eventOut's.

◆ getClassTypeId()

static SoType SoFieldContainer::getClassTypeId ( )
static

Returns the type of this class.

◆ getEventIn()

virtual SoField * SoFieldContainer::getEventIn ( const SbName fieldName) const
virtual

Returns a the eventIn with the given name.

If no such eventIn exists, NULL is returned.

◆ getEventOut()

virtual SoField * SoFieldContainer::getEventOut ( const SbName fieldName) const
virtual

Returns the eventOut with the given name.

If no such eventOut exists, NULL is returned.

◆ getField()

virtual SoField * SoFieldContainer::getField ( const SbName fieldName) const
virtual

Returns a the field of this object whose name is fieldName.

Returns NULL if there is no field with the given name.

◆ getFieldName()

SbBool SoFieldContainer::getFieldName ( const SoField field,
SbName fieldName 
) const

Returns the name of the given field in the fieldName argument.

Returns FALSE if field is not a member of this object.

◆ getFields()

virtual int SoFieldContainer::getFields ( SoFieldList list) const
virtual

Appends references to all of this object's fields to resultList, and returns the number of fields appended.

The types of the fields can be determined using SoField::isOfType() and SoField::getTypeId(). The names of the fields can be determined by passing the field reference to the getFieldName() method (see below).

◆ getUserData()

void * SoFieldContainer::getUserData ( void  ) const
inline

Gets user application data.

Definition at line 267 of file SoFieldContainer.h.

◆ hasDefaultValues()

SbBool SoFieldContainer::hasDefaultValues ( ) const

Returns TRUE if all of the object's fields have their default values.

This will return TRUE even if a field's isDefault() method returns FALSE - for example, if a field's default value is 0.0 and you setValue(0.0) that field, the default flag will be set to FALSE (because it would be too slow to compare the field against its default value every time setValue is called). However, hasDefaultValues() would return TRUE in this case.

◆ isNotifyEnabled()

SbBool SoFieldContainer::isNotifyEnabled ( ) const
inline

Notification is the process of telling interested objects that this object has changed.

Notification is needed to make engines and sensors function, is used to keep SoPaths up to date when the scene graph's topology changes, and is also used to invalidate rendering or bounding box caches.

Notification is normally enabled, but can be disabled on a node by node (or engine by engine) basis. If you are making extensive changes to a large part of the scene graph then disabling notification can increase performance, at the expense of increased responsibility for making sure that any interested engines, sensors or paths are kept up to date.

For example, if you will be making a lot of changes to a small part of your scene graph and you know that there are no engines or sensors attached to nodes in that part of the scene graph, you might disable notification on the nodes you are changing, modify them, re-enable notification, and then touch() one of the nodes to cause a redraw.

However, you should profile your application and make sure that notification is taking a significant amount of time before going to the trouble of manually controlling notification.

Definition at line 248 of file SoFieldContainer.h.

◆ set() [1/2]

SoNONUNICODE SbBool SoFieldContainer::set ( const char *  fieldDataString)
inline

Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.

TRUE is returned if the string was valid Open Inventor file format.

For example, you could set the fields of an SoCube by doing:

SoCube* cube = new SoCube();
cube->set( "width 1.0 height 2.0 depth 3.2" );
Cube shape node.
Definition SoCube.h:123
SoNONUNICODE SbBool set(const char *fieldDataString)
Sets one or more fields in this object to the values specified in the given string,...

Non Unicode: This function should not be used in a Unicode application.

Definition at line 137 of file SoFieldContainer.h.

◆ set() [2/2]

SbBool SoFieldContainer::set ( const SbString fieldDataString)
inline

Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.

TRUE is returned if the string was valid Open Inventor file format.

For example, you could set the fields of an SoCube by doing:

SoCube* cube = new SoCube();
cube->set( "width 1.0 height 2.0 depth 3.2" );

Definition at line 165 of file SoFieldContainer.h.

◆ setToDefaults()

void SoFieldContainer::setToDefaults ( )

Sets all fields in this object to their default values.

◆ setUserData()

virtual void SoFieldContainer::setUserData ( void *  data)
inlinevirtual

Sets application data.

This method stores a single value of type void*, which is not used for any purpose by Open Inventor, but can be retrieved by the application. Applications can use this value to store, for example, physical properties, inventory tracking numbers, etc. with a node. Default is 0 (null pointer).

Definition at line 260 of file SoFieldContainer.h.

Friends And Related Symbol Documentation

◆ SoFieldContainerExt

friend class SoFieldContainerExt
friend

Definition at line 428 of file SoFieldContainer.h.


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