Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
ScXMLStateElt.h
1 #ifndef COIN_SCXMLSTATEELT_H
2 #define COIN_SCXMLSTATEELT_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/ScXMLAbstractStateElt.h>
37 #include <Inventor/tools/SbPimplPtr.h>
38 
39 class ScXMLOnEntryElt;
40 class ScXMLOnExitElt;
41 class ScXMLTransitionElt;
42 class ScXMLStateElt;
43 class ScXMLParallelElt;
44 class ScXMLInitialElt;
45 class ScXMLFinalElt;
46 class ScXMLHistoryElt;
47 class ScXMLDataModelElt;
48 class ScXMLAnchorElt;
49 class ScXMLStateMachine;
50 
51 class COIN_DLL_API ScXMLStateElt : public ScXMLAbstractStateElt {
53  SCXML_ELEMENT_HEADER(ScXMLStateElt)
54 
55 public:
56  static void initClass(void);
57  static void cleanClass(void);
58 
59  ScXMLStateElt(void);
60  virtual ~ScXMLStateElt(void);
61 
62  // XML attributes
63  virtual void setSrcAttribute(const char * src);
64  const char * getSrcAttribute(void) const { return this->src; }
65 
66  virtual void setInitialAttribute(const char * initial);
67  const char * getInitialAttribute(void) const { return this->initial; }
68 
69  virtual SbBool handleXMLAttributes(void);
70 
71  virtual void copyContents(const ScXMLElt * rhs);
72 
73  virtual const ScXMLElt * search(const char * attrname, const char * attrvalue) const;
74 
75  // children...
76  virtual void setOnEntry(ScXMLOnEntryElt * onentry);
77  virtual ScXMLOnEntryElt * getOnEntry(void) const;
78 
79  virtual void setOnExit(ScXMLOnExitElt * onexit);
80  virtual ScXMLOnExitElt * getOnExit(void) const;
81 
82  virtual int getNumTransitions(void) const;
83  virtual ScXMLTransitionElt * getTransition(int idx) const;
84  virtual void addTransition(ScXMLTransitionElt * transition);
85  virtual void removeTransition(ScXMLTransitionElt * transition);
86  virtual void clearAllTransitions(void);
87 
88  virtual void setInitial(ScXMLInitialElt * initial);
89  virtual ScXMLInitialElt * getInitial(void) const;
90 
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  virtual int getNumParallels(void) const;
98  virtual ScXMLParallelElt * getParallel(int idx) const;
99  virtual void addParallel(ScXMLParallelElt * state);
100  virtual void removeParallel(ScXMLParallelElt * state);
101  virtual void clearAllParallels(void);
102 
103  virtual int getNumFinals(void) const;
104  virtual ScXMLFinalElt * getFinal(int idx) const;
105  virtual void addFinal(ScXMLFinalElt * state);
106  virtual void removeFinal(ScXMLFinalElt * state);
107  virtual void clearAllFinals(void);
108 
109  virtual int getNumHistories(void) const;
110  virtual ScXMLHistoryElt * getHistory(int idx) const;
111  virtual void addHistory(ScXMLHistoryElt * history);
112  virtual void removeHistory(ScXMLHistoryElt * history);
113  virtual void clearAllHistories(void);
114 
115  virtual int getNumAnchors(void) const;
116  virtual ScXMLAnchorElt * getAnchor(int idx) const;
117  virtual void addAnchor(ScXMLAnchorElt * anchor);
118  virtual void removeAnchor(ScXMLAnchorElt * anchor);
119  virtual void clearAllAnchors(void);
120 
121  virtual void setDataModel(ScXMLDataModelElt * datamodel);
122  virtual ScXMLDataModelElt * getDataModel(void) const;
123 
124  SbBool isAtomicState(void) const;
125 
126 protected:
127  char * src;
128  char * initial;
129 
130 private:
131  ScXMLStateElt(const ScXMLStateElt & rhs); // N/A
132  ScXMLStateElt & operator = (const ScXMLStateElt & rhs); // N/A
133 
134  class PImpl;
135  SbPimplPtr<PImpl> pimpl;
136 
137 }; // ScXMLStateElt
138 
139 #endif // !COIN_SCXMLSTATEELT_H
implements the <final> SCXML element.
Definition: ScXMLFinalElt.h:42
implements the <anchor> SCXML element.
Definition: ScXMLAnchorElt.h:40
virtual const ScXMLElt * search(const char *attrname, const char *attrvalue) const
Definition: ScXMLAbstractStateElt.cpp:117
implements the <onexit> SCXML element.
Definition: ScXMLOnExitElt.h:43
implements the <initial> SCXML element.
Definition: ScXMLInitialElt.h:41
implements the <state> SCXML element.
Definition: ScXMLStateElt.h:51
the <transition> SCXML element.
Definition: ScXMLTransitionElt.h:43
implements the <datamodel> SCXML element.
Definition: ScXMLDataModelElt.h:42
implements the <history> SCXML element.
Definition: ScXMLHistoryElt.h:42
abstract base class for the SCXML &#39;state&#39; elements.
Definition: ScXMLAbstractStateElt.h:40
base class for all SCXML elements.
Definition: ScXMLElt.h:44
virtual SbBool handleXMLAttributes(void)
Definition: ScXMLAbstractStateElt.cpp:90
const char * getInitialAttribute(void) const
Definition: ScXMLStateElt.h:67
implements the <onentry> SCXML element.
Definition: ScXMLOnEntryElt.h:43
implements the <parallel> SCXML element.
Definition: ScXMLParallelElt.h:51
Manager for processing events and setting states in SCXML structures.
Definition: ScXMLStateMachine.h:61
const char * getSrcAttribute(void) const
Definition: ScXMLStateElt.h:64