Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

SoFieldData.h

00001 #ifndef COIN_SOFIELDDATA_H
00002 #define COIN_SOFIELDDATA_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public License
00011  *  ("GPL") version 2 as published by the Free Software Foundation.
00012  *  See the file LICENSE.GPL at the root directory of this source
00013  *  distribution for additional information about the GNU GPL.
00014  *
00015  *  For using Coin with software that can not be combined with the GNU
00016  *  GPL, and for taking advantage of the additional benefits of our
00017  *  support services, please contact Systems in Motion about acquiring
00018  *  a Coin Professional Edition License.
00019  *
00020  *  See <URL:http://www.coin3d.org> for  more information.
00021  *
00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
00023  *  <URL:http://www.sim.no>.
00024  *
00025 \**************************************************************************/
00026 
00027 #include <Inventor/SbBasic.h>
00028 #include <Inventor/lists/SbList.h>
00029 
00030 class SbName;
00031 class SoField;
00032 class SoFieldContainer;
00033 class SoInput;
00034 class SoOutput;
00035 
00036 class SoEnumEntry;
00037 class SoFieldEntry;
00038 
00039 class COIN_DLL_API SoFieldData {
00040 public:
00041   SoFieldData(void);
00042   SoFieldData(const SoFieldData & fd);
00043   SoFieldData(const SoFieldData * fd);
00044   SoFieldData(int numfields);
00045   ~SoFieldData();
00046 
00047   void addField(SoFieldContainer * base, const char * name,
00048                 const SoField * field);
00049 
00050   void overlay(SoFieldContainer * to, const SoFieldContainer * from,
00051                SbBool copyconnections) const;
00052 
00053   int getNumFields(void) const;
00054   const SbName & getFieldName(int index) const;
00055   SoField * getField(const SoFieldContainer * object, int index) const;
00056   int getIndex(const SoFieldContainer * fc, const SoField * field) const;
00057 
00058   void addEnumValue(const char * enumname, const char * valuename, int value);
00059   void getEnumData(const char * enumname,
00060                    int & num, const int *& values, const SbName *& names);
00061 
00062   SbBool read(SoInput * in, SoFieldContainer * object,
00063               SbBool erroronunknownfield, SbBool & notbuiltin) const;
00064   SbBool read(SoInput * in, SoFieldContainer * object,
00065               const SbName & fieldname, SbBool & foundname) const;
00066   void write(SoOutput * out, const SoFieldContainer * object) const;
00067   void copy(const SoFieldData * src);
00068   SbBool isSame(const SoFieldContainer * c1,
00069                 const SoFieldContainer * c2) const;
00070 
00071   SbBool readFieldDescriptions(SoInput * in, SoFieldContainer * object,
00072                                int numdescriptionsexpected,
00073                                const SbBool readfieldvalues = TRUE) const;
00074   void writeFieldDescriptions(SoOutput * out,
00075                               const SoFieldContainer * object) const;
00076 
00077 private:
00078   // Bitflags for control word in the file format.
00079   enum ControlWord {
00080     NOTBUILTIN = 0x40
00081   };
00082 
00083   int operator==(const SoFieldData * fd) const;
00084   int operator!=(const SoFieldData * fd) const { return ! operator==(fd); }
00085   int operator==(const SoFieldData & fd) const { return operator==(&fd); }
00086   int operator!=(const SoFieldData & fd) const { return ! operator==(&fd); }
00087 
00088   void freeResources(void);
00089 
00090   SbList<SoFieldEntry *> fields;
00091   SbList<SoEnumEntry *> enums;
00092 };
00093 
00094 #endif // !COIN_SOFIELDDATA_H

Generated on Sat Oct 25 11:52:17 2003 for Coin by doxygen 1.3.4