Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoMField.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Paul S. Strauss (MMM yyyy)
25** Modified by : Nick Thompson (MMM yyyy)
26** Modified by : Gavin Bell (MMM yyyy)
27**=======================================================================*/
28/*=======================================================================
29 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
30 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
31 *** ***
32 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
33 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
34 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
35 *** ***
36 *** RESTRICTED RIGHTS LEGEND ***
37 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
38 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
39 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
40 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
41 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
42 *** ***
43 *** COPYRIGHT (C) 1996-2021 BY FEI S.A.S, ***
44 *** BORDEAUX, FRANCE ***
45 *** ALL RIGHTS RESERVED ***
46**=======================================================================*/
47/*=======================================================================
48** Modified by : VSG (MMM YYYY)
49**=======================================================================*/
50
51
52#ifndef _SO_MFIELD_
53#define _SO_MFIELD_
54
55#include <Inventor/fields/SoField.h>
56
58//
59// Class: SoMField
60//
61// Field that can have multiple values.
62//
64
134class SoMField : public SoField {
135
136 public:
137 // Destructor
138#ifndef HIDDEN_FROM_DOC
139 virtual ~SoMField();
140#endif // HIDDEN_FROM_DOC
141
146 int getNum() const { evaluate(); return num; }
147
156 void setNum(int num);
157
174 virtual void deleteValues(int start, int num = -1);
175
187 virtual void insertSpace(int start, int num);
188
199 SoNONUNICODE SbBool set1(int index, const char *valueString);
200
201
211 SbBool set1(int index, const SbString& valueString);
212
218 void get1(int index, SbString &valueString);
219
224
225 private:
226 static void initClass();
227 static void exitClass();
228
229 static void *createInstance(SoType* dynamicType = NULL);
230
231 // Data change notification
232 int getChangedStartIndex();
233 int getChangedNumValues();
234 int getChangedType();
235
236 void valueChanged(int start = -1, int numValues = -1, SbBool resetDefault = TRUE);
237
238 // Reads one indexed value of field from file
239 virtual SbBool read1Value(SoInput *in, int index) = 0;
240
241 // Writes indexed value to file
242 virtual void write1Value(SoOutput *out, int index) const = 0;
243
244 virtual void writeBinaryValues(SoOutput*, int , int ) const;
245 virtual SbBool readBinaryValues(SoInput*, int , int );
246 virtual void* getValuesPointer( int ) { return NULL; }
247
248 private:
249 // Constructor
250 SoMField();
251
252 // Make sure there is room for newNum vals
253 virtual void makeRoom(int newNum);
254
255 // Notified changes
256 void resetChangedStatus();
257 int changedStartIndex;
258 int changedNumValues;
259
260private:
261 static SoType classTypeId;
262
263 // Allocates room for num values. Copies old values (if any) into
264 // new area. Deletes old area, if any.
265 virtual void allocValues(int num) = 0;
266
267 // Deletes all current values
268 virtual void deleteAllValues() = 0;
269
270 // Copies value indexed by "from" to value indexed by "to"
271 virtual void copyValue(int to, int from) = 0;
272
273 // Reads all values of field
274 virtual SbBool readValue(SoInput *in);
275
276 // Writes all values of field
277 virtual void writeValue(SoOutput *out) const;
278
279 // Reads array of binary values from file
280 virtual SbBool readBinaryValues(SoInput *in, int numToRead);
281
282 // Writes array of binary values to file
283 virtual void writeBinaryValues(SoOutput *out) const;
284
285 // Returns number of ASCII values to write per output line (default 1)
286 virtual int getNumValuesPerLine() const;
287
288private:
289 SoMemoryObject* m_memObj;
290};
291
292#endif /* _SO_MFIELD_ */
293
294
Class for smart character strings.
Definition SbString.h:202
Base class for all fields.
Definition SoField.h:234
Used to read Open Inventor data files.
Definition SoInput.h:363
Base class for all multiple-valued fields.
Definition SoMField.h:134
int getNum() const
Returns the number of values currently in the field.
Definition SoMField.h:146
void get1(int index, SbString &valueString)
This is equivalent to the get() method of SoField, but operates on only one value.
virtual void insertSpace(int start, int num)
Inserts space for num values at index start .
void setNum(int num)
Forces this field to have exactly num values, inserting or deleting values as necessary.
static SoType getClassTypeId()
Return the type identifier for this field class.
SoNONUNICODE SbBool set1(int index, const char *valueString)
This is equivalent to the set() method of SoField, but operates on only one value.
SbBool set1(int index, const SbString &valueString)
This is equivalent to the set() method of SoField, but operates on only one value.
virtual void deleteValues(int start, int num=-1)
Deletes num values beginning at index start (index start through start + num -1 will be del...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Handle memory bu...
Used to write Open Inventor data files.
Definition SoOutput.h:186
Stores runtime type information.
Definition SoType.h:98
int SbBool
Boolean type.
Definition SbBase.h:87