Update of /cvsroot/robotflow/RobotFlow/MARIE/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16162
Modified Files:
Makefile.am
Added Files:
newMarieCommandBehavior.cpp
Log Message:
added newMarieCommandBehavior.cpp
Index: Makefile.am
===================================================================
RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/Makefile.am,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** Makefile.am 22 Sep 2004 20:24:51 -0000 1.17
--- Makefile.am 26 Oct 2004 19:47:03 -0000 1.18
***************
*** 28,32 ****
newMarieDataMap.cpp \
MarieRequestSystem.cpp \
! newMarieRequestSystem.cpp
install-data-local:
--- 28,33 ----
newMarieDataMap.cpp \
MarieRequestSystem.cpp \
! newMarieRequestSystem.cpp \
! newMarieCommandBehavior.cpp
install-data-local:
--- NEW FILE: newMarieCommandBehavior.cpp ---
/*
* MARIE - Mobile and Autonomous Robotics Integration Environment
* Copyright (C) 2004 Dominic Letourneau / Carle Cote
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* You can contact MARIE development team at http://marie.sourceforge.net
*/
#include <sstream>
#include <string>
#include "MarieCommandBehavior.h"
#include "MarieXMLDataFactory.h"
#include "Behavior.h"
#include "Vector.h"
#include "MarieDataNull.h"
namespace marie
{
//forward declaration
class newMarieCommandBehavior;
DECLARE_NODE(newMarieCommandBehavior)
/*Node
*
* @name newMarieCommandBehavior
* @category RobotFlow:MARIE:COMMAND
* @description Create an object of type MarieCommandBehavior
*
* @input_name BEHAVIOR_NAME
* @input_type string
* @input_description The behavior name that will be activated/deactivated
*
* @input_name BEHAVIOR_ACTIVATION
* @input_type bool
* @input_description true if the specified behavior is activated
*
* @output_name COMMAND_BEHAVIOR
* @output_description Output MARIE BehaviorCommand data object
* @output_type MarieCommandBahavior
*
END*/
using namespace std;
class newMarieCommandBehavior : public BufferedNode
{
private:
//intputs
int m_behaviorNameID;
int m_behaviorActivationID;
//outputs
int m_behaviorCommandID;
public:
newMarieCommandBehavior(string nodeName, ParameterSet params)
: BufferedNode(nodeName,params)
{
//inputs
m_behaviorNameID = addInput("BEHAVIOR_NAME");
m_behaviorActivationID = addInput("BEHAVIOR_ACTIVATION");
//outputs
m_behaviorCommandID = addOutput("COMMAND_BEHAVIOR");
}
void calculate(int output_id, int count, Buffer &out)
{
ObjectRef BehaviorNameValue = getInput(m_behaviorNameID,count);
ObjectRef BehaviorActivationValue = getInput(m_behaviorActivationID,count);
if (!BehaviorNameValue->isNil() && !BehaviorActivationValue->isNil()) {
RCPtr<String> name = BehaviorNameValue;
RCPtr<Bool> activation = BehaviorActivationValue;
MarieCommandBehavior *cb = new MarieCommandBehavior();
cb->setActivation(name->val(), activation->val());
out[count] = ObjectRef(cb);
}
else {
out[count] = ObjectRef(new MarieDataNull());
}
}
};//class newMarieCommandBehavior
}//namespace marie
|