| http://www.sim.no/ http://www.coin3d.org/

ScXMLStateMachine.h
1 #ifndef COIN_SCXMLSTATEMACHINE_H
2 #define COIN_SCXMLSTATEMACHINE_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <Inventor/scxml/ScXMLObject.h>
28
29 #include <Inventor/SbName.h>
30 #include <Inventor/tools/SbPimplPtr.h>
31
32 class ScXMLEvent;
33 class ScXMLDocument;
34 class ScXMLStateMachine;
35
36 typedef void ScXMLStateMachineDeleteCB(void * userdata,
37 ScXMLStateMachine * statemachine);
38 typedef void ScXMLStateChangeCB(void * userdata,
39 ScXMLStateMachine * statemachine,
40 const char * stateidentifier,
41 SbBool enterstate,
42 SbBool success);
43
44 class COIN_DLL_API ScXMLStateMachine : public ScXMLObject {
45 typedef ScXMLObject inherited;
46 SCXML_OBJECT_HEADER(ScXMLStateMachine)
47
48 public:
49 static void initClass(void);
50
51 ScXMLStateMachine(void);
52 virtual ~ScXMLStateMachine(void);
53
54 virtual void setName(const SbName & name);
55 const SbName & getName(void) const;
56
57 virtual void setDescription(ScXMLDocument * document);
58 const ScXMLDocument * getDescription(void) const;
59
60 virtual void initialize(void);
61
62 virtual void queueEvent(const ScXMLEvent * event, SbBool dealloc = FALSE);
63 virtual void queueEvent(const SbName & eventid);
64 virtual SbBool processEventQueue(void);
65
66 virtual SbBool isActive(void) const;
67 virtual SbBool isFinished(void) const;
68
69 virtual const ScXMLEvent * getCurrentEvent(void) const;
70
71 virtual int getNumActiveStates(void) const;
72 virtual const ScXMLObject * getActiveState(int idx) const;
73
74 virtual const ScXMLObject * getState(const char * identifier) const;
75
76 virtual void addDeleteCallback(ScXMLStateMachineDeleteCB * callback,
77 void * userdata);
78 virtual void removeDeleteCallback(ScXMLStateMachineDeleteCB * callback,
79 void * userdata);
80
81 virtual void addStateChangeCallback(ScXMLStateChangeCB * callback,
82 void * userdata);
83 virtual void removeStateChangeCallback(ScXMLStateChangeCB * callback,
84 void * userdata);
85 protected:
86 virtual SbBool processOneEvent(const ScXMLEvent * event);
87
88 virtual void setCurrentEvent(const ScXMLEvent * event);
89
90 private:
91 ScXMLStateMachine(const ScXMLStateMachine & rhs); // N/A
92 ScXMLStateMachine & operator = (const ScXMLStateMachine & rhs); // N/A
93
94 class PImpl;
95 SbPimplPtr<PImpl> pimpl;
96
97 }; // ScXMLStateMachine
98
99 #endif // !COIN_SCXMLSTATEMACHINE_H
ScXMLEvent
Base class for events sent to SCXML state machines.
Definition: ScXMLEvent.h:29
ScXMLObject
Base class for all SCXML objects.
Definition: ScXMLObject.h:32
SbName
The SbName class stores strings by reference.The class is used by Coin for storing keywords...
Definition: SbName.h:31
ScXMLStateMachine
Manager for processing events and setting states in SCXML structures.
Definition: ScXMLStateMachine.h:44

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.