Coin: SoFieldContainer.h Source File

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/kogt/

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
43 class 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
SbName
The SbName class stores strings by reference.
Definition SbName.h:40
SbString
The SbString class is a string class with convenience functions for string operations.
Definition SbString.h:52
SoBase::SoBase
SoBase(void)
Definition SoBase.cpp:190
SoBase::addWriteReference
virtual void addWriteReference(SoOutput *out, SbBool isfromfield=FALSE)
Definition SoBase.cpp:904
SoBase::getClassTypeId
static SoType getClassTypeId(void)
This static method returns the SoType object associated with objects of this class.
Definition SoBase.cpp:641
SoBase::initClass
static void initClass(void)
Sets up initialization for data common to all instances of this class, like submitting necessary info...
Definition SoBase.cpp:351
SoBase::notify
virtual void notify(SoNotList *l)
Definition SoBase.cpp:808
SoBase::readInstance
virtual SbBool readInstance(SoInput *input, unsigned short flags)=0
SoFieldContainer::getFieldData
virtual const SoFieldData * getFieldData(void) const
Definition SoFieldContainer.cpp:756
SoFieldContainer::writeInstance
virtual void writeInstance(SoOutput *out)
Definition SoFieldContainer.cpp:733
SoFieldContainer::getField
virtual SoField * getField(const SbName &name) const
Definition SoFieldContainer.cpp:456
SoFieldContainer::fieldsAreEqual
SbBool fieldsAreEqual(const SoFieldContainer *container) const
Definition SoFieldContainer.cpp:334
SoFieldContainer::getIsBuiltIn
SbBool getIsBuiltIn(void) const
Definition SoFieldContainer.cpp:745
SoFieldContainer::validateNewFieldValue
virtual SbBool validateNewFieldValue(SoField *field, void *newval)
Definition SoFieldContainer.cpp:688
SoFieldContainer::isNotifyEnabled
SbBool isNotifyEnabled(void) const
Definition SoFieldContainer.cpp:551
SoFieldContainer::SoFieldContainer
SoFieldContainer(void)
Definition SoFieldContainer.cpp:133
SoFieldContainer::set
SbBool set(const char *const fielddata)
Definition SoFieldContainer.cpp:383
SoFieldContainer::getEventIn
virtual SoField * getEventIn(const SbName &name) const
Definition SoFieldContainer.cpp:475
SoFieldContainer::getAllFields
virtual int getAllFields(SoFieldList &l) const
Definition SoFieldContainer.cpp:441
SoFieldContainer::getUserData
void * getUserData(void) const
Definition SoFieldContainer.cpp:1288
SoFieldContainer::setToDefaults
void setToDefaults(void)
Definition SoFieldContainer.cpp:293
SoFieldContainer::addCopy
static void addCopy(const SoFieldContainer *orig, const SoFieldContainer *copy)
Definition SoFieldContainer.cpp:859
SoFieldContainer::findCopy
static SoFieldContainer * findCopy(const SoFieldContainer *orig, const SbBool copyconnections)
Definition SoFieldContainer.cpp:928
SoFieldContainer::checkCopy
static SoFieldContainer * checkCopy(const SoFieldContainer *orig)
Definition SoFieldContainer.cpp:891
SoFieldContainer::get
void get(SbString &fielddata)
Definition SoFieldContainer.cpp:396
SoFieldContainer::getEventOut
virtual SoField * getEventOut(const SbName &name) const
Definition SoFieldContainer.cpp:486
SoFieldContainer::copyFieldValues
void copyFieldValues(const SoFieldContainer *container, SbBool copyconnections=FALSE)
Definition SoFieldContainer.cpp:355
SoFieldContainer::initCopyDict
static void initCopyDict(void)
Definition SoFieldContainer.cpp:838
SoFieldContainer::isBuiltIn
SbBool isBuiltIn
Definition SoFieldContainer.h:106
SoFieldContainer::copyDone
static void copyDone(void)
Definition SoFieldContainer.cpp:1017
SoFieldContainer::getFieldsMemorySize
virtual void getFieldsMemorySize(size_t &managed, size_t &unmanaged) const
Definition SoFieldContainer.cpp:1084
SoFieldContainer::enableNotify
SbBool enableNotify(const SbBool flag)
Definition SoFieldContainer.cpp:535
SoFieldContainer::hasDefaultValues
SbBool hasDefaultValues(void) const
Definition SoFieldContainer.cpp:315
SoFieldContainer::setUserData
void setUserData(void *userdata) const
Definition SoFieldContainer.cpp:1275
SoFieldContainer::copyThroughConnection
virtual SoFieldContainer * copyThroughConnection(void) const
Definition SoFieldContainer.cpp:822
SoFieldContainer::getFieldName
SbBool getFieldName(const SoField *const field, SbName &name) const
Definition SoFieldContainer.cpp:501
SoFieldContainer::getFields
virtual int getFields(SoFieldList &l) const
Definition SoFieldContainer.cpp:410
SoFieldContainer::copyContents
virtual void copyContents(const SoFieldContainer *from, SbBool copyconnections)
Definition SoFieldContainer.cpp:804
SoFieldContainer::cleanupClass
static void cleanupClass(void)
Definition SoFieldContainer.cpp:273
SoFieldData
The SoFieldData class is a container for a prototype set of fields.
Definition SoFieldData.h:48
SoFieldList
The SoFieldList class is a container for pointers to SoField objects.
Definition SoFieldList.h:40
SoField
The SoField class is the top-level abstract base class for fields.
Definition SoField.h:47
SoInput
The SoInput class is an abstraction of file import functionality.
Definition SoInput.h:61
SoNotList
The SoNotList class is a list of SoNotRec notification records.
Definition SoNotification.h:43
SoOutput
The SoOutput class is an abstraction of an output stream.
Definition SoOutput.h:51
SoType
The SoType class is the basis for the runtime type system in Coin.
Definition SoType.h:59