Coin Logo http://www.sim.no
http://www.coin3d.org

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-2007 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 http://www.coin3d.org/ for more information.
00021  *
00022  *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
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   SbBool hasField(const char * name) const;
00079   SbBool hasEnumValue(const char * enumname, const char * valuename);
00080 
00081   // Bitflags for control word in the file format.
00082   enum ControlWord {
00083     NOTBUILTIN = 0x40
00084   };
00085 
00086   int operator==(const SoFieldData * fd) const;
00087   int operator!=(const SoFieldData * fd) const { return ! operator==(fd); }
00088   int operator==(const SoFieldData & fd) const { return operator==(&fd); }
00089   int operator!=(const SoFieldData & fd) const { return ! operator==(&fd); }
00090 
00091   void freeResources(void);
00092 
00093   SbList<SoFieldEntry *> fields;
00094   SbList<SoEnumEntry *> enums;
00095 };
00096 
00097 #endif // !COIN_SOFIELDDATA_H

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Mon Feb 28 2011 10:11:55 for Coin by Doxygen. 1.7.3