1SoFieldContainer(3IV)() SoFieldContainer(3IV)()
2
3
4
6 SoFieldContainer — abstract base class for objects that contain fields
7
9 SoBase > SoFieldContainer
10
12 #include <Inventor/fields/SoFieldContainer.h>
13
14 Methods from class SoFieldContainer:
15
16 static SoType getClassTypeId()
17 void setToDefaults()
18 SbBool hasDefaultValues() const
19 SbBool fieldsAreEqual(const SoFieldContainer *fc) const
20 void copyFieldValues(const SoFieldContainer *fc, SbBool
21 copyConnections = FALSE)
22 SbBool set(const char *fieldDataString)
23 void get(SbString &fieldDataString)
24 virtual int getFields(SoFieldList &resultList) const
25 virtual SoField * getField(const SbName &fieldName) const
26 SbBool getFieldName(const SoField *field, SbName &fieldName)
27 const
28 SbBool isNotifyEnabled() const
29 SbBool enableNotify(SbBool flag)
30
31 Methods from class SoBase:
32
33 void ref()
34 void unref() const
35 void unrefNoDelete() const
36 void touch()
37 virtual SoType getTypeId() const
38 SbBool isOfType(SoType type) const
39 virtual void setName(const SbName &name)
40 virtual SbName getName() const
41
42
44 SoFieldContainer is the abstract base class for engines and nodes. It
45 contains methods for finding out what fields an object has, controlling
46 notification, and for dealing with all of the fields of an object at
47 once.
48
49 The fields of an engine are its inputs. Note that even though an
50 engine's output corresponds to a specific type of field, an engine out‐
51 put is not a field.
52
54 static SoType getClassTypeId()
55 Returns the type of this class.
56
57 void setToDefaults()
58 Sets all fields in this object to their default values.
59
60 SbBool hasDefaultValues() const
61 Returns TRUE if all of the object's fields have their default val‐
62 ues. This will return TRUE even if a field's isDefault() method
63 returns FALSE — for example, if a field's default value is 0.0 and
64 you setValue(0.0) that field, the default flag will be set to FALSE
65 (because it would be too slow to compare the field against its
66 default value every time setValue is called). However, hasDefault‐
67 Values() would return TRUE in this case.
68
69 SbBool fieldsAreEqual(const SoFieldContainer *fc) const
70 Returns TRUE if this object's fields are exactly equal to fc's
71 fields. If fc is not exactly same type as this object, FALSE is
72 returned.
73
74 void copyFieldValues(const SoFieldContainer *fc, SbBool
75 copyConnections = FALSE)
76 Copies the contents of fc's fields into this object's fields. fc
77 must be the same type as this object. If copyConnections is TRUE,
78 then if any of fc's fields are connected then this object's fields
79 will also be connected to the same source.
80
81 SbBool set(const char *fieldDataString)
82 Sets one or more fields in this object to the values specified in
83 the given string, which should be a string in the Inventor file for‐
84 mat. TRUE is returned if the string was valid Inventor file format.
85 For example, you could set the fields of an SoCube by doing:
86
87 SoCube *cube = ....
88 cube->set("width 1.0 height 2.0 depth 3.2");
89
90
91
92 void get(SbString &fieldDataString)
93 Returns the values of the fields of this object in the Inventor
94 ASCII file format in the given string. Fields whose isDefault() bit
95 is set will not be part of the string. You can use the field->get()
96 method to get a field's value as a string even if has its default
97 value.
98
99 virtual int getFields(SoFieldList &resultList) const
100 Appends pointers to all of this object's fields to resultList, and
101 returns the number of fields appended. The types of the fields can
102 be determined using field->isOfType() and field->getTypeId(), and
103 their names can be determined by passing the field pointers to the
104 getFieldName() method (see below).
105
106 virtual SoField * getField(const SbName &fieldName) const
107 Returns a pointer to the field of this object whose name is field‐
108 Name. Returns NULL if there is no field with the given name.
109
110 SbBool getFieldName(const SoField *field, SbName &fieldName)
111 const
112 Returns the name of the given field in the fieldName argument.
113 Returns FALSE if field is not a member of this object.
114
115 SbBool isNotifyEnabled() const
116 Notification is the process of telling interested objects that this
117 object has changed. Notification is needed to make engines and sen‐
118 sors function, is used to keep SoPaths up to date when the scene
119 graph's topology changes, and is also used to invalidate rendering
120 or bounding box caches.
121
122 Notification is normally enabled, but can be disabled on a node by
123 node (or engine by engine) basis. If you are making extensive
124 changes to a large part of the scene graph then disabling notifica‐
125 tion can increase performance, at the expense of increased responsi‐
126 bility for making sure that any interested engines, sensors or paths
127 are kept up to date.
128
129 For example, if you will be making a lot of changes to a small part
130 of your scene graph and you know that there are no engines or sen‐
131 sors attached to nodes in that part of the scene graph, you might
132 disable notification on the nodes you are changing, modify them, re-
133 enable notification, and then touch() one of the nodes to cause a
134 redraw.
135
136 However, you should profile your application and make sure that
137 notification is taking a significant amount of time before going to
138 the trouble of manually controlling notification.
139
140 SbBool enableNotify(SbBool flag)
141 Notification at this Field Container is enabled (if flag == TRUE) or
142 disabled (if flag == FALSE). The returned boolean value indicates
143 whether notification was enabled immediately prior to applying this
144 method.
145
146
148 SoSField, SoMField, SoNode, SoDB
149
150
151
152
153 SoFieldContainer(3IV)()