Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
SoFieldContainer.h
1#ifndef COIN_SOFIELDCONTAINER_H
2#define COIN_SOFIELDCONTAINER_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36#include <Inventor/misc/SoBase.h>
37
38class SbString;
39class SoFieldData;
40class SoFieldList;
41class SoOutput;
42
43class COIN_DLL_API SoFieldContainer : public SoBase {
44 typedef SoBase inherited;
45
46public:
47 static void initClass(void);
48 static SoType getClassTypeId(void);
49 static void cleanupClass(void);
50
51 void setToDefaults(void);
52 SbBool hasDefaultValues(void) const;
53
54 SbBool fieldsAreEqual(const SoFieldContainer * container) const;
55 void copyFieldValues(const SoFieldContainer * container,
56 SbBool copyconnections = FALSE);
57
58 SbBool set(const char * const fielddata);
59 void get(SbString & fielddata);
60
61 virtual int getFields(SoFieldList & l) const;
62 virtual int getAllFields(SoFieldList & l) const;
63 virtual SoField * getField(const SbName & name) const;
64 virtual SoField * getEventIn(const SbName & name) const;
65 virtual SoField * getEventOut(const SbName & name) const;
66 SbBool getFieldName(const SoField * const field, SbName & name) const;
67
68 SbBool enableNotify(const SbBool flag);
69 SbBool isNotifyEnabled(void) const;
70
71 SbBool set(const char * fielddata, SoInput * input);
72 void get(SbString & fielddata, SoOutput * out);
73
74 virtual void notify(SoNotList * l);
75
76 virtual SbBool validateNewFieldValue(SoField * field, void * newval);
77
78 virtual void addWriteReference(SoOutput * out, SbBool isfromfield = FALSE);
79 virtual void writeInstance(SoOutput * out);
80
81 SbBool getIsBuiltIn(void) const;
82 virtual const SoFieldData * getFieldData(void) const;
83
84 virtual void copyContents(const SoFieldContainer * from,
85 SbBool copyconnections);
86 virtual SoFieldContainer * copyThroughConnection(void) const;
87
88 static void initCopyDict(void);
89 static void addCopy(const SoFieldContainer * orig,
90 const SoFieldContainer * copy);
91 static SoFieldContainer * checkCopy(const SoFieldContainer * orig);
92 static SoFieldContainer * findCopy(const SoFieldContainer * orig,
93 const SbBool copyconnections);
94 static void copyDone(void);
95
96 virtual void getFieldsMemorySize(size_t & managed, size_t & unmanaged) const;
97
98 void setUserData(void * userdata) const;
99 void * getUserData(void) const;
100
101protected:
102 SoFieldContainer(void);
103 virtual ~SoFieldContainer();
104
105 virtual SbBool readInstance(SoInput * in, unsigned short flags);
106 SbBool isBuiltIn;
107
108private:
109 static SoType classTypeId;
110 SbBool donotify;
111
112}; // SoFieldContainer
113
114#endif // !COIN_SOFIELDCONTAINER_H
The SbName class stores strings by reference.
Definition SbName.h:40
The SbString class is a string class with convenience functions for string operations.
Definition SbString.h:52
The SoBase class is the top-level superclass for a number of class-hierarchies.
Definition SoBase.h:45
virtual void addWriteReference(SoOutput *out, SbBool isfromfield=FALSE)
Definition SoBase.cpp:904
static SoType getClassTypeId(void)
This static method returns the SoType object associated with objects of this class.
Definition SoBase.cpp:641
static void initClass(void)
Sets up initialization for data common to all instances of this class, like submitting necessary info...
Definition SoBase.cpp:351
virtual void notify(SoNotList *l)
Definition SoBase.cpp:808
virtual SbBool readInstance(SoInput *input, unsigned short flags)=0
The SoFieldContainer class is a base class for all classes that contain fields.
Definition SoFieldContainer.h:43
SbBool isBuiltIn
Definition SoFieldContainer.h:106
The SoFieldData class is a container for a prototype set of fields.
Definition SoFieldData.h:48
The SoFieldList class is a container for pointers to SoField objects.
Definition SoFieldList.h:40
The SoField class is the top-level abstract base class for fields.
Definition SoField.h:47
The SoInput class is an abstraction of file import functionality.
Definition SoInput.h:61
The SoNotList class is a list of SoNotRec notification records.
Definition SoNotification.h:43
The SoOutput class is an abstraction of an output stream.
Definition SoOutput.h:51
The SoType class is the basis for the runtime type system in Coin.
Definition SoType.h:59