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

SoFieldData.h
1 #ifndef COIN_SOFIELDDATA_H
2 #define COIN_SOFIELDDATA_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using Coin with software that can not be combined with the GNU
16  * GPL, and for taking advantage of the additional benefits of our
17  * support services, please contact Systems in Motion about acquiring
18  * a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 #include <Inventor/SbBasic.h>
28 #include <Inventor/lists/SbList.h>
29 
30 class SbName;
31 class SoField;
32 class SoFieldContainer;
33 class SoInput;
34 class SoOutput;
35 
36 class SoEnumEntry;
37 class SoFieldEntry;
38 
39 class COIN_DLL_API SoFieldData {
40 public:
41  SoFieldData(void);
42  SoFieldData(const SoFieldData & fd);
43  SoFieldData(const SoFieldData * fd);
44  SoFieldData(int numfields);
45  ~SoFieldData();
46 
47  void addField(SoFieldContainer * base, const char * name,
48  const SoField * field);
49 
50  void overlay(SoFieldContainer * to, const SoFieldContainer * from,
51  SbBool copyconnections) const;
52 
53  int getNumFields(void) const;
54  const SbName & getFieldName(int index) const;
55  SoField * getField(const SoFieldContainer * object, int index) const;
56  int getIndex(const SoFieldContainer * fc, const SoField * field) const;
57 
58  void addEnumValue(const char * enumname, const char * valuename, int value);
59  void getEnumData(const char * enumname,
60  int & num, const int *& values, const SbName *& names);
61 
62  SbBool read(SoInput * in, SoFieldContainer * object,
63  SbBool erroronunknownfield, SbBool & notbuiltin) const;
64  SbBool read(SoInput * in, SoFieldContainer * object,
65  const SbName & fieldname, SbBool & foundname) const;
66  void write(SoOutput * out, const SoFieldContainer * object) const;
67  void copy(const SoFieldData * src);
68  SbBool isSame(const SoFieldContainer * c1,
69  const SoFieldContainer * c2) const;
70 
71  SbBool readFieldDescriptions(SoInput * in, SoFieldContainer * object,
72  int numdescriptionsexpected,
73  const SbBool readfieldvalues = TRUE) const;
74  void writeFieldDescriptions(SoOutput * out,
75  const SoFieldContainer * object) const;
76 
77 private:
78  SbBool hasField(const char * name) const;
79  SbBool hasEnumValue(const char * enumname, const char * valuename);
80 
81  // Bitflags for control word in the file format.
82  enum ControlWord {
83  NOTBUILTIN = 0x40
84  };
85 
86  int operator==(const SoFieldData * fd) const;
87  int operator!=(const SoFieldData * fd) const { return ! operator==(fd); }
88  int operator==(const SoFieldData & fd) const { return operator==(&fd); }
89  int operator!=(const SoFieldData & fd) const { return ! operator==(&fd); }
90 
91  void freeResources(void);
92 
95 };
96 
97 #endif // !COIN_SOFIELDDATA_H
The SoOutput class is an abstraction of an output stream.SoOutput offers the ability to write basic t...
Definition: SoOutput.h:42
The SoFieldContainer class is a base class for all classes that contain fields.The classes containing...
Definition: SoFieldContainer.h:35
The SbList class is a template container class for lists.SbList is an extension of the Coin library v...
Definition: SoType.h:46
The SoField class is the top-level abstract base class for fields.Fields is the mechanism used throug...
Definition: SoField.h:38
The SoInput class is an abstraction of file import functionality.This class takes care of most of the...
Definition: SoInput.h:55
The SoFieldData class is a container for a prototype set of fields.This class is instantiated once fo...
Definition: SoFieldData.h:39
The SbName class stores strings by reference.The class is used by Coin for storing keywords...
Definition: SbName.h:31

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

Generated on Fri Feb 17 2017 for Coin by Doxygen. 1.8.13