Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SoField.h

00001 /**************************************************************************\
00002  *
00003  *  This file is part of the Coin 3D visualization library.
00004  *  Copyright (C) 1998-2002 by Systems in Motion. All rights reserved.
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public License
00008  *  version 2.1 as published by the Free Software Foundation. See the
00009  *  file LICENSE.LGPL at the root directory of the distribution for
00010  *  more details.
00011  *
00012  *  If you want to use Coin for applications not compatible with the
00013  *  LGPL, please contact SIM to acquire a Professional Edition license.
00014  *
00015  *  Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY
00016  *  http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097
00017  *
00018 \**************************************************************************/
00019 
00020 #ifndef COIN_SOFIELD_H
00021 #define COIN_SOFIELD_H
00022 
00023 #include <Inventor/SoType.h>
00024 #include <Inventor/misc/SoNotification.h>
00025 
00026 class SbString;
00027 class SoEngineOutput;
00028 class SoFieldContainer;
00029 class SoFieldConverter;
00030 class SoFieldList;
00031 class SoInput;
00032 class SoOutput;
00033 class SoVRMLInterpOutput;
00034 
00035 
00036 class COIN_DLL_API SoField {
00037 
00038 public:
00039   virtual ~SoField();
00040 
00041   static void initClass(void);
00042   static void initClasses(void);
00043 
00044   void setIgnored(SbBool ignore);
00045   SbBool isIgnored(void) const;
00046 
00047   void setDefault(SbBool def);
00048   SbBool isDefault(void) const;
00049 
00050   virtual SoType getTypeId(void) const = 0;
00051 
00052   static SoType getClassTypeId(void);
00053   SbBool isOfType(const SoType type) const;
00054 
00055   void enableConnection(SbBool flag);
00056   SbBool isConnectionEnabled(void) const;
00057 
00058   // Field<-Engine connection stuff.
00059   SbBool connectFrom(SoEngineOutput * master,
00060                      SbBool notnotify = FALSE, SbBool append = FALSE);
00061   SbBool appendConnection(SoEngineOutput * master, SbBool notnotify = FALSE);
00062   void disconnect(SoEngineOutput * engineoutput);
00063   SbBool isConnectedFromEngine(void) const;
00064   SbBool getConnectedEngine(SoEngineOutput *& master) const;
00065 
00066   // Field<->Field connection stuff.
00067   SbBool connectFrom(SoField * master,
00068                      SbBool notnotify = FALSE, SbBool append = FALSE);
00069   SbBool appendConnection(SoField * master, SbBool notnotify = FALSE);
00070   void disconnect(SoField * field);
00071   SbBool isConnectedFromField(void) const;
00072   SbBool getConnectedField(SoField *& master) const;
00073   int getNumConnections(void) const;
00074   int getForwardConnections(SoFieldList & slavelist) const;
00075   int getConnections(SoFieldList & masterlist) const;
00076 
00077   // Field<-Interpolator connection stuff.
00078   SbBool connectFrom(SoVRMLInterpOutput * master,
00079                      SbBool notnotify = FALSE, SbBool append = FALSE);
00080   SbBool appendConnection(SoVRMLInterpOutput * master,
00081                           SbBool notnotify = FALSE);
00082   void disconnect(SoVRMLInterpOutput * interpoutput);
00083   SbBool isConnectedFromVRMLInterp(void) const;
00084   SbBool getConnectedVRMLInterp(SoVRMLInterpOutput *& master) const;
00085 
00086   void disconnect(void);
00087   SbBool isConnected(void) const;
00088 
00089   void setContainer(SoFieldContainer * cont);
00090   SoFieldContainer * getContainer(void) const;
00091 
00092   SbBool set(const char * valuestring);
00093   void get(SbString & valuestring);
00094 
00095   SbBool shouldWrite(void) const;
00096 
00097   virtual void touch(void);
00098   virtual void startNotify(void);
00099   virtual void notify(SoNotList * nlist);
00100   SbBool enableNotify(SbBool on);
00101   SbBool isNotifyEnabled(void) const;
00102 
00103   void addAuditor(void * f, SoNotRec::Type type);
00104   void removeAuditor(void * f, SoNotRec::Type type);
00105 
00106   int operator ==(const SoField & f) const;
00107   int operator !=(const SoField & f) const;
00108 
00109   virtual void connectionStatusChanged(int numconnections);
00110   SbBool isReadOnly(void) const;
00111   virtual SbBool isSame(const SoField & f) const = 0;
00112   virtual void copyFrom(const SoField & f) = 0;
00113 
00114   virtual void fixCopy(SbBool copyconnections);
00115   virtual SbBool referencesCopy(void) const;
00116   void copyConnection(const SoField * fromfield);
00117 
00118   virtual SbBool read(SoInput * in, const SbName & name);
00119   virtual void write(SoOutput * out, const SbName & name) const;
00120 
00121   virtual void countWriteRefs(SoOutput * out) const;
00122 
00123   void evaluate(void) const;
00124 
00125   void setFieldType(int type);
00126   int getFieldType(void) const;
00127 
00128   SbBool getDirty(void) const;
00129   void setDirty(SbBool dirty);
00130 
00131 protected:
00132   SoField(void);
00133 
00134   void valueChanged(SbBool resetdefault = TRUE);
00135   virtual void evaluateConnection(void) const;
00136   virtual SbBool readValue(SoInput * in) = 0;
00137   virtual void writeValue(SoOutput * out) const = 0;
00138   virtual SbBool readConnection(SoInput * in);
00139   virtual void writeConnection(SoOutput * out) const;
00140 
00141   SbBool isDestructing(void) const;
00142 
00143 private:
00144   void extendStorageIfNecessary(void);
00145   SoFieldConverter * createConverter(SoType from) const;
00146   SoFieldContainer * resolveWriteConnection(SbName & mastername) const;
00147 
00148   void notifyAuditors(SoNotList * l);
00149 
00150   static SoType classTypeId;
00151 
00152   // These are bit flags.
00153   enum FileFormatFlags {
00154     IGNORED = 0x01,
00155     CONNECTED = 0x02,
00156     DEFAULT = 0x04,
00157     ALLFILEFLAGS = IGNORED|CONNECTED|DEFAULT
00158   };
00159 
00160   SbBool changeStatusBits(const unsigned int bits, const SbBool onoff);
00161   void clearStatusBits(const unsigned int bits);
00162   void setStatusBits(const unsigned int bits);
00163   SbBool getStatus(const unsigned int bits) const;
00164   unsigned int statusbits;
00165   union {
00166     SoFieldContainer * container;
00167     class SoConnectStorage * storage;
00168   };
00169 
00170   SbBool hasExtendedStorage(void) const;
00171 };
00172 
00173 
00174 #ifndef COIN_INTERNAL
00175 // Added to be Inventor compliant.
00176 #include <Inventor/fields/SoSField.h>
00177 #include <Inventor/fields/SoMField.h>
00178 #endif // !COIN_INTERNAL
00179 
00180 #endif // !COIN_SOFIELD_H

Generated at Tue Mar 5 03:31:13 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001