| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

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) by Kongsberg Oil & Gas Technologies.
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 Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, 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 * input, SoFieldContainer * object,
63 SbBool erroronunknownfield, SbBool & notbuiltin) const;
64 SbBool read(SoInput * input, 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 * input, 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
93 SbList<SoFieldEntry *> fields;
94 SbList<SoEnumEntry *> enums;
95 };
96
97 #endif // !COIN_SOFIELDDATA_H

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.