StateInstanceFactory.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package ArmarXGui
17 * @author Mirko Waechter ( mirko.waechter at kit dot edu)
18 * @date 2016
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 
24 #pragma once
25 
26 #include "DynamicRemoteState.h"
27 #include "LocalState.h"
28 #include "EndState.h"
29 #include "RemoteState.h"
30 
32 
34 {
36  {
37  public:
38  static StateInstancePtr CreateFromIceType(eStateType type, StatePtr stateClass, const QString& instanceName, StatePtr parentState = StatePtr(), const QString& proxyName = "")
39  {
40  switch (type)
41  {
42  case eNormalState:
43  return StateInstancePtr(new LocalState(stateClass, instanceName, parentState));
44  case eFinalState:
45  return StateInstancePtr(new EndState(instanceName, instanceName, parentState));
46  case eRemoteState:
47  return StateInstancePtr(new RemoteState(stateClass, proxyName, instanceName, parentState));
48  case eDynamicRemoteState:
49  return StateInstancePtr(new DynamicRemoteState(stateClass, instanceName, parentState));
50  case eUndefined:
51  default:
52  throw LocalException("No StateInstanceFactory available for this type: ") << type;
53  }
54  }
55  };
56 }
EndState.h
armarx::statechartmodel::RemoteState
Definition: RemoteState.h:28
armarx::statechartmodel::StateInstanceFactory
Definition: StateInstanceFactory.h:35
armarx::statechartmodel::StateInstanceFactory::CreateFromIceType
static StateInstancePtr CreateFromIceType(eStateType type, StatePtr stateClass, const QString &instanceName, StatePtr parentState=StatePtr(), const QString &proxyName="")
Definition: StateInstanceFactory.h:38
armarx::statechartmodel::StateInstancePtr
std::shared_ptr< StateInstance > StateInstancePtr
Definition: StateInstance.h:138
armarx::statechartmodel::DynamicRemoteState
Definition: DynamicRemoteState.h:29
armarx::statechartmodel
Definition: XmlWriter.h:36
RemoteState.h
LocalState.h
armarx::statechartmodel::EndState
Definition: EndState.h:28
armarx::statechartmodel::StatePtr
std::shared_ptr< State > StatePtr
Definition: State.h:46
armarx::statechartmodel::LocalState
Definition: LocalState.h:31
Exception.h
DynamicRemoteState.h