1 #ifndef COIN_SCXMLPARALLELELT_H
2 #define COIN_SCXMLPARALLELELT_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 ScXMLEvent;
40 class ScXMLStateMachine;
41 class ScXMLOnEntryElt;
42 class ScXMLOnExitElt;
43 class ScXMLTransitionElt;
44 class ScXMLStateElt;
45 class ScXMLInitialElt;
46 class ScXMLFinalElt;
47 class ScXMLHistoryElt;
48 class ScXMLAnchorElt;
49 class ScXMLDataModelElt;
50 
51 class COIN_DLL_API ScXMLParallelElt : public ScXMLAbstractStateElt {
52   typedef ScXMLAbstractStateElt inherited;
53   SCXML_ELEMENT_HEADER(ScXMLElt)
54 
55 public:
56   static void initClass(void);
57   static void cleanClass(void);
58 
59   ScXMLParallelElt(void);
60   virtual ~ScXMLParallelElt(void);
61 
62   // XML attributes
63   virtual void setSrcAttribute(const char * src);
getSrcAttribute(void)64   const char * getSrcAttribute(void) const { return this->src; }
65 
66   virtual SbBool handleXMLAttributes(void);
67 
68   virtual void copyContents(const ScXMLElt * rhs);
69 
70   virtual const ScXMLElt * search(const char * attrname, const char * attrvalue) const;
71 
72   // children...
73   virtual void setOnEntry(ScXMLOnEntryElt * onentry);
74   virtual ScXMLOnEntryElt * getOnEntry(void) const;
75 
76   virtual void setOnExit(ScXMLOnExitElt * onexit);
77   virtual ScXMLOnExitElt * getOnExit(void) const;
78 
79   virtual int getNumTransitions(void) const;
80   virtual ScXMLTransitionElt * getTransition(int idx) const;
81   virtual void addTransition(ScXMLTransitionElt * transition);
82   virtual void removeTransition(ScXMLTransitionElt * transition);
83   virtual void clearAllTransitions(void);
84 
85   virtual void setInitial(ScXMLInitialElt * initial);
86   virtual ScXMLInitialElt * getInitial(void) const;
87 
88   virtual int getNumStates(void) const;
89   virtual ScXMLStateElt * getState(int idx) const;
90   virtual void addState(ScXMLStateElt * state);
91   virtual void removeState(ScXMLStateElt * state);
92   virtual void clearAllStates(void);
93 
94   virtual int getNumParallels(void) const;
95   virtual ScXMLParallelElt * getParallel(int idx) const;
96   virtual void addParallel(ScXMLParallelElt * state);
97   virtual void removeParallel(ScXMLParallelElt * state);
98   virtual void clearAllParallels(void);
99 
100   virtual int getNumFinals(void) const;
101   virtual ScXMLFinalElt * getFinal(int idx) const;
102   virtual void addFinal(ScXMLFinalElt * state);
103   virtual void removeFinal(ScXMLFinalElt * state);
104   virtual void clearAllFinals(void);
105 
106   virtual int getNumHistories(void) const;
107   virtual ScXMLHistoryElt * getHistory(int idx) const;
108   virtual void addHistory(ScXMLHistoryElt * history);
109   virtual void removeHistory(ScXMLHistoryElt * history);
110   virtual void clearAllHistories(void);
111 
112   virtual int getNumAnchors(void) const;
113   virtual ScXMLAnchorElt * getAnchor(int idx) const;
114   virtual void addAnchor(ScXMLAnchorElt * anchor);
115   virtual void removeAnchor(ScXMLAnchorElt * anchor);
116   virtual void clearAllAnchors(void);
117 
118   virtual void setDataModel(ScXMLDataModelElt * datamodel);
119   virtual ScXMLDataModelElt * getDataModel(void) const;
120 
121   SbBool isAtomicState(void) const;
122 
123 protected:
124   char * src;
125 
126 private:
127   ScXMLParallelElt(const ScXMLParallelElt & rhs); // N/A
128   ScXMLParallelElt & operator = (const ScXMLParallelElt & rhs); // N/A
129 
130   class PImpl;
131   SbPimplPtr<PImpl> pimpl;
132 
133 }; // ScXMLParallelElt
134 
135 #endif // !COIN_SCXMLPARALLELELT_H
136