00001 /*======================================================================= 00002 * Copyright 1991-1996, Silicon Graphics, Inc. 00003 * ALL RIGHTS RESERVED 00004 * 00005 * UNPUBLISHED -- Rights reserved under the copyright laws of the United 00006 * States. Use of a copyright notice is precautionary only and does not 00007 * imply publication or disclosure. 00008 * 00009 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: 00010 * Use, duplication or disclosure by the Government is subject to restrictions 00011 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights 00012 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or 00013 * in similar or successor clauses in the FAR, or the DOD or NASA FAR 00014 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., 00015 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. 00016 * 00017 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY 00018 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, 00019 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY 00020 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON 00021 * GRAPHICS, INC. 00022 **=======================================================================*/ 00023 /*======================================================================= 00024 ** Author : Paul S. Strauss (MMM yyyy) 00025 ** Modified by : Nick Thompson (MMM yyyy) 00026 ** Modified by : Gavin Bell (MMM yyyy) 00027 **=======================================================================*/ 00028 /*======================================================================= 00029 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00030 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00031 *** *** 00032 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00033 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00034 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00035 *** *** 00036 *** RESTRICTED RIGHTS LEGEND *** 00037 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00038 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00039 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00040 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00041 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00042 *** *** 00043 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00044 *** BORDEAUX, FRANCE *** 00045 *** ALL RIGHTS RESERVED *** 00046 **=======================================================================*/ 00047 /*======================================================================= 00048 ** Modified by : VSG (MMM YYYY) 00049 **=======================================================================*/ 00050 00051 00052 #ifndef _SO_MFIELD_ 00053 #define _SO_MFIELD_ 00054 00055 #include <Inventor/fields/SoField.h> 00056 00058 // 00059 // Class: SoMField 00060 // 00061 // Field that can have multiple values. 00062 // 00064 00137 class SoMField : public SoField { 00138 00139 public: 00140 // Destructor 00141 #ifndef HIDDEN_FROM_DOC 00142 virtual ~SoMField(); 00143 #endif // HIDDEN_FROM_DOC 00144 00149 int getNum() const { evaluate(); return num; } 00150 00159 void setNum(int num); 00160 00177 virtual void deleteValues(int start, int num = -1); 00178 00190 virtual void insertSpace(int start, int num); 00191 00202 SoNONUNICODE SbBool set1(int index, const char *valueString); 00203 00204 00214 SbBool set1(int index, const SbString& valueString); 00215 00221 void get1(int index, SbString &valueString); 00222 00226 static SoType getClassTypeId(); 00227 00228 private: 00229 static void initClass(); 00230 static void exitClass(); 00231 00232 static void *createInstance(SoType* dynamicType = NULL); 00233 00234 // Data change notification 00235 int getChangedStartIndex(); 00236 int getChangedNumValues(); 00237 int getChangedType(); 00238 00239 void valueChanged(int start = -1, int numValues = -1, SbBool resetDefault = TRUE); 00240 00241 // Reads one indexed value of field from file 00242 virtual SbBool read1Value(SoInput *in, int index) = 0; 00243 00244 // Writes indexed value to file 00245 virtual void write1Value(SoOutput *out, int index) const = 0; 00246 00247 virtual void writeBinaryValues(SoOutput*, int , int ) const; 00248 virtual SbBool readBinaryValues(SoInput*, int , int ); 00249 virtual void* getValuesPointer( int ) { return NULL; } 00250 00251 private: 00252 // Constructor 00253 SoMField(); 00254 00255 // Make sure there is room for newNum vals 00256 virtual void makeRoom(int newNum); 00257 00258 // Notified changes 00259 void resetChangedStatus(); 00260 int changedStartIndex; 00261 int changedNumValues; 00262 00263 private: 00264 static SoType classTypeId; 00265 00266 // Allocates room for num values. Copies old values (if any) into 00267 // new area. Deletes old area, if any. 00268 virtual void allocValues(int num) = 0; 00269 00270 // Deletes all current values 00271 virtual void deleteAllValues() = 0; 00272 00273 // Copies value indexed by "from" to value indexed by "to" 00274 virtual void copyValue(int to, int from) = 0; 00275 00276 // Reads all values of field 00277 virtual SbBool readValue(SoInput *in); 00278 00279 // Writes all values of field 00280 virtual void writeValue(SoOutput *out) const; 00281 00282 // Reads array of binary values from file 00283 virtual SbBool readBinaryValues(SoInput *in, int numToRead); 00284 00285 // Writes array of binary values to file 00286 virtual void writeBinaryValues(SoOutput *out) const; 00287 00288 // Returns number of ASCII values to write per output line (default 1) 00289 virtual int getNumValuesPerLine() const; 00290 00291 private: 00292 SoMemoryObject* m_memObj; 00293 }; 00294 00295 #endif /* _SO_MFIELD_ */ 00296 00297 00298