VertexNode.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002   tag: Peter Soetens  Mon May 10 19:10:37 CEST 2004  VertexNode.cxx
00003 
00004                         VertexNode.cxx -  description
00005                            -------------------
00006     begin                : Mon May 10 2004
00007     copyright            : (C) 2004 Peter Soetens
00008     email                : peter.soetens@mech.kuleuven.ac.be
00009 
00010  ***************************************************************************
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU General Public                   *
00013  *   License as published by the Free Software Foundation;                 *
00014  *   version 2 of the License.                                             *
00015  *                                                                         *
00016  *   As a special exception, you may use this file as part of a free       *
00017  *   software library without restriction.  Specifically, if other files   *
00018  *   instantiate templates or use macros or inline functions from this     *
00019  *   file, or you compile this file and link it with other files to        *
00020  *   produce an executable, this file does not by itself cause the         *
00021  *   resulting executable to be covered by the GNU General Public          *
00022  *   License.  This exception does not however invalidate any other        *
00023  *   reasons why the executable file might be covered by the GNU General   *
00024  *   Public License.                                                       *
00025  *                                                                         *
00026  *   This library is distributed in the hope that it will be useful,       *
00027  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00028  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00029  *   Lesser General Public License for more details.                       *
00030  *                                                                         *
00031  *   You should have received a copy of the GNU General Public             *
00032  *   License along with this library; if not, write to the Free Software   *
00033  *   Foundation, Inc., 59 Temple Place,                                    *
00034  *   Suite 330, Boston, MA  02111-1307  USA                                *
00035  *                                                                         *
00036  ***************************************************************************/
00037 #include "VertexNode.hpp"
00038 #include "CommandNOP.hpp"
00039 #include "../base/ActionInterface.hpp"
00040 #include "../internal/DataSource.hpp"
00041 
00042 namespace RTT {
00043     using namespace detail;
00044 
00045 
00046         VertexNode::VertexNode()
00047         : command( new CommandNOP ),
00048           lineNumber( 0 )
00049         {
00050         }
00051 
00052         VertexNode::VertexNode( const VertexNode& orig )
00053                 : command( orig.getCommand()->clone() ),
00054                   lineNumber(orig.getLineNumber())
00055         {
00056         }
00057 
00058         VertexNode::VertexNode(ActionInterface* cmd)
00059         : command( cmd ),
00060           lineNumber( 0 )
00061         {
00062         }
00063 
00064         VertexNode::~VertexNode()
00065         {
00066                 delete command;
00067         }
00068 
00069 
00070         bool VertexNode::execute()
00071         {
00076                 return command->execute();
00077         }
00078 
00079     bool VertexNode::isValid() const {
00080         return command->valid();
00081     }
00082 
00083         ActionInterface* VertexNode::getCommand() const
00084         {
00085                 return command;
00086         }
00087 
00088         ActionInterface* VertexNode::setCommand(ActionInterface* cmd)
00089         {
00090         ActionInterface* old = command;
00091                 command = cmd;
00092         return old;
00093         }
00094 
00095         void VertexNode::setLineNumber(int ln)
00096         {
00097                 lineNumber = ln ;
00098         }
00099 
00100         int VertexNode::getLineNumber() const
00101         {
00102                 return lineNumber;
00103         }
00104 
00105     void VertexNode::startExecution()
00106     {
00107         // reset the command
00108         command->reset();
00109         command->readArguments();
00110     }
00111 
00112     VertexNode VertexNode::copy( std::map<const DataSourceBase*, DataSourceBase*>& rdss ) const
00113     {
00114         VertexNode ret( *this );
00115         delete ret.setCommand( getCommand()->copy( rdss ) );
00116         return ret;
00117     }
00118 
00119     VertexNode& VertexNode::operator=( const VertexNode& orig )
00120     {
00121         if ( &orig == this)
00122             return *this;
00123         delete command;
00124         command = orig.getCommand()->clone();
00125         lineNumber = orig.getLineNumber();
00126         return *this;
00127     }
00128 }


rtt
Author(s): RTT Developers
autogenerated on Sat Jun 8 2019 18:46:34