Coin3D is Free Software, published under the BSD 3-clause license. |
https://bitbucket.org/Coin3D/ http://www.kongsberg.com/kogt/ |
The SoFieldContainer class is a base class for all classes that contain fields. More...
#include <Inventor/fields/SoFieldContainer.h>
Public Member Functions | |
void | setToDefaults (void) |
SbBool | hasDefaultValues (void) const |
SbBool | fieldsAreEqual (const SoFieldContainer *container) const |
void | copyFieldValues (const SoFieldContainer *container, SbBool copyconnections=FALSE) |
SbBool | set (const char *const fielddata) |
void | get (SbString &fielddata) |
virtual int | getFields (SoFieldList &l) const |
virtual int | getAllFields (SoFieldList &l) const |
virtual SoField * | getField (const SbName &name) const |
virtual SoField * | getEventIn (const SbName &name) const |
virtual SoField * | getEventOut (const SbName &name) const |
SbBool | getFieldName (const SoField *const field, SbName &name) const |
SbBool | enableNotify (const SbBool flag) |
SbBool | isNotifyEnabled (void) const |
SbBool | set (const char *fielddata, SoInput *input) |
void | get (SbString &fielddata, SoOutput *out) |
virtual void | notify (SoNotList *l) |
virtual SbBool | validateNewFieldValue (SoField *field, void *newval) |
virtual void | addWriteReference (SoOutput *out, SbBool isfromfield=FALSE) |
virtual void | writeInstance (SoOutput *out) |
SbBool | getIsBuiltIn (void) const |
virtual const SoFieldData * | getFieldData (void) const |
virtual void | copyContents (const SoFieldContainer *from, SbBool copyconnections) |
virtual SoFieldContainer * | copyThroughConnection (void) const |
virtual void | getFieldsMemorySize (size_t &managed, size_t &unmanaged) const |
void | setUserData (void *userdata) const |
void * | getUserData (void) const |
Public Member Functions inherited from SoBase | |
void | ref (void) const |
void | unref (void) const |
void | unrefNoDelete (void) const |
int32_t | getRefCount (void) const |
void | touch (void) |
virtual SoType | getTypeId (void) const =0 |
Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and "downward" casting. More... | |
SbBool | isOfType (SoType type) const |
Returns TRUE if the type of this object is either of the same type or inherited from type. More... | |
virtual SbName | getName (void) const |
virtual void | setName (const SbName &newname) |
virtual void | startNotify (void) |
void | addAuditor (void *const auditor, const SoNotRec::Type type) |
void | removeAuditor (void *const auditor, const SoNotRec::Type type) |
const SoAuditorList & | getAuditors (void) const |
SbBool | shouldWrite (void) |
void | assertAlive (void) const |
Static Public Member Functions | |
static void | initClass (void) |
static SoType | getClassTypeId (void) |
static void | cleanupClass (void) |
static void | initCopyDict (void) |
static void | addCopy (const SoFieldContainer *orig, const SoFieldContainer *copy) |
static SoFieldContainer * | checkCopy (const SoFieldContainer *orig) |
static SoFieldContainer * | findCopy (const SoFieldContainer *orig, const SbBool copyconnections) |
static void | copyDone (void) |
Static Public Member Functions inherited from SoBase | |
static void | initClass (void) |
Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system. | |
static SoType | getClassTypeId (void) |
This static method returns the SoType object associated with objects of this class. | |
static void | addName (SoBase *const base, const char *const name) |
static void | removeName (SoBase *const base, const char *const name) |
static void | incrementCurrentWriteCounter (void) |
static void | decrementCurrentWriteCounter (void) |
static SoBase * | getNamedBase (const SbName &name, SoType type) |
static int | getNamedBases (const SbName &name, SoBaseList &baselist, SoType type) |
static SbBool | read (SoInput *input, SoBase *&base, SoType expectedtype) |
static void | setInstancePrefix (const SbString &c) |
static void | setTraceRefs (SbBool trace) |
static SbBool | getTraceRefs (void) |
static SbBool | connectRoute (SoInput *input, const SbName &fromnodename, const SbName &fromfieldname, const SbName &tonodename, const SbName &tofieldname) |
static SbBool | readRoute (SoInput *input) |
Protected Member Functions | |
SoFieldContainer (void) | |
virtual | ~SoFieldContainer () |
virtual SbBool | readInstance (SoInput *in, unsigned short flags) |
Protected Member Functions inherited from SoBase | |
SoBase (void) | |
virtual | ~SoBase () |
virtual void | destroy (void) |
SbBool | hasMultipleWriteRefs (void) const |
SbBool | writeHeader (SoOutput *out, SbBool isgroup, SbBool isengine) const |
void | writeFooter (SoOutput *out) const |
virtual const char * | getFileFormatName (void) const |
virtual SoNotRec | createNotRec (void) |
Protected Attributes | |
SbBool | isBuiltIn |
Additional Inherited Members | |
Protected Types inherited from SoBase | |
enum | BaseFlags { IS_ENGINE = 0x01, IS_GROUP = 0x02 } |
Static Protected Member Functions inherited from SoBase | |
static uint32_t | getCurrentWriteCounter (void) |
static void | staticDataLock (void) |
static void | staticDataUnlock (void) |
The SoFieldContainer class is a base class for all classes that contain fields.
The classes containing fields in Coin are the node and engine classes, so they are all subclasses of SoFieldContainer.
SoFieldContainer provides methods for reading, writing, comparing for equality, doing copy operations, etc on fields.
|
protected |
Constructor.
|
protectedvirtual |
Destructor.
void SoFieldContainer::setToDefaults | ( | void | ) |
This method sets all fields which we are parenting to their respective default values.
SbBool SoFieldContainer::hasDefaultValues | ( | void | ) | const |
This method checks to see if the fields of this container have their default values, and returns TRUE
if that is the case.
SbBool SoFieldContainer::fieldsAreEqual | ( | const SoFieldContainer * | container | ) | const |
This method returns TRUE
if the values of the fields of this and container are equal.
void SoFieldContainer::copyFieldValues | ( | const SoFieldContainer * | container, |
SbBool | copyconnections = FALSE |
||
) |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
This method copies the field values from container into this. The fields are assumed to be of the same type. The copyconnections flag decides whether the field connections are to be copied aswell.
SbBool SoFieldContainer::set | ( | const char *const | fielddata | ) |
This method parses the values of one or more fields from the fielddata string.
The fields must be in the same format as the Open Inventor file format. TRUE
is returned upon success, and FALSE
otherwise.
void SoFieldContainer::get | ( | SbString & | fielddata | ) |
This methods stores the field data in the given fielddata string. The format of the returned string follows the Open Inventor file format.
|
virtual |
This method adds the fields in this container to the l argument, and returns the number of fields added.
The virtual nature of this function means that it can be overridden to e.g. hide private fields.
|
virtual |
Returns VRML eventIn and eventOut fields in addition to the "ordinary" fields.
This method returns a pointer to the field with name, or NULL
if no such field exists.
This method returns a pointer to the eventIn with name name, or NULL
if no such eventIn exists.
This method returns a pointer to the eventOut with name name, or NULL
if no such eventOut exists.
Finds the name of the given field and returns the value in the name argument.
TRUE
is returned if the field is contained within this instance, and FALSE
otherwise.
SbBool SoFieldContainer::enableNotify | ( | const SbBool | enable | ) |
This method sets whether notification will be propagated on changing the values of the contained fields. The old value of the flag is returned.
Notification is default on. Turning off automatic notification can be useful for optimizing performance. During series of updates you may want to avoid the propagation of notifications upon every field value change if you make a lot of them. This is how you should handle those cases:
SbBool SoFieldContainer::isNotifyEnabled | ( | void | ) | const |
This method returns whether notification of changes to the field values in the container is propagated to its auditors.
SbBool SoFieldContainer::set | ( | const char * | fielddata, |
SoInput * | in | ||
) |
This method parses the values of one or more fields from the fielddata string.
The fields must be in the same format as the Open Inventor file format. TRUE
is returned upon success, and FALSE
otherwise.
We use the reference dictionary provided by in.
Put names and values of fields from this instance in the fielddata string. Fields will be separated in the returned string by end-of-line characters.
We use the reference dictionary provided by out.
|
virtual |
Notifies all auditors for this instance when changes are made.
Reimplemented from SoBase.
Reimplemented in SoNode, SoSceneTexture2, SoVRMLSwitch, SoVRMLLOD, SoProfilerStats, SoSceneTextureCubeMap, SoTextureCubeMap, SoText3, SoTexture2, SoImage, SoVRMLGroup, SoTexture3, SoVRMLParent, SoVertexProperty, SoVRMLTransform, SoVRMLVertexShape, SoVRMLElevationGrid, SoShadowGroup, SoVRMLShape, SoAsciiText, SoSeparator, SoVRMLScript, SoBumpMap, SoVRMLProximitySensor, SoVRMLExtrusion, SoVRMLBillboard, SoSwitch, SoVRMLText, SoLOD, SoMaterial, SoShape, SoVertexAttribute, SoVRMLTouchSensor, SoVRMLAppearance, SoVRMLIndexedLine, SoVRMLPixelTexture, SoLevelOfDetail, SoVRMLIndexedLineSet, SoEngine, SoVRMLCollision, SoVRMLTimeSensor, SoVRMLVertexPoint, SoBlinker, SoIndexedLineSet, SoPackedColor, SoVertexShape, SoVRMLGeometry, SoVRMLVertexLine, SoVRMLIndexedShape, SoNodeEngine, and SoIndexedPointSet.
|
virtual |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
I can't make head or tails of this method, it seems to return TRUE no matter what the arguments are.
|
virtual |
|
virtual |
Writes all the fields contained in this instance to the output stream within out.
This method is solely called from the write methods of fields.
Either from SoField if the write is done because of a field-to-field connection, or from one of the fields which may actually write SoFieldContainer instances, i.e. SoSFNode, SoMFNode, SoSFEngine, SoMFEngine, SoSFPath and SoMFPath.
This method, in addition to the ordinary write() method of SoNode, needs to be present since the fields don't have a write action instance in their writeValue() method, and writeInstance() will create a new SoWriteAction and call continueToApply() on it.
Reimplemented in SoNode, SoTimeCounter, SoEngine, SoElapsedTime, and SoNodeEngine.
SbBool SoFieldContainer::getIsBuiltIn | ( | void | ) | const |
Returns TRUE
if this object is instantiated from one of the native Coin classes, FALSE
if the object's class is outside the standard Coin library.
|
virtual |
Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL
.
Reimplemented in SoShaderStateMatrixParameter, SoShaderParameterMatrixArray, SoShaderParameterMatrix, SoShaderParameterArray4i, SoShaderParameterArray4f, SoShaderParameterArray3i, SoShaderParameterArray3f, SoShaderParameterArray2i, SoShaderParameterArray2f, SoShaderParameterArray1i, SoShaderParameterArray1f, SoShaderParameter4i, SoShaderParameter4f, SoShaderParameter3i, SoShaderParameter3f, SoShaderParameter2i, SoShaderParameter2f, SoShaderParameter1i, SoShaderParameter1f, SoUniformShaderParameter, SoExtSelection, SoShaderParameter, SoBaseKit, SoDragger, SoCamera, SoWWWInline, SoVRMLInline, SoVRMLSwitch, SoEventCallback, SoShape, SoNodeVisualize, SoTrackballDragger, SoDirectionalLightManip, SoProtoInstance, SoVRMLElevationGrid, SoVRMLFontStyle, SoSpotLightManip, SoInteractionKit, SoSelection, SoVertexShape, SoSTLFileKit, SoProfilerTopEngine, SoScrollingGraphKit, SoComposeMatrix, SoClipPlaneManip, SoPointLightManip, SoTransformManip, SoShaderObject, SoShaderProgram, SoTexture2, SoWWWAnchor, SoVRMLAudioClip, SoVRMLImageTexture, SoVRMLVertexShape, SoComposeRotation, SoComposeRotationFromTo, SoComposeVec2f, SoComposeVec3f, SoComposeVec4f, SoTexture3, SoTextureCubeMap, SoVRMLAnchor, SoVRMLIndexedFaceSet, SoVRMLMovieTexture, SoVRMLViewpoint, SoProfilerStats, SoRotateSphericalDragger, SoSpotLightDragger, SoTransformerDragger, SoDecomposeMatrix, SoDecomposeVec2f, SoDecomposeVec3f, SoDecomposeVec4f, SoImage, SoSceneTexture2, SoSceneTextureCubeMap, SoText3, SoVRMLDragSensor, SoVRMLSound, SoHandleBoxDragger, SoScale2UniformDragger, SoTabPlaneDragger, SoTranslate1Dragger, SoTranslate2Dragger, SoDecomposeRotation, SoBumpMap, SoGeoCoordinate, SoGeoSeparator, SoPendulum, SoRotor, SoShuttle, SoSwitch, SoVertexProperty, SoVRMLBackground, SoVRMLBillboard, SoVRMLFog, SoVRMLIndexedLineSet, SoVRMLNavigationInfo, SoVRMLText, SoVRMLTimeSensor, SoShadowGroup, SoForeignFileKit, SoCenterballDragger, SoDirectionalLightDragger, SoJackDragger, SoRotateCylindricalDragger, SoRotateDiscDragger, SoScale1Dragger, SoScale2Dragger, SoScaleUniformDragger, SoTransformBoxDragger, SoCalculator, SoComputeBoundingBox, SoNodeKitListPart, SoCacheHint, SoFontStyle, SoGeoLocation, SoIndexedFaceSet, SoIndexedLineSet, SoIndexedTriangleStripSet, SoVRMLCollision, SoVRMLExtrusion, SoVRMLGroup, SoVRMLLOD, SoVRMLPositionInterpolator, SoProfilerTopKit, SoProfilerVisualizeKit, SoDragPointDragger, SoPointLightDragger, SoTabBoxDragger, SoElapsedTime, SoGate, SoOneShot, SoTimeCounter, SoAsciiText, SoIndexedNurbsCurve, SoIndexedNurbsSurface, SoLocateHighlight, SoMaterial, SoProfile, SoRotationXYZ, SoSeparator, SoTexture3Transform, SoTextureCoordinatePlane, SoVRMLColorInterpolator, SoVRMLMaterial, SoVRMLOrientationInterpolator, SoVRMLParent, SoVRMLProximitySensor, SoVRMLSphereSensor, SoVRMLTextureTransform, SoSelectOne, SoBlinker, SoDrawStyle, SoEnvironment, SoFile, SoGeoOrigin, SoIndexedPointSet, SoLOD, SoListener, SoNurbsCurve, SoNurbsSurface, SoSurroundScale, SoTextureCombine, SoTextureCoordinateReflectionMap, SoTransform, SoVRMLAppearance, SoVRMLColor, SoVRMLCoordinate, SoVRMLCoordinateInterpolator, SoVRMLInterpolator, SoVRMLLight, SoVRMLNormal, SoVRMLNormalInterpolator, SoVRMLPixelTexture, SoVRMLShape, SoVRMLTextureCoordinate, SoVRMLTouchSensor, SoVRMLVertexPoint, SoVRMLVisibilitySensor, SoShadowDirectionalLight, SoShadowSpotLight, SoBoolOperation, SoCounter, SoAntiSquish, SoArray, SoBumpMapTransform, SoCube, SoDepthBuffer, SoFaceSet, SoIndexedMarkerSet, SoIndexedShape, SoLevelOfDetail, SoNormal, SoPolygonOffset, SoShapeHints, SoText2, SoTexture2Transform, SoTextureCoordinateNormalMap, SoVRMLCone, SoVRMLCylinder, SoVRMLCylinderSensor, SoVRMLGeometry, SoVRMLPlaneSensor, SoVRMLPointLight, SoVRMLScalarInterpolator, SoVRMLSpotLight, SoVRMLTransform, SoVRMLVertexLine, SoVRMLWorldInfo, SoConcatenate, SoHeightMapToNormalMap, SoOnOff, SoTransformVec3f, SoTriggerAny, SoCenterballManip, SoHandleBoxManip, SoJackManip, SoTabBoxManip, SoTrackballManip, SoTransformBoxManip, SoTransformerManip, SoBaseColor, SoComplexity, SoCone, SoCoordinate3, SoCoordinate4, SoCylinder, SoGeometryShader, SoLight, SoNonIndexedShape, SoNurbsProfile, SoPackedColor, SoSpotLight, SoTextureCoordinate3, SoVRMLBox, SoVRMLDirectionalLight, SoVRMLIndexedLine, SoVRMLIndexedShape, SoVRMLPointSet, SoVRMLSphere, SoVRMLTexture, SoShadowCulling, SoShadowStyle, SoFieldConverter, SoInterpolate, SoTexture2Convert, SoSeparatorKit, SoAlphaTest, SoCallback, SoClipPlane, SoDirectionalLight, SoFont, SoFrustumCamera, SoGroup, SoLightModel, SoLineSet, SoMarkerSet, SoMaterialBinding, SoMatrixTransform, SoMultipleCopy, SoNormalBinding, SoPathSwitch, SoPickStyle, SoPointLight, SoPointSet, SoQuadMesh, SoResetTransform, SoRotation, SoScale, SoSphere, SoTextureCoordinate2, SoTextureCoordinateBinding, SoTextureCoordinateEnvironment, SoTextureCoordinateObject, SoTextureScalePolicy, SoTextureUnit, SoTranslation, SoTransparencyType, SoTriangleStripSet, SoUnits, SoVertexAttributeBinding, SoVRMLSensor, SoAppearanceKit, SoCameraKit, SoLightKit, SoSceneKit, SoAnnotation, SoBumpMapCoordinate, SoColorIndex, SoFragmentShader, SoInfo, SoLabel, SoLinearProfile, SoOrthographicCamera, SoPerspectiveCamera, SoProfileCoordinate2, SoProfileCoordinate3, SoReversePerspectiveCamera, SoTextureCoordinateDefault, SoTextureMatrixTransform, SoTransformSeparator, SoInterpolateFloat, SoInterpolateRotation, SoInterpolateVec2f, SoInterpolateVec3f, SoInterpolateVec4f, SoShapeKit, SoWrapperKit, SoTextureCoordinateCube, SoTextureCoordinateCylinder, SoTextureCoordinateFunction, SoTextureCoordinateSphere, SoTransformation, SoTexture, SoVertexShader, and SoProfilerOverlayKit.
|
virtual |
Makes a deep copy of all data of from into this instance, except external scenegraph references if copyconnections is FALSE
.
This is the method that should be overridden by extension node / engine / dragger / whatever subclasses which needs to account for internal data that are not handled automatically.
For copying nodes from application code, you should not invoke this function directly, but rather call the SoNode::copy() function:
The same also goes for engines.
Make sure that when you override the copyContents() method in your extension class that you also make it call upwards to it's parent superclass in the inheritance hierarchy, as copyContents() in for instance SoNode and SoFieldContainer does important work. It should go something like this:
Reimplemented in SoNode, SoWWWInline, SoBaseKit, SoVRMLSwitch, SoVRMLLOD, SoInteractionKit, SoNodeKitListPart, SoVRMLParent, SoClipPlaneManip, SoGroup, SoDirectionalLightManip, SoVRMLShape, SoSpotLightManip, SoPointLightManip, SoTransformManip, SoVRMLScript, SoRotateSphericalDragger, SoRotateCylindricalDragger, SoFile, SoCallback, SoVertexAttribute, SoVRMLAppearance, and SoVRMLGeometry.
|
virtual |
|
static |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Initialize a dictionary hash storing pointers for original fieldcontainer instances and their copies during scene graph copy operations.
This method is called from the start of SoNode::copy().
|
static |
Add a pair of pointers to an original fieldcontainer and a copy of it to an internal pointer dictionary used during scene graph copy operations.
|
static |
Returns the copy of orig, if any. If no copy exists, we return a NULL
pointer.
|
static |
Returns a copy of orig.
If no copy has been made earlier when the function is called, a copy is made on-the-fly (which is the reason we need to pass along the copyconnections flag).
This method will also run the copyContents() method on the copy, if it hasn't been run already. Note that if you call copyContents() on the copy outside of this method, this will go undetected and the guts of orig will be copied multiple times into its copy.
If copyContents() is called directly (instead of using copy()), it's assumed that the user only wants to copy the field values, and we just return NULL here. This is done to match how it's done in SGI Inventor.
|
static |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Clean up the dictionary hash.
This method is called from the end of SoNode::copy().
|
virtual |
Returns the data array sizes of the SoFieldData-registered multi-fields. The managed argument returns the size of the fields that Coin manages the memory for, and the unmanaged argument returns the size of the data in the multi-fields controlled by the application through SoMField::setValuesPointer() which Coin will not delete.
Data that is kept in the object memory chunk (that is included when you do sizeof(object)) is not included in these values - only the memory that is managed in addtional memory chunks from the object chunk is returned.
Extension field types that are not known to the plain Coin library are not accounted for. This function is therefore virtual, so such extension field types can be added to the numbers for extension nodes.
This method is used for memory profiling purposes.
void SoFieldContainer::setUserData | ( | void * | userdata | ) | const |
Set a generic user data pointer for this field container.
This function can be used by the application programmer to, for instance, store a pointer to an application specific data structure that is in some way related to the field container. getUserData() can later be used to retrieve the pointer.
void * SoFieldContainer::getUserData | ( | void | ) | const |
Return the generic user data pointer for this field container, or NULL if no user data has been set.
|
protectedvirtual |
This method is mainly intended for internal use during file import operations.
It reads a definition of an instance from the input stream in. The input stream state points to the start of a serialized / persistant representation of an instance of this class type.
TRUE
or FALSE
is returned, depending on if the instantiation and configuration of the new object of this class type went ok or not. The import process should be robust and handle corrupted input streams by returning FALSE
.
flags is used internally during binary import when reading user extension nodes, group nodes or engines.
Implements SoBase.
Reimplemented in SoNode, SoBaseKit, SoWWWInline, SoVRMLSwitch, SoVRMLLOD, SoInteractionKit, SoTextureCubeMap, SoNodeKitListPart, SoSeparator, SoTexture2, SoVRMLParent, SoImage, SoTexture3, SoShaderObject, SoProto, SoGroup, SoFile, SoVRMLImageTexture, SoEngine, SoProtoInstance, SoNormalBinding, SoBumpMap, SoVertexAttribute, SoTextureCoordinateBinding, SoVRMLBackground, SoNodeEngine, and SoVRMLPixelTexture.
|
protected |
Flag for storing whether or not this class instance is a built-in class or not. By knowing the difference between a class which is native Coin or a user extension, it is possible to automatically store and read extension nodes and engines.