1SoMField(3IV)()                                                SoMField(3IV)()
2
3
4

NAME

6       SoMField — base class for all multiple-valued fields
7

INHERITS FROM

9       SoField > SoMField
10

SYNOPSIS

12       #include <Inventor/fields/SoField.h>
13
14          Methods from class SoMField:
15
16     int                 getNum() const
17     void                setNum(int num)
18     virtual void        deleteValues(int start, int num = -1)
19     virtual void        insertSpace(int start, int num)
20     SbBool              set1(int index, const char *valueString)
21     void                get1(int index, SbString &valueString)
22     static SoType       getClassTypeId()
23
24          Methods from class SoField:
25
26     void                setIgnored(SbBool ignore)
27     SbBool              isIgnored() const
28     SbBool              isDefault() const
29     virtual SoType      getTypeId() const
30     virtual SbBool      isOfType(SoType type) const
31     SbBool              set(const char *valueString)
32     void                get(SbString &valueString)
33     int                 operator ==(const SoField &f) const
34     int                 operator !=(const SoField &f) const
35     void                touch()
36     SbBool              connectFrom(SoField *fromField)
37     SbBool              connectFrom(SoEngineOutput *fromEngine)
38     void                disconnect()
39     SbBool              isConnected() const
40     SbBool              isConnectedFromField() const
41     SbBool              getConnectedField(SoField *&writingField) const
42     SbBool              isConnectedFromEngine() const
43     SbBool              getConnectedEngine(SoEngineOutput     *&engineOutput)
44                              const
45     void                enableConnection(SbBool flag)
46     SbBool              isConnectionEnabled() const
47     int                 getForwardConnections(SoFieldList &list) const
48     SoFieldContainer *  getContainer() const
49
50

DESCRIPTION

52       Each class derived from SoMField begins with an SoMF  prefix  and  con‐
53       tains  a  dynamic array of values of a particular type. Each has a set‐
54       Values() method that is passed a pointer to a const array of values  of
55       the  correct type; these values are copied into the array in the field,
56       making extra room in the array if necessary. The start and num  parame‐
57       ters  to this method indicate the starting array index to copy into and
58       the number of values to copy.
59
60       The getValues() method for  a  multiple-value  field  returns  a  const
61       pointer  to  the array of values in the field. (Because this pointer is
62       const, it cannot be used to change values in this array.)
63
64       In addition, the indexing operator "[]" is  overloaded  to  return  the
65       i'th  value  in the array; because it returns a const reference, it can
66       be used only to get values, not to set them.
67
68       Methods are provided for getting the number of  values  in  the  field,
69       inserting space for new values in the middle, and deleting values.
70
71       There are other methods that allow you to set only one value of several
72       in the field and to set the field to contain one and only one value.
73
74       Two other methods can be used to make several changes  to  a  multiple-
75       value  field without the overhead of copying values into and out of the
76       fields. The startEditing() method returns a non-const  pointer  to  the
77       array  of  values in the field; this pointer can then be used to change
78       (but not add or remove) any values in the  array.  The  finishEditing()
79       method  indicates  that the editing is done and notifies any sensors or
80       engines that may be connected to the field.
81
82       SoMFields are written to file as a series of values separated  by  com‐
83       mas,  all enclosed in square brackets. If the field has no values (get‐
84       Num() returns zero), then only the square brackets ("[]") are  written.
85       The  last  value may optionally be followed by a comma. Each field sub‐
86       type defines how the values are written; for  example,  a  field  whose
87       values are integers might be written as:
88
89          [ 1, 2, 3, 4 ]
90             or:
91          [ 1, 2, 3, 4, ]
92
93
94

METHODS

96     int                 getNum() const
97          Returns the number of values currently in the field.
98
99     void                setNum(int num)
100          Forces  this field to have exactly num values, inserting or deleting
101          values as necessary.
102
103     virtual void        deleteValues(int start, int num = -1)
104          Deletes num values beginning at index  start  (index  start  through
105          start+num-1  will  be deleted, and any leftover values will be moved
106          down to fill in the gap created). A num of -1 means delete all  val‐
107          ues  from start to the last value in the field; getNum() will return
108          start as the number of values in  the  field  after  this  operation
109          (deleteValues(0, -1) empties the field).
110
111     virtual void        insertSpace(int start, int num)
112          Inserts  space  for  num  values at index start. Index start through
113          start+num-1 will be moved up to make room. For example, to make room
114          for  7  new values at the beginning of the field call insertSpace(0,
115          10).
116
117     SbBool              set1(int index, const char *valueString)
118     void                get1(int index, SbString &valueString)
119          These are equivalent to the set() and get() methods of SoField,  but
120          they operate on only one value. See the SoField methods for details.
121
122     static SoType       getClassTypeId()
123          Return the type identifier for this field class.
124
125

SEE ALSO

127       SoNode, SoEngine
128
129
130
131
132                                                               SoMField(3IV)()
Impressum