VertexNode.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Mon May 10 19:10:37 CEST 2004 VertexNode.cxx
3 
4  VertexNode.cxx - description
5  -------------------
6  begin : Mon May 10 2004
7  copyright : (C) 2004 Peter Soetens
8  email : peter.soetens@mech.kuleuven.ac.be
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public *
13  * License as published by the Free Software Foundation; *
14  * version 2 of the License. *
15  * *
16  * As a special exception, you may use this file as part of a free *
17  * software library without restriction. Specifically, if other files *
18  * instantiate templates or use macros or inline functions from this *
19  * file, or you compile this file and link it with other files to *
20  * produce an executable, this file does not by itself cause the *
21  * resulting executable to be covered by the GNU General Public *
22  * License. This exception does not however invalidate any other *
23  * reasons why the executable file might be covered by the GNU General *
24  * Public License. *
25  * *
26  * This library is distributed in the hope that it will be useful, *
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
29  * Lesser General Public License for more details. *
30  * *
31  * You should have received a copy of the GNU General Public *
32  * License along with this library; if not, write to the Free Software *
33  * Foundation, Inc., 59 Temple Place, *
34  * Suite 330, Boston, MA 02111-1307 USA *
35  * *
36  ***************************************************************************/
37 #include "VertexNode.hpp"
38 #include "CommandNOP.hpp"
39 #include "../base/ActionInterface.hpp"
40 #include "../internal/DataSource.hpp"
41 
42 namespace RTT {
43  using namespace detail;
44 
45 
47  : command( new CommandNOP ),
48  lineNumber( 0 )
49  {
50  }
51 
53  : command( orig.getCommand()->clone() ),
55  {
56  }
57 
59  : command( cmd ),
60  lineNumber( 0 )
61  {
62  }
63 
65  {
66  delete command;
67  }
68 
69 
71  {
76  return command->execute();
77  }
78 
79  bool VertexNode::isValid() const {
80  return command->valid();
81  }
82 
84  {
85  return command;
86  }
87 
89  {
90  ActionInterface* old = command;
91  command = cmd;
92  return old;
93  }
94 
96  {
97  lineNumber = ln ;
98  }
99 
101  {
102  return lineNumber;
103  }
104 
106  {
107  // reset the command
108  command->reset();
110  }
111 
112  VertexNode VertexNode::copy( std::map<const DataSourceBase*, DataSourceBase*>& rdss ) const
113  {
114  VertexNode ret( *this );
115  delete ret.setCommand( getCommand()->copy( rdss ) );
116  return ret;
117  }
118 
120  {
121  if ( &orig == this)
122  return *this;
123  delete command;
124  command = orig.getCommand()->clone();
125  lineNumber = orig.getLineNumber();
126  return *this;
127  }
128 }
base::ActionInterface * getCommand() const
Definition: VertexNode.cpp:83
virtual void readArguments()=0
virtual bool valid() const
VertexNode copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &rdss) const
Definition: VertexNode.cpp:112
virtual ActionInterface * clone() const =0
base::ActionInterface * setCommand(base::ActionInterface *c)
Definition: VertexNode.cpp:88
virtual bool execute()=0
Based on the software pattern &#39;command&#39;, this interface allows execution of action objects...
VertexNode & operator=(const VertexNode &orig)
Definition: VertexNode.cpp:119
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
base::ActionInterface * command
Definition: VertexNode.hpp:186


rtt
Author(s): RTT Developers
autogenerated on Tue Jun 25 2019 19:33:38