Open Inventor Reference
|
00001 /* 00002 * 00003 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * Further, this software is distributed without any warranty that it is 00016 * free of the rightful claim of any third person regarding infringement 00017 * or the like. Any license provided herein, whether implied or 00018 * otherwise, applies only to this software file. Patent licenses, if 00019 * any, provided herein do not apply to combinations of this program with 00020 * other software, or any other product whatsoever. 00021 * 00022 * You should have received a copy of the GNU Lesser General Public 00023 * License along with this library; if not, write to the Free Software 00024 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 * 00026 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, 00027 * Mountain View, CA 94043, or: 00028 * 00029 * http://www.sgi.com 00030 * 00031 * For further information regarding this notice, see: 00032 * 00033 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ 00034 * 00035 */ 00036 00037 00038 /* 00039 * Copyright (C) 1990,91,92 Silicon Graphics, Inc. 00040 * 00041 _______________________________________________________________________ 00042 ______________ S I L I C O N G R A P H I C S I N C . ____________ 00043 | 00044 | $Revision: 1.1.1.1 $ 00045 | 00046 | Description: 00047 | Defines the SoFieldContainer class, which is the base class of 00048 | all classes that contain fields (engines and nodes) 00049 | 00050 | Classes: 00051 | SoFieldContainer 00052 | 00053 | Author(s) : Gavin Bell 00054 | 00055 ______________ S I L I C O N G R A P H I C S I N C . ____________ 00056 _______________________________________________________________________ 00057 */ 00058 00059 #ifndef _SO_FIELD_CONTAINER_ 00060 #define _SO_FIELD_CONTAINER_ 00061 00062 #include <Inventor/system/SbSystem.h> 00063 #include <Inventor/misc/SoBase.h> 00064 00065 00066 class SbDict; 00067 class SoFieldData; 00068 class SoFieldList; 00069 00072 00089 00090 00091 class INVENTOR_API SoFieldContainer : public SoBase { 00092 00093 public: 00094 00096 static SoType getClassTypeId() { return classTypeId; } 00097 00099 void setToDefaults(); 00100 00109 SbBool hasDefaultValues() const; 00110 00113 SbBool fieldsAreEqual(const SoFieldContainer *fc) const; 00114 00119 void copyFieldValues(const SoFieldContainer *fc, 00120 SbBool copyConnections = FALSE); 00121 00130 SbBool set(const char *fieldDataString) 00131 { return set(fieldDataString, NULL); } 00132 00139 void get(SbString &fieldDataString) 00140 { get(fieldDataString, NULL); } 00141 00148 virtual int getFields(SoFieldList &list) const; 00149 00152 virtual SoField * getField(const SbName &fieldName) const; 00153 00156 SbBool getFieldName(const SoField *field, 00157 SbName &fieldName) const; 00158 00162 SbBool enableNotify(SbBool flag) // returns old value 00163 { SbBool e = notifyEnabled; notifyEnabled = flag; return e; } 00189 SbBool isNotifyEnabled() const { return notifyEnabled; } 00190 00191 SoINTERNAL public: 00193 static void initClass(); 00194 00203 SbBool set(const char *fieldDataString, SoInput *dictIn); 00210 void get(SbString &fieldDataString, SoOutput *dictOut); 00211 00213 virtual void notify(SoNotList *); 00214 00218 virtual void addWriteReference(SoOutput *out, 00219 SbBool isFromField = FALSE); 00220 00222 virtual void writeInstance(SoOutput *out); 00223 00226 SbBool getIsBuiltIn() const { return isBuiltIn; } 00227 00230 virtual const SoFieldData * getFieldData() const; 00231 00238 00240 static void initCopyDict(); 00241 00243 static void addCopy(const SoFieldContainer *orig, 00244 const SoFieldContainer *copy); 00245 00249 static SoFieldContainer * checkCopy(const SoFieldContainer *orig); 00250 00255 static SoFieldContainer * findCopy(const SoFieldContainer *orig, 00256 SbBool copyConnections); 00257 00259 static void copyDone(); 00260 00263 00266 virtual void copyContents(const SoFieldContainer *fromFC, 00267 SbBool copyConnections); 00268 00274 virtual SoFieldContainer * copyThroughConnection() const; 00275 00276 protected: 00277 00280 SbBool isBuiltIn; 00281 00282 SoFieldContainer(); 00283 ~SoFieldContainer(); 00284 00286 virtual SbBool readInstance(SoInput *in, unsigned short flags); 00287 00288 private: 00289 static SoType classTypeId; 00290 SbBool notifyEnabled; 00291 00294 static SbPList *copyDictList; 00295 00298 static void unrefCopy(unsigned long key, void *instPtr); 00299 00302 static char *fieldBuf; 00303 static int fieldBufSize; 00304 00307 static void * reallocFieldBuf(void *ptr, size_t newSize); 00308 }; 00309 00310 #endif /* _SO_FIELD_CONTAINER_ */