RegularState.cpp
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 ArmarX::
17 * @author Mirko Waechter ( mirko.waechter at kit dot edu)
18 * @date 2014
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #include "../State.h"
24 #include "RegularState.h"
25 #include "Visitor.h"
26 
28 {
29 
30  RegularState::RegularState(StatePtr stateClass, const QString& instanceName, StatePtr parentState) :
31  StateInstance(instanceName, parentState)
32  , stateClass(stateClass)
33  {
34  if (stateClass)
35  {
36  stateClassUUID = stateClass->getUUID();
37  setStateClass(stateClass);
38  }
39  }
40 
41  RegularState::RegularState(const QString& stateClassUUID, const QString& instanceName, StatePtr parentState) :
42  StateInstance(instanceName, parentState),
43  stateClassUUID(stateClassUUID)
44  {}
45 
47  {
48  return stateClass;
49  }
50 
52  {
53  if (newStateClass)
54  {
55  if (stateClass)
56  {
57  // TODO check if disconnect works
58  disconnect(stateClass.get(), SIGNAL(resized()), this, SLOT(updateScale()));
59  }
60 
61  stateClass = newStateClass;
62  connect(stateClass.get(), SIGNAL(resized()), this, SLOT(updateScale()));
63  }
64  }
65 }
armarx::statechartmodel::StateInstance::updateScale
void updateScale()
Definition: StateInstance.cpp:208
armarx::statechartmodel::StateInstance
Definition: StateInstance.h:44
Visitor.h
RegularState.h
armarx::statechartmodel
Definition: XmlWriter.h:36
armarx::statechartmodel::RegularState::getStateClass
StatePtr getStateClass() const override
Definition: RegularState.cpp:46
armarx::statechartmodel::StatePtr
std::shared_ptr< State > StatePtr
Definition: State.h:46
armarx::statechartmodel::RegularState::RegularState
RegularState(StatePtr stateClass, const QString &instanceName, StatePtr parentState=StatePtr())
Definition: RegularState.cpp:30
armarx::statechartmodel::RegularState::setStateClass
void setStateClass(StatePtr newStateClass)
Definition: RegularState.cpp:51