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 
27 
28 #include "DynamicRemoteState.h"
29 #include "EndState.h"
30 #include "LocalState.h"
31 #include "RemoteState.h"
32 
34 {
36  {
37  public:
38  static StateInstancePtr
39  CreateFromIceType(eStateType type,
40  StatePtr stateClass,
41  const QString& instanceName,
42  StatePtr parentState = StatePtr(),
43  const QString& proxyName = "")
44  {
45  switch (type)
46  {
47  case eNormalState:
48  return StateInstancePtr(new LocalState(stateClass, instanceName, parentState));
49  case eFinalState:
50  return StateInstancePtr(new EndState(instanceName, instanceName, parentState));
51  case eRemoteState:
52  return StateInstancePtr(
53  new RemoteState(stateClass, proxyName, instanceName, parentState));
54  case eDynamicRemoteState:
55  return StateInstancePtr(
56  new DynamicRemoteState(stateClass, instanceName, parentState));
57  case eUndefined:
58  default:
59  throw LocalException("No StateInstanceFactory available for this type: ")
60  << type;
61  }
62  }
63  };
64 } // namespace armarx::statechartmodel
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:39
armarx::statechartmodel::StateInstancePtr
std::shared_ptr< StateInstance > StateInstancePtr
Definition: StateInstance.h:146
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:48
armarx::statechartmodel::LocalState
Definition: LocalState.h:31
Exception.h
DynamicRemoteState.h