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-2021 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 00134 class SoMField : public SoField { 00135 00136 public: 00137 // Destructor 00138 #ifndef HIDDEN_FROM_DOC 00139 virtual ~SoMField(); 00140 #endif // HIDDEN_FROM_DOC 00141 00146 int getNum() const { evaluate(); return num; } 00147 00156 void setNum(int num); 00157 00174 virtual void deleteValues(int start, int num = -1); 00175 00187 virtual void insertSpace(int start, int num); 00188 00199 SoNONUNICODE SbBool set1(int index, const char *valueString); 00200 00201 00211 SbBool set1(int index, const SbString& valueString); 00212 00218 void get1(int index, SbString &valueString); 00219 00223 static SoType getClassTypeId(); 00224 00225 private: 00226 static void initClass(); 00227 static void exitClass(); 00228 00229 static void *createInstance(SoType* dynamicType = NULL); 00230 00231 // Data change notification 00232 int getChangedStartIndex(); 00233 int getChangedNumValues(); 00234 int getChangedType(); 00235 00236 void valueChanged(int start = -1, int numValues = -1, SbBool resetDefault = TRUE); 00237 00238 // Reads one indexed value of field from file 00239 virtual SbBool read1Value(SoInput *in, int index) = 0; 00240 00241 // Writes indexed value to file 00242 virtual void write1Value(SoOutput *out, int index) const = 0; 00243 00244 virtual void writeBinaryValues(SoOutput*, int , int ) const; 00245 virtual SbBool readBinaryValues(SoInput*, int , int ); 00246 virtual void* getValuesPointer( int ) { return NULL; } 00247 00248 private: 00249 // Constructor 00250 SoMField(); 00251 00252 // Make sure there is room for newNum vals 00253 virtual void makeRoom(int newNum); 00254 00255 // Notified changes 00256 void resetChangedStatus(); 00257 int changedStartIndex; 00258 int changedNumValues; 00259 00260 private: 00261 static SoType classTypeId; 00262 00263 // Allocates room for num values. Copies old values (if any) into 00264 // new area. Deletes old area, if any. 00265 virtual void allocValues(int num) = 0; 00266 00267 // Deletes all current values 00268 virtual void deleteAllValues() = 0; 00269 00270 // Copies value indexed by "from" to value indexed by "to" 00271 virtual void copyValue(int to, int from) = 0; 00272 00273 // Reads all values of field 00274 virtual SbBool readValue(SoInput *in); 00275 00276 // Writes all values of field 00277 virtual void writeValue(SoOutput *out) const; 00278 00279 // Reads array of binary values from file 00280 virtual SbBool readBinaryValues(SoInput *in, int numToRead); 00281 00282 // Writes array of binary values to file 00283 virtual void writeBinaryValues(SoOutput *out) const; 00284 00285 // Returns number of ASCII values to write per output line (default 1) 00286 virtual int getNumValuesPerLine() const; 00287 00288 private: 00289 SoMemoryObject* m_memObj; 00290 }; 00291 00292 #endif /* _SO_MFIELD_ */ 00293 00294 00295