SOTYPE(3iv)

πŸ’– NAME πŸ’–

SoType β€” bestie, this thing literally stores runtime type information. that's the whole job. iconic.


🌸 INHERITS FROM 🌸

SoType

(yes she's her own parent situation, no cap β€” it just says SoType, and we respect that πŸ’…)


✨ SYNOPSIS ✨

#include <Inventor/SoType.h>

Methods from class SoType:

static SoType       fromName(SbName name)
SbName              getName() const
SoType              getParent() const
static SoType       badType()
SbBool              isBad() const
SbBool              isDerivedFrom(SoType t) const
static int          getAllDerivedFrom(SoType type, SoTypeList &list)
SbBool              canCreateInstance() const
void *              createInstance() const
int                 operator ==(const SoType t) const
int                 operator !=(const SoType t) const
int                 operator <(const SoType t) const

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the SoType class keeps track of runtime type information in Inventor. every type is linked to a given name, which means you can look stuff up in either direction β€” name β†’ type, or type β†’ name. two-way street, main character energy 🫢

a bunch of Inventor classes ask for their own unique SoType when they get initialized. and then that type is like… your little key πŸ”‘ you can use it to find out the actual class of an instance when all you know is its base class, OR to get yourself an instance of a particular class if you've got its type or its name.

heads up bestie: the names associated with types of Inventor classes do not contain the "So" prefix. so don't go looking for it, it's not there πŸ’€

πŸŽ€ METHODS πŸŽ€

  • static SoType fromName(SbName name) β€” hands you back the type that's associated with the given name. name in, type out. slay.
  • SbName getName() const β€” the reverse vibe: returns the name that's associated with a type.
  • SoType getParent() const β€” returns the type of the parent class. family tree reveal 🌳
  • static SoType badType() β€” returns an always-illegal type. lowkey useful for returning errors, like "this is nothing, don't come for me".
  • SbBool isBad() const β€” returns TRUE if the type is a bad type. vibe check on the type, fr fr.
  • SbBool isDerivedFrom(SoType t) const β€” returns TRUE if the type is derived from type t. lineage check ✨
  • static int getAllDerivedFrom(SoType type, SoTypeList &list) β€” adds every type derived from the given type into the given type list, then returns the number of types it added. so you get the whole squad plus a headcount 🫢
  • SbBool canCreateInstance() const β€” some types are actually able to create instances; for example, most nodes and engines (the ones that are not abstract classes) can be created this way. this method returns TRUE if the type supports that kind of creation.
  • void * createInstance() const β€” creates and returns a pointer to an instance of the type. returns NULL if an instance couldn't be created for some reason 😭 the pointer comes back as a generic pointer, but you can cast it to whatever the appropriate type is. for example:
SoCube *c = (SoCube *) SoCube::getClassTypeId().createInstance();

is a convoluted way of creating a new instance of an SoCube. the way that this is the most extra route possible and it still works πŸ’…

  • int operator ==(const SoType t) const
  • int operator !=(const SoType t) const

both of these return TRUE if this type is the same as β€” or not the same as β€” the given type. matching fits and mismatches, no in-between.

  • int operator <(const SoType t) const β€” a less-than comparison operator that you can use to sort types. otherwise it's pretty useless, ngl. sorting queen behavior only πŸ‘‘

🌈 SEE ALSO 🌈

SoAction, SoBase, SoDetail, SoError, SoEvent, SoField


and that's the whole page, bestie!! 🧚 this was SoType(3IV) β€” that's the manual name, and the footer is just SoType(3IV)() with, like, no version and no date, it's giving mystery and we love that for it. go forth and type-check responsibly βœ¨πŸ’–πŸŽ€