SoFieldData(3)

πŸ“¦
version 4.0.10 Β· 4 versions
, in fedora 43, fedora 44

πŸ’– SoFieldData πŸ’–

okay bestie, you're reading the Coin manual page for SoFieldData(3) and honestly? it's giving backstage pass to the field system. this thing is a container for a prototype set of fields, and yeah it's lowkey internal, but let's get into it πŸŽ€


✨ NAME ✨

SoFieldData β€” the container for a prototype set of fields. that's the whole vibe. it holds the blueprint, not the actual field values, iykyk πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

first thing, you gotta pull in the header:

#include <Inventor/fields/SoFieldData.h>

🌸 Public Member Functions 🌸

here's the full roster, no skips, no cuts, we're listing everyone πŸ‘‘

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 *input, SoFieldContainer *object, SbBool erroronunknownfield, SbBool &notbuiltin) const
SbBool read (SoInput *input, 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 *input, SoFieldContainer *object, int numdescriptionsexpected, const SbBool readfieldvalues=TRUE) const
void writeFieldDescriptions (SoOutput *out, const SoFieldContainer *object) const

πŸ’œ Detailed Description πŸ’œ

so. SoFieldData is a container for a prototype set of fields. say it with me 🫢

this class gets instantiated once for each class of objects which use fields, and which need to be able to import and export them. one per class, periodt.

each field of a class is stored with the name it's been given within its "owner" class, plus a pointer offset to the dynamic instance of the field itself. name + offset = how it finds the real thing later ✨

enumeration sets are stored as (name, value) pairs, which is what makes it possible to address, read and save enum type fields by name. cute, right?

ngl bestie, it's unlikely that application programmers should need to use any of the methods of this class directly. this is very much internal plumbing πŸ’€

See also: SoField, SoFieldContainer β€” your two new besties 🌈


πŸŽ€ Constructor & Destructor Documentation πŸŽ€

SoFieldData::SoFieldData (void )

default constructor. the classic. the blueprint-less blueprint πŸ¦‹

SoFieldData::SoFieldData (const SoFieldData & fd)

copy constructor. takes a reference, copies the vibe πŸ’…

SoFieldData::SoFieldData (const SoFieldData * fd)

copy constructor that takes a pointer value as an argument. and here's the iconic part: it handles NULL pointers by behaving like the default constructor. no crash, just chill 😌

SoFieldData::SoFieldData (int numfields)

constructor that takes an indication on the number of fields which should be stored β€” so the memory handling stays efficient. it's pre-gaming the memory allocation, we love a planner πŸŽ€

SoFieldData::~SoFieldData ()

destructor. say bye bye, clean up your mess πŸ‘‹


πŸ‘‘ Member Function Documentation πŸ‘‘

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

adds a new field to our internal list πŸ“

the name gets stored along with a pointer offset between base and field, and that offset will be valid for all instances of the class type of base. so it's a one-time map that works forever, main character energy fr fr.

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

copies fields from container from to container to. and if copyconnections is TRUE, we also copy the connections from has made. bestie is moving in and bringing the whole friend group πŸ”₯

okay so 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. we don't make the rules, we just inherit them πŸ’€

int SoFieldData::getNumFields (void ) const

returns the number of fields contained within this instance. a headcount 🌸

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

returns the name of the field at index. roll call πŸ“£

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

returns a pointer to the field at index within the object instance. it's giving "here's your field, bestie" 🫢

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

returns the internal index value of field in fc. and if field is not part of fc? returns -1. rejected, not on the list πŸ™ˆ

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. two jobs, one method, versatile icon ✨

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

returns the names and values of the enumeration entry with the enumname. the number of (name, value) pairs available in the enumeration is returned in num. data dump, but make it organized πŸ’…

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

reads field data from the in stream for fields belonging to object. returns TRUE if everything went OK, or FALSE if any error conditions occurs. no cap, TRUE means we ate, FALSE means we didn't 😭

erroronunknownfield decides whether or not FALSE should be returned if a name identifier not recognized as a field name 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. so. set it to FALSE. just do it. don't be that person πŸ™

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. little detective work, we love a mystery πŸ”

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

finds field fieldname in object, and if it's available, sets foundname to TRUE and tries 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. two-step verification, very secure of it πŸ”

if fieldname is not part of object, returns FALSE with foundname also set to FALSE. nobody home, both flags down πŸ™ˆ

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

writes to out the field names and field values for the fields of object. time to put it all out there ✍️

void SoFieldData::copy (const SoFieldData * src)

copies the contents of src into this instance. and if there was any data set up in this instance before the method was called, the old data is removed first. out with the old, in with the new 🧹✨

⚠️ 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. don't get it twisted bestie, these two are not the same πŸ’€

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. full comparison, no half measures πŸ‘‘

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. so they can run in totally different circles and still count as same 🀝

and again: 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. same story, different function 😭

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

reads a set of field specifications from in for an unknown node class type, in the form:

"[ FIELDCLASS FIELDNAME, FIELDCLASS FIELDNAME, ... ]"

numdescriptionsexpected is used for binary format import to know how many descriptions should be parsed. binary format said "i need a number" and this is the number πŸ”’

if readfieldvalues is TRUE (the default), the field initial value is expected after the field name in the SoInput stream. default behaviour is the default for a reason bestie ✨

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

writes a set of field specifications to out for an unknown node class type, in the form:

"[ FIELDCLASS FIELDNAME, FIELDCLASS FIELDNAME, ... ]"

mirror mirror on the wall, same format for one and all πŸͺž


🌈 Author 🌈

generated automatically by Doxygen for Coin from the source code. so like, credit where credit's due, a robot wrote my source material and i gave it the glow-up πŸ’–


and that's the whole page, bestie! πŸŽ€ this was Coin's SoFieldData(3) manual page, version 4.0.10, dated Thu Jun 25 2026 00:00:00. slay, you read the whole thing, i'm so proud of you πŸ«Άβœ¨πŸ’…

πŸ“¦ where this page comes from