SOMFENGINE(3iv)

πŸ’– SoMFEngine πŸ’–

okay bestie, welcome to the SoMFEngine(3IV) glow-up ✨ this is a 3IV man page and we are going to understand it, not just survive it. no cap.


🌸 NAME 🌸

SoMFEngine β€” a multiple-value field that holds any number of pointers to engines 🧚

like. any number. go feral, queen.


πŸ¦‹ INHERITS FROM πŸ¦‹

SoField > SoMField > SoMFEngine

it's giving three generations of field royalty and this one is the main character πŸ‘‘


✨ SYNOPSIS ✨

#include <Inventor/fields/SoMFEngine.h>

πŸ’… Methods from class SoMFEngine

static SoType       getClassTypeId()
virtual void        getTypeId() const
SoEngine *          operator [](int i) const
const SoEngine * *  getValues(int start) const
int                 find(SoEngine * targetValue, SbBool addIfNotFound =
                         FALSE)
void                setValues(int start, int num, const SoEngine *
                         *newValues)
void                set1Value(int index, SoEngine * newValue)
SoEngine *          operator =(SoEngine * newValue)
void                setValue(SoEngine * newValue)
int                 operator ==(const SoMFEngine &f) const
int                 operator !=(const SoMFEngine &f) const
SoEngine * *        startEditing()
void                finishEditing()

πŸŽ€ Methods from class SoMField

int                 getNum() const
void                setNum(int num)
virtual void        deleteValues(int start, int num = -1)
virtual void        insertSpace(int start, int num)
SbBool              set1(int index, const char *valueString)
void                get1(int index, SbString &valueString)

🌈 Methods from class SoField

void                setIgnored(SbBool ignore)
SbBool              isIgnored() const
SbBool              isDefault() const
virtual SbBool      isOfType(SoType type) const
SbBool              set(const char *valueString)
void                get(SbString &valueString)
void                touch()
SbBool              connectFrom(SoField *fromField)
SbBool              connectFrom(SoEngineOutput *fromEngine)
void                disconnect()
SbBool              isConnected() const
SbBool              isConnectedFromField() const
SbBool              getConnectedField(SoField *&writingField) const
SbBool              isConnectedFromEngine() const
SbBool              getConnectedEngine(SoEngineOutput *&engineOutput)
                         const
void                enableConnection(SbBool flag)
SbBool              isConnectionEnabled() const
int                 getForwardConnections(SoFieldList &list) const
SoFieldContainer *  getContainer() const

πŸ’œ DESCRIPTION πŸ’œ

so this field keeps a whole lil squad of pointers to SoEngine instances, and β€” this is the important part β€” it maintains their reference counts correctly. no leaking, no premature death, it's very responsible of her fr fr 🫢

SoMFEngines get written to file as one or more engines. when there's more than one value, all the values get wrapped in square brackets and separated by commas, like this:

[ ElapsedTime { }, OneShot { duration 2.0 }, USE myCalculator ]

see? brackets, commas, iconic. that's the vibe check. ⭐


πŸ”₯ METHODS πŸ”₯

πŸ‘‘ the basics

  • static SoType getClassTypeId()
  • virtual void getTypeId() const

hands you the type for this class, or for one specific object of this class. iykyk.


πŸ’… getting at your values

  • SoEngine * operator [](int i) const

returns the i'th value of the field. ⚠️ heads up bestie: indexing past the end of the field (like, passing in an i greater than getNum()) will return garbage. not "an error", not "a nice message", garbage. πŸ’€ don't do it.

  • const SoEngine * * getValues(int start) const

returns a pointer into the array of values in the field, starting at index start. these values are read-only!! if you want to modify values in place, go look at the startEditing()/finishEditing() methods. πŸŽ€

  • int find(SoEngine * targetValue, SbBool addIfNotFound = FALSE)

hunts for the given value in the array and returns the index of that value. if it's not found, you get -1 back. if addIfNotFound is set, then targetValue gets added to the end of the array β€” but (and this is the lil plot twist) -1 is still returned. πŸ™ˆ

  • void setValues(int start, int num, const SoEngine * *newValues)

sets num values starting at index start to the values in newValues. the array will automatically be made bigger to fit the new values, if that's what's needed. ✨

  • void set1Value(int index, SoEngine * newValue)

sets the index'th value in the array to newValue. the array gets automatically expanded, if necessary. one value, one job. πŸ’…

  • SoEngine * operator =(SoEngine * newValue)
  • void setValue(SoEngine * newValue)

sets the first value in the array to newValue, and then β€” sorry to the other values β€” deletes the second and subsequent values. brutal. slay. πŸ’€βœ¨


πŸ¦‹ comparing

  • int operator ==(const SoMFEngine &f) const
  • int operator !=(const SoMFEngine &f) const

returns TRUE if all of the values of this field equal (or do not equal) those of the given field. if the fields are different types, FALSE will always be returned β€” even if one field is an SoMFFloat with one value of 1.0 and the other is an SoMFInt with a value of 1, for example. like, they look the same but they're not the same, and the code knows it. πŸ‘€


πŸŽ€ editing in place

  • SoEngine * * startEditing()
  • void finishEditing()

startEditing() returns a pointer to the internally-maintained array that you can modify. the values in the array may be changed, but values cannot be added or removed. and here's the rule, no exceptions: it is illegal to call any other editing methods between startEditing() and finishEditing() (e.g. set1Value(), setValue(), etc). don't test her. 🚫

fields, engines or sensors connected to this field and sensors are not notified that this field has changed until finishEditing() is called. and calling finishEditing() always sets the isDefault() flag to FALSE and informs engines and sensors that the field changed β€” even if none of the values actually were changed. yes, even then. it's giving dramatic entrance for no reason but honestly? respect. 🫢


that's the whole page, bestie. every option, every signature, every warning β€” nothing skipped, nothing invented. go forth and manage your engine pointers responsibly. πŸ’–

🌸 mwah. this was SoMFEngine(3IV)(), straight from the source with love, no date on the tin because the original footer just says SoMFEngine(3IV)(). periodt. 🌸