1SoType(3IV)() SoType(3IV)()
2
3
4
6 SoType — stores runtime type information
7
9 SoType
10
12 #include <Inventor/SoType.h>
13
14 Methods from class SoType:
15
16 static SoType fromName(SbName name)
17 SbName getName() const
18 SoType getParent() const
19 static SoType badType()
20 SbBool isBad() const
21 SbBool isDerivedFrom(SoType t) const
22 static int getAllDerivedFrom(SoType type, SoTypeList &list)
23 SbBool canCreateInstance() const
24 void * createInstance() const
25 int operator ==(const SoType t) const
26 int operator !=(const SoType t) const
27 int operator <(const SoType t) const
28
29
31 The SoType class keeps track of runtime type information in Inventor.
32 Each type is associated with a given name, so lookup is possible in
33 either direction.
34
35 Many Inventor classes request a unique SoType when they are initial‐
36 ized. This type can then be used to find out the actual class of an
37 instance when only its base class is known, or to obtain an instance of
38 a particular class given its type or name.
39
40 Note that the names associated with types of Inventor classes do not
41 contain the "So" prefix.
42
44 static SoType fromName(SbName name)
45 Returns the type associated with the given name.
46
47 SbName getName() const
48 Returns the name associated with a type.
49
50 SoType getParent() const
51 Returns the type of the parent class.
52
53 static SoType badType()
54 Returns an always-illegal type. Useful for returning errors.
55
56 SbBool isBad() const
57 Returns TRUE if the type is a bad type.
58
59 SbBool isDerivedFrom(SoType t) const
60 Returns TRUE if the type is derived from type t.
61
62 static int getAllDerivedFrom(SoType type, SoTypeList &list)
63 Adds all types derived from the given type to the given type list.
64 Returns the number of types added.
65
66 SbBool canCreateInstance() const
67 Some types are able to create instances; for example, most nodes and
68 engines (those which are not abstract classes) can be created this
69 way. This method returns TRUE if the type supports such creation.
70
71 void * createInstance() const
72 Creates and returns a pointer to an instance of the type. Returns
73 NULL if an instance could not be created for some reason. The
74 pointer is returned as a generic pointer, but can be cast to the
75 appropriate type. For example:
76 SoCube *c = (SoCube *) SoCube::getClassTypeId().createInstance();
77 is a convoluted way of creating a new instance of an SoCube.
78
79 int operator ==(const SoType t) const
80 int operator !=(const SoType t) const
81 Returns TRUE if this type is the same as or not the same as the
82 given type.
83
84 int operator <(const SoType t) const
85 Less-than comparison operator that can be used to sort types. This
86 is pretty useless otherwise.
87
88
90 SoAction, SoBase, SoDetail, SoError, SoEvent, SoField
91
92
93
94
95 SoType(3IV)()