SoFieldData(3)

πŸ“¦ version 2.5.0, in fedora 43, fedora 44

πŸ’– NAME πŸ’–

SoFieldData β€” okay so bestie, this is, like, a container for a prototype set of fields. That's the whole assignment. πŸ’… (from the Library Functions Manual, section 3, in case you were wondering 🫢)


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <Inventor/fields/SoFieldData.h>

πŸ‘‘ Public Member Functions

  • SoFieldData (void)
  • SoFieldData (const SoFieldData &fd)
  • SoFieldData (const SoFieldData *fd)
  • SoFieldData (int numfields)
  • ~SoFieldData ()
  • void addField (SoFieldContainer *base, const char *name, const SoField *field)
  • void overlay (SoFieldContainer *to, const SoFieldContainer *from, SbBool copyconnections) const
  • int getNumFields (void) const
  • const SbName & getFieldName (int index) const
  • SoField * getField (const SoFieldContainer *object, int index) const
  • int getIndex (const SoFieldContainer *fc, const SoField *field) const
  • void addEnumValue (const char *enumname, const char *valuename, int value)
  • void getEnumData (const char *enumname, int &num, const int *&values, const SbName *&names)
  • SbBool read (SoInput *in, SoFieldContainer *object, SbBool erroronunknownfield, SbBool &notbuiltin) const
  • SbBool read (SoInput *in, SoFieldContainer *object, const SbName &fieldname, SbBool &foundname) const
  • void write (SoOutput *out, const SoFieldContainer *object) const
  • void copy (const SoFieldData *src)
  • SbBool isSame (const SoFieldContainer *c1, const SoFieldContainer *c2) const
  • SbBool readFieldDescriptions (SoInput *in, SoFieldContainer *object, int numdescriptionsexpected, const SbBool readfieldvalues=1) const
  • void writeFieldDescriptions (SoOutput *out, const SoFieldContainer *object) const

✨ DETAILED DESCRIPTION ✨

The SoFieldData class is a container for a prototype set of fields. No cap. πŸŽ€

This class gets instantiated once for each class of objects that use fields, and that needs to be able to import and export them. Like, one per class, that's the whole thing.

Each field of a class is stored with the name it has been given within its "owner" class, plus a pointer offset to the dynamic instance of the field itself. πŸ’«

Enumeration sets are stored with (name, value) pairs, so it's possible to address, read and save enum type fields by name. Slay.

Ngl, it is unlikely that application programmers should need to use any of the methods of this class directly. So if you're out here stressed about it, you can lowkey relax. πŸ™ˆ

🌸 See also 🌸

  • SoField
  • SoFieldContainer

πŸ’… CONSTRUCTOR & DESTRUCTOR DOCUMENTATION πŸ’…

SoFieldData::SoFieldData (void )

Default constructor. It's giving "no thoughts, just vibes." ✨

Referenced by copy(), isSame(), overlay(), readFieldDescriptions(), SoFieldData(), and SoFieldData().

SoFieldData::SoFieldData (const SoFieldData & fd)

Copy constructor. Twin energy. πŸ‘―β€β™€οΈ

References copy(), and SoFieldData().

SoFieldData::SoFieldData (const SoFieldData * fd)

Copy constructor that takes a pointer value as an argument. Handles NULL pointers by behaving like the default constructor β€” so if you hand it nothing, it just does the default thing. Iconic, honestly. 🫢

References copy(), and SoFieldData().

SoFieldData::SoFieldData (int numfields)

Constructor. Takes an indication on the number of fields which should be stored, so the memory handling stays efficient. Bestie said "plan ahead" and honestly? She ate. πŸ’…

SoFieldData::~SoFieldData ()

Destructor. πŸ¦‹

πŸ’… MEMBER FUNCTION DOCUMENTATION πŸ’…

okay bestie, this is the function-by-function part and it's long, but we're not skipping anything. no cap. πŸ’–


void SoFieldData::addField (SoFieldContainer * base, const char * name, const SoField * field)

Add a new field to our internal list. slay.

The name will be stored along with an pointer offset between base and field, which will be valid for all instances of the class type of base.

References: SoType::getName(), SbName::getString(), SoBase::getTypeId(), SoBase::isOfType(), and SoDebugError::postInfo().

Referenced by: readFieldDescriptions().


void SoFieldData::overlay (SoFieldContainer * to, const SoFieldContainer * from, SbBool copyconnections) const

Copy fields from container from to container to. If copyconnections is TRUE, we'll also copy the connections from has made. bestie, that's the whole vibe.

If you think the method signature is a bit strange, you're correct. This should really have been a static method (the owner this instance of the method isn't used at all, due to how the internal representation of field template list are stored), but for unknown reasons this is a dynamic method in Open Inventor. So also in Coin, to keep compatibility.

References: SoField::copyConnection(), SoField::copyFrom(), SoField::enableNotify(), SoField::fixCopy(), getField(), SoFieldContainer::getFieldData(), SoField::getFieldType(), getNumFields(), SoField::isDefault(), SoField::isIgnored(), SoField::isNotifyEnabled(), SoField::setDefault(), SoField::setFieldType(), SoField::setIgnored(), and SoFieldData().

Referenced by: SoFieldContainer::copyFieldValues(), and SoFieldContainer::setToDefaults().


int SoFieldData::getNumFields (void ) const

Returns number of fields contained within this instance. count 'em, bestie.

Referenced by: SoVRMLScript::copyContents(), SoFieldContainer::getAllFields(), SoFieldContainer::getField(), SoFieldContainer::getFields(), isSame(), overlay(), SoBaseKit::readInstance(), SoVRMLParent::updateChildList(), write(), SoVRMLScript::write(), and writeFieldDescriptions().


const SbName & SoFieldData::getFieldName (int index) const

Returns the name of the field at index. we love a direct lookup.

Referenced by: SoVRMLScript::copyContents(), SoFieldContainer::getField(), SoFieldContainer::getFieldName(), read(), SoBaseKit::readInstance(), write(), SoVRMLScript::write(), and writeFieldDescriptions().


SoField * SoFieldData::getField (const SoFieldContainer * object, int index) const

Returns a pointer to the field at index within the object instance. pointer reveal ✨.

Referenced by: SoVRMLScript::copyContents(), SoFieldContainer::getAllFields(), SoFieldContainer::getField(), SoFieldContainer::getFields(), isSame(), overlay(), read(), readFieldDescriptions(), SoBaseKit::readInstance(), SoVRMLParent::updateChildList(), write(), SoVRMLScript::write(), and writeFieldDescriptions().


int SoFieldData::getIndex (const SoFieldContainer * fc, const SoField * field) const

Returns the internal index value of field in fc. If field is not part of fc, returns -1. negative one is the friendzone of indexes.

References: SoField::getTypeId(), and SoBase::isOfType().

Referenced by: SoFieldContainer::getFieldName().


void SoFieldData::addEnumValue (const char * enumname, const char * valuename, int value)

Either adds a new enum set (with an initial member), or adds a new value member to an existing enum set. enum expansion, periodt.

References: SbList< Type >::append(), SbList< Type >::find(), and SoDebugError::postInfo().


void SoFieldData::getEnumData (const char * enumname, int & num, const int *& values, const SbName *& names)

Returns the names and values of enumeration entry with the enumname. The number of (name, value) pairs available in the enumeration is returned in num. data dump but make it cute.

References: SbList< Type >::getArrayPtr(), and SbList< Type >::getLength().


SbBool SoFieldData::read (SoInput * in, SoFieldContainer * object, SbBool erroronunknownfield, SbBool & notbuiltin) const

Read field data from the in stream for fields belonging to object. Returns TRUE if everything went ok, or FALSE if any error conditions occurs. if it breaks, it breaks loudly.

erroronunknownfield decides whether or not FALSE should be returned if a name identifier not recognized as a fieldname of object is encountered. Note that erroronunknownfield should be FALSE if object is a container with child objects, otherwise the code will fail upon the first child name specification.

If notbuiltin is TRUE on return, object is an unknown node or engine type. Unknown nodes are recognized by the fields keyword first in their file format definition, and unknown engines by the inputs keyword.

References: SoInput::addProto(), SoInput::checkISReference(), SoType::getName(), SbName::getString(), SoBase::getTypeId(), SoInput::isBinary(), SoInput::isFileVRML2(), SoReadError::post(), SoDebugError::postInfo(), SoDebugError::postWarning(), SoInput::putBack(), read(), SoInput::read(), readFieldDescriptions(), and SoBase::readRoute().

Referenced by: read(), SoFieldContainer::readInstance(), SoBaseKit::set(), SoBaseKit::set(), and SoFieldContainer::set().


SbBool SoFieldData::read (SoInput * in, SoFieldContainer * object, const SbName & fieldname, SbBool & foundname) const

Find field fieldname in object, and if it is available, set foundname to TRUE and try to read the field specification from in. If foundname is set to TRUE, the return value says whether or not the field specification could be read without any problems.

If fieldname is not part of object, returns FALSE with foundname also set to FALSE. no field, no problem, just false.

References: getField(), getFieldName(), and SoField::read().


void SoFieldData::write (SoOutput * out, const SoFieldContainer * object) const

Write to out field names and field values for the fields of object. serialization slay.

References: SoOutput::getCurrentProto(), getField(), getFieldName(), SoFieldContainer::getIsBuiltIn(), SbName::getLength(), getNumFields(), SoOutput::getStage(), SbName::getString(), SoOutput::indent(), SoOutput::isBinary(), SoField::shouldWrite(), SoField::write(), SoOutput::write(), and writeFieldDescriptions().

Referenced by: SoFieldContainer::addWriteReference(), SoFieldContainer::get(), SoGroup::write(), SoNode::write(), SoSwitch::write(), SoVRMLParent::write(), and SoFieldContainer::writeInstance().


void SoFieldData::copy (const SoFieldData * src)

Copy contents of src into this instance. copy paste but make it official.

If there was any data set up in this instance before the method was called, the old data is removed first.

Note that this only copies the field set template specification from src, not actual field contents. For copying field contents, see the SoFieldData::overlay() method.

References: SbList< Type >::getLength(), and SoFieldData().

Referenced by: SoFieldData(), and SoFieldData().


SbBool SoFieldData::isSame (const SoFieldContainer * c1, const SoFieldContainer * c2) const

Compares c1 and c2 to see if they have the same field data set and if the fields of c1 have the same values as the fields of c2. twin check ✨.

Field connections are not considered (i.e. we will return TRUE if the values of the fields of c1 are equal to the fields of c2, even if they differ in how they have made connections to other fields).

If you think the method signature is a bit strange, you're correct. This should really have been a static method (the owner this instance of the method isn't used at all, due to how the internal representations of field template lists are stored), but for unknown reasons this is a dynamic method in Open Inventor. So also in Coin, to keep compatibility.

References: getField(), SoFieldContainer::getFieldData(), getNumFields(), and SoFieldData().

Referenced by: SoFieldContainer::fieldsAreEqual(), and SoFieldContainer::hasDefaultValues().


SbBool SoFieldData::readFieldDescriptions (SoInput * in, SoFieldContainer * object, int numdescriptionsexpected, const SbBool readfieldvalues = 1) const

Reads a set of field specifications from in for an unknown nodeclass type, in the form "[ FIELDCLASS FIELDNAME, FIELDCLASS FIELDNAME, ... ]". mystery node? we read it anyway.

numdescriptionsexpected is used for binary format import to know how many descriptions should be parsed.

If readfieldvalues is TRUE (the default), the field initial value is expected after the field name in the SoInput stream.

References: addField(), SoType::badType(), SoType::canCreateInstance(), SoInput::checkISReference(), SoType::createInstance(), SoType::fromName(), SoField::getClassTypeId(), SoField::getContainer(), getField(), SoType::getName(), SbName::getString(), SbString::getString(), SoBase::getTypeId(), SoInput::isBinary(), SoType::isDerivedFrom(), SoReadError::post(), SoDebugError::postInfo(), SoInput::putBack(), SoField::read(), SoInput::read(), SoField::setContainer(), SoField::setDefault(), SoField::setFieldType(), SoFieldData(), and SbString::sprintf().

Referenced by: read().


void SoFieldData::writeFieldDescriptions (SoOutput * out, const SoFieldContainer * object) const

Write a set of field specifications to out for an unknown nodeclass type, in the form "[ FIELDCLASS FIELDNAME, FIELDCLASS FIELDNAME, ... ]". describe and write, bestie.

References: getField(), getFieldName(), SoType::getName(), getNumFields(), SoField::getTypeId(), SoOutput::indent(), SoOutput::isBinary(), and SoOutput::write().

Referenced by: write().


πŸ‘‘ AUTHOR πŸ‘‘

Generated automatically by Doxygen for Coin from the source code.


and that's the whole page, bestie πŸ’– it's auto-generated by Doxygen from the Coin source code, Coin Version 2.5.0, and yeah β€” it's the SoFieldData(3) manual. byeeee βœ¨πŸ¦‹

πŸ“¦ where this page comes from