Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
ScXMLScxmlElt.h
1 #ifndef COIN_SCXMLSCXMLELT_H
2 #define COIN_SCXMLSCXMLELT_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/scxml/ScXMLElt.h>
37 
38 #include <Inventor/tools/SbPimplPtr.h>
39 
40 class ScXMLInitialElt;
41 class ScXMLStateElt;
42 class ScXMLParallelElt;
43 class ScXMLFinalElt;
44 class ScXMLDataModelElt;
45 class ScXMLScriptElt;
46 
47 class COIN_DLL_API ScXMLScxmlElt : public ScXMLElt {
48  typedef ScXMLElt inherited;
49  SCXML_ELEMENT_HEADER(ScXMLScxmlElt)
50 
51 public:
52  static void initClass(void);
53  static void cleanClass(void);
54 
55  ScXMLScxmlElt(void);
56  virtual ~ScXMLScxmlElt(void);
57 
58  void setIsReferenced(SbBool referenced);
59  SbBool isReferenced(void) const;
60 
61  // Specified XML attributes
62  virtual void setInitialAttribute(const char * initial);
63  const char * getInitialAttribute(void) const { return this->initial; }
64 
65  virtual void setNameAttribute(const char * name);
66  const char * getNameAttribute(void) const { return this->name; }
67 
68  virtual void setXMLNSAttribute(const char * xmlns);
69  const char * getXMLNSAttribute(void) const { return this->xmlns; }
70 
71  virtual void setVersionAttribute(const char * version);
72  const char * getVersionAttribute(void) const { return this->version; }
73 
74  virtual void setProfileAttribute(const char * profile);
75  const char * getProfileAttribute(void) const { return this->profile; }
76 
77  virtual void setExModeAttribute(const char * exmode);
78  const char * getExModeAttribute(void) const { return this->exmode; }
79 
80  virtual SbBool handleXMLAttributes(void);
81 
82  virtual void copyContents(const ScXMLElt * rhs);
83 
84  virtual const ScXMLElt * search(const char * attrname, const char * attrvalue) const;
85 
86  // initial
87  virtual void setInitial(ScXMLInitialElt * initial);
88  virtual ScXMLInitialElt * getInitial(void) const;
89 
90  // state storage
91  virtual int getNumStates(void) const;
92  virtual ScXMLStateElt * getState(int idx) const;
93  virtual void addState(ScXMLStateElt * state);
94  virtual void removeState(ScXMLStateElt * state);
95  virtual void clearAllStates(void);
96 
97  // parallel storage
98  virtual int getNumParallels(void) const;
99  virtual ScXMLParallelElt * getParallel(int idx) const;
100  virtual void addParallel(ScXMLParallelElt * state);
101  virtual void removeParallel(ScXMLParallelElt * state);
102  virtual void clearAllParallels(void);
103 
104  // final storage
105  virtual int getNumFinals(void) const;
106  virtual ScXMLFinalElt * getFinal(int idx) const;
107  virtual void addFinal(ScXMLFinalElt * state);
108  virtual void removeFinal(ScXMLFinalElt * state);
109  virtual void clearAllFinals(void);
110 
111  // datamodel
112  virtual void setDataModel(ScXMLDataModelElt * datamodel);
113  virtual ScXMLDataModelElt * getDataModel(void) const;
114 
115  // script storage
116  virtual int getNumScripts(void) const;
117  virtual ScXMLScriptElt * getScript(int idx) const;
118  virtual void addScript(ScXMLScriptElt * state);
119  virtual void removeScript(ScXMLScriptElt * state);
120  virtual void clearAllScripts(void);
121 
122  virtual void execute(ScXMLStateMachine * statemachine) const;
123 
124 protected:
125  SbBool referenced;
126 
127  char * initial;
128  char * name;
129  char * xmlns;
130  char * version;
131  char * profile;
132  char * exmode;
133 
134 private:
135  ScXMLScxmlElt(const ScXMLScxmlElt & rhs); // N/A
136  ScXMLScxmlElt & operator = (const ScXMLScxmlElt & rhs); // N/A
137 
138  class PImpl;
139  SbPimplPtr<PImpl> pimpl;
140 
141 }; // ScXMLScxmlElt
142 
143 #endif // COIN_SCXMLSCXMLELT_H
implements the <final> SCXML element.
Definition: ScXMLFinalElt.h:42
implements the <script> SCXML element.
Definition: ScXMLScriptElt.h:40
virtual const ScXMLElt * search(const char *attrname, const char *attrvalue) const
Definition: ScXMLElt.cpp:214
implements the <initial> SCXML element.
Definition: ScXMLInitialElt.h:41
implements the <state> SCXML element.
Definition: ScXMLStateElt.h:51
implements the <datamodel> SCXML element.
Definition: ScXMLDataModelElt.h:42
implements the <scxml> SCXML element.
Definition: ScXMLScxmlElt.h:47
base class for all SCXML elements.
Definition: ScXMLElt.h:44
virtual SbBool handleXMLAttributes(void)
Definition: ScXMLElt.cpp:200
Base class for all SCXML objects.
Definition: ScXMLObject.h:41
implements the <parallel> SCXML element.
Definition: ScXMLParallelElt.h:51
Manager for processing events and setting states in SCXML structures.
Definition: ScXMLStateMachine.h:61