📄 operationsi.h
字号:
/*************************************************************************** tag: Peter Soetens Mon Jun 26 13:25:58 CEST 2006 ExecutionI.h ExecutionI.h - description ------------------- begin : Mon June 26 2006 copyright : (C) 2006 Peter Soetens email : peter.soetens@fmtc.be *************************************************************************** * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public * * License as published by the Free Software Foundation; * * version 2 of the License. * * * * As a special exception, you may use this file as part of a free * * software library without restriction. Specifically, if other files * * instantiate templates or use macros or inline functions from this * * file, or you compile this file and link it with other files to * * produce an executable, this file does not by itself cause the * * resulting executable to be covered by the GNU General Public * * License. This exception does not however invalidate any other * * reasons why the executable file might be covered by the GNU General * * Public License. * * * * 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 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 * * * ***************************************************************************/ // -*- C++ -*-//// $Id$// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****// TAO and the TAO IDL Compiler have been developed by:// Center for Distributed Object Computing// Washington University// St. Louis, MO// USA// http://www.cs.wustl.edu/~schmidt/doc-center.html// and// Distributed Object Computing Laboratory// University of California at Irvine// Irvine, CA// USA// http://doc.ece.uci.edu/// and// Institute for Software Integrated Systems// Vanderbilt University// Nashville, TN// USA// http://www.isis.vanderbilt.edu///// Information about TAO is available at:// http://www.cs.wustl.edu/~schmidt/TAO.html// TAO_IDL - Generated from // be/be_codegen.cpp:859// must be outside of #ifdef macro.#include "../DataSource.hpp"#ifndef INCLUDE_EXECUTIONI_H_#define INCLUDE_EXECUTIONI_H_#include "OperationsC.h"#include "OperationsS.h"#include "CorbaConversion.hpp"#include "../DispatchInterface.hpp"#include "../Logger.hpp"#include "../MethodC.hpp"#include "../DataSources.hpp"namespace RTT{ class CommandC;}#if !defined (ACE_LACKS_PRAGMA_ONCE)#pragma once#endif /* ACE_LACKS_PRAGMA_ONCE */template< class DataType>class Orocos_Expression_i : public virtual POA_RTT::Corba::Expression, public virtual PortableServer::RefCountServantBase{protected: typename RTT::DataSource<DataType>::const_ptr morig; typename RTT::DataSource<DataType>::value_t last_value; PortableServer::POA_var mpoa;public: typedef DataType SourceType; typedef typename RTT::DataSource<DataType>::value_t ResultType; // Constructor Orocos_Expression_i (typename RTT::DataSource<SourceType>::const_ptr orig, PortableServer::POA_ptr the_poa) : morig( orig ), last_value(), mpoa( PortableServer::POA::_duplicate(the_poa) ) {} PortableServer::POA_ptr _default_POA() { return PortableServer::POA::_duplicate(mpoa); } // Destructor virtual ~Orocos_Expression_i (void) {} virtual CORBA::Any* value ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return RTT::AnyConversion<ResultType>::createAny( last_value ); } virtual CORBA::Boolean evaluate ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { last_value = morig->get(); return 1; } virtual CORBA::Any * get ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return RTT::AnyConversion<ResultType>::createAny( morig->get() ); } virtual char * getType ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return CORBA::string_dup( morig->getType().c_str() ); } virtual char * toString ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { std::string result = morig->toString(); return CORBA::string_dup( result.c_str() ); } virtual char * getTypeName ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return CORBA::string_dup( morig->getTypeName().c_str() ); } virtual void destroyExpression() ACE_THROW_SPEC (( CORBA::SystemException )) { }};/** * A servant which serves a RTT::DataSource through the 'Any' methods. * This servant is inferior to the template based ones. */class Orocos_AnyExpression_i : public virtual POA_RTT::Corba::Expression, public virtual PortableServer::RefCountServantBase{protected: RTT::DataSourceBase::shared_ptr morig; CORBA::Any_var last_value; PortableServer::POA_var mpoa;public: typedef RTT::DataSourceBase::const_ptr SourceType; typedef CORBA::Any ResultType; virtual void copy( RTT::DataSourceBase::shared_ptr new_ds ) { morig = new_ds; } // Constructor Orocos_AnyExpression_i (RTT::DataSourceBase::shared_ptr orig, PortableServer::POA_ptr the_poa) : morig( orig ), last_value( morig->createAny() ) // create default Any. , mpoa( PortableServer::POA::_duplicate(the_poa) ) {} PortableServer::POA_ptr _default_POA() { return PortableServer::POA::_duplicate(mpoa); } // Destructor virtual ~Orocos_AnyExpression_i (void) {} virtual CORBA::Any* value ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return new CORBA::Any( last_value.in() ); } virtual CORBA::Boolean evaluate ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { last_value = morig->getAny(); bool result = true; // if it is a bool, update result and return it, otherwise, just return true: RTT::AnyConversion<bool>::update( last_value.in(), result ); return result; } virtual CORBA::Any * get ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return morig->getAny(); } virtual char * getType ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return CORBA::string_dup( morig->getType().c_str() ); } virtual char * toString ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { std::string result = morig->toString(); return CORBA::string_dup( result.c_str() ); } virtual char * getTypeName ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return CORBA::string_dup( morig->getTypeName().c_str() ); } virtual void destroyExpression() ACE_THROW_SPEC (( CORBA::SystemException )) { }};template<>class Orocos_Expression_i<void> : public virtual POA_RTT::Corba::Expression, public virtual PortableServer::RefCountServantBase{protected: RTT::DataSource<void>::shared_ptr morig; PortableServer::POA_var mpoa;public: typedef void SourceType; typedef void ResultType; // Constructor Orocos_Expression_i (RTT::DataSource<void>::shared_ptr orig, PortableServer::POA_ptr the_poa) : morig( orig ), mpoa( PortableServer::POA::_duplicate(the_poa) ) {} PortableServer::POA_ptr _default_POA() { return PortableServer::POA::_duplicate(mpoa); } // Destructor virtual ~Orocos_Expression_i (void) {} virtual CORBA::Any* value ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return new CORBA::Any(); } virtual CORBA::Boolean evaluate ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { morig->get(); return 1; } virtual CORBA::Any * get ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { morig->get(); return new CORBA::Any(); } virtual char * getType ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return CORBA::string_dup( morig->getType().c_str() ); } virtual char * toString ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { std::string result = morig->toString(); return CORBA::string_dup( result.c_str() ); } virtual char * getTypeName ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return CORBA::string_dup( morig->getTypeName().c_str() ); } virtual void destroyExpression() ACE_THROW_SPEC (( CORBA::SystemException )) { }};template< class DataType>class Orocos_AssignableExpression_i : public virtual POA_RTT::Corba::AssignableExpression, public virtual PortableServer::RefCountServantBase{ typename RTT::AssignableDataSource<DataType>::shared_ptr massign; typename RTT::DataSource<DataType>::value_t last_value; PortableServer::POA_var mpoa;public: typedef DataType SourceType; typedef typename RTT::DataSource<DataType>::value_t ResultType; // Constructor Orocos_AssignableExpression_i (typename RTT::AssignableDataSource<SourceType>::shared_ptr assign, PortableServer::POA_ptr the_poa ) : massign( assign ), last_value(), mpoa( PortableServer::POA::_duplicate(the_poa) ) {} PortableServer::POA_ptr _default_POA() { return PortableServer::POA::_duplicate(mpoa); } // Destructor virtual ~Orocos_AssignableExpression_i (void) {} virtual CORBA::Boolean set ( const ::CORBA::Any & value ) ACE_THROW_SPEC (( CORBA::SystemException )) { if ( !RTT::AnyConversion<ResultType>::update( value, last_value ) ) { RTT::log(RTT::Error) << "Corba::AssignableExpression: Could not assign Any to "<<massign->getType() <<"." <<RTT::endlog() <<" Tried to assign as "<< RTT::DataSource<ResultType>::GetType() << " to native type "<< RTT::DataSource<SourceType>::GetType()<< RTT::endlog(); return false; } massign->set(last_value); return true; } virtual CORBA::Boolean fromString ( const char* value ) ACE_THROW_SPEC (( CORBA::SystemException )) { if ( !massign->getTypeInfo()->fromString( value, massign ) ) { RTT::log(RTT::Error) << "Corba::AssignableExpression: Could not assign string to "<<massign->getType() <<"." <<RTT::endlog() <<" Tried to assign as "<< RTT::DataSource<ResultType>::GetType() << " to native type "<< RTT::DataSource<SourceType>::GetType()<< RTT::endlog(); return false; } return true; } virtual CORBA::Any* value ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return RTT::AnyConversion<ResultType>::createAny( last_value ); } virtual CORBA::Boolean evaluate ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { last_value = massign->get(); return 1; } virtual CORBA::Any * get ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return RTT::AnyConversion<ResultType>::createAny( massign->get() ); } virtual char * getType ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return CORBA::string_dup( massign->getType().c_str() ); } virtual char * toString ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { std::string result = massign->toString(); return CORBA::string_dup( result.c_str() ); } virtual char * getTypeName ( ) ACE_THROW_SPEC (( CORBA::SystemException )) { return CORBA::string_dup( massign->getTypeName().c_str() ); } virtual void destroyExpression() ACE_THROW_SPEC (( CORBA::SystemException )) { }};class Orocos_AnyAssignableExpression_i : public Orocos_AnyExpression_i, public virtual POA_RTT::Corba::AssignableExpression{ RTT::DataSourceBase::shared_ptr mset;public: virtual void copy( RTT::DataSourceBase::shared_ptr new_ds ) { mset = new_ds; morig = new_ds; } // Constructor Orocos_AnyAssignableExpression_i (RTT::DataSourceBase::shared_ptr orig, PortableServer::POA_ptr the_poa) : Orocos_AnyExpression_i(orig, the_poa), mset( orig ) {} // Destructor virtual ~Orocos_AnyAssignableExpression_i (void) {} virtual CORBA::Boolean set ( const ::CORBA::Any & value ) ACE_THROW_SPEC (( CORBA::SystemException )) { return mset->update( value );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -