CorbaTemplateProtocol.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: FMTC Tue Mar 11 21:49:24 CET 2008 CorbaTemplateProtocol.hpp
3 
4  CorbaTemplateProtocol.hpp - description
5  -------------------
6  begin : Tue March 11 2008
7  copyright : (C) 2008 FMTC
8  email : peter.soetens@fmtc.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 
38 
39 #ifndef ORO_CORBA_TEMPATE_PROTOCOL_HPP
40 #define ORO_CORBA_TEMPATE_PROTOCOL_HPP
41 
42 #include "CorbaTypeTransporter.hpp"
43 #include "RemoteChannelElement.hpp"
44 #include "../../types/Types.hpp"
45 #include "../../InputPort.hpp"
46 #include "../../OutputPort.hpp"
47 #include "ServiceC.h"
48 #include "DataFlowI.h"
49 #include "../../internal/ConnID.hpp"
50 #include "DataSourceProxy.hpp"
51 
52 namespace RTT
53 { namespace corba
54  {
58  template<class T>
60  : public CorbaTypeTransporter
61  {
62  public:
66  typedef T UserType;
71 
72  CRemoteChannelElement_i* createChannelElement_i(DataFlowInterface* sender, PortableServer::POA_ptr poa, const ConnPolicy &policy) const
73  { return new RemoteChannelElement<T>(*this, sender, poa, policy); }
74 
78  virtual CORBA::Any* createAny( base::DataSourceBase::shared_ptr source) const
79  {
81  if ( d ) {
82  if ( !d->evaluate() ) return 0;
84  }
85 
86  return 0;
87  }
88 
92  virtual bool updateAny( base::DataSourceBase::shared_ptr source, CORBA::Any& any) const
93  {
95  if ( d ) {
96  if ( !d->evaluate() ) return false;
98  }
99 
100  return false;
101  }
102 
103  virtual base::DataSourceBase::shared_ptr createDataSource(const CORBA::Any* any) const
104  {
106  if ( updateFromAny(any, result) )
107  return result;
109  }
110 
114  virtual bool updateFromAny(const CORBA::Any* any, base::DataSourceBase::shared_ptr target) const
115  {
117  if ( ad ) {
118  if ( AnyConversion<PropertyType>::update(*any, ad->set() ) ) {
119  ad->updated();
120  return true;
121  }
122  }
123 
124  return false;
125  }
126 
127  virtual base::DataSourceBase::shared_ptr createPropertyDataSource(CService_ptr serv, const std::string& vname) {
129  }
130 
131  virtual base::DataSourceBase::shared_ptr createAttributeDataSource(CService_ptr serv, const std::string& vname, bool is_assignable) {
132  if ( is_assignable ) {
133  return base::DataSourceBase::shared_ptr( new ValueDataSourceProxy<PropertyType>( serv, vname, false) );
134  }
135  else {
136  return base::DataSourceBase::shared_ptr( new DataSourceProxy<PropertyType>( serv, vname, false ) );
137  }
138  }
139  };
140 }
141 }
142 
143 #endif
static bool updateAny(StdType tp, CORBA::Any &any)
virtual CORBA::Any * createAny(base::DataSourceBase::shared_ptr source) const
virtual void set(param_t t)=0
Property< T >::DataSourceType PropertyType
virtual const_reference_t rvalue() const =0
static AssignableDataSource< T > * narrow(base::DataSourceBase *db)
boost::intrusive_ptr< DataSource< T > > shared_ptr
Definition: DataSource.hpp:115
boost::intrusive_ptr< AssignableDataSource< T > > shared_ptr
Definition: DataSource.hpp:198
CRemoteChannelElement_i * createChannelElement_i(DataFlowInterface *sender, PortableServer::POA_ptr poa, const ConnPolicy &policy) const
static DataSource< T > * narrow(base::DataSourceBase *db)
virtual base::DataSourceBase::shared_ptr createAttributeDataSource(CService_ptr serv, const std::string &vname, bool is_assignable)
virtual bool updateAny(base::DataSourceBase::shared_ptr source, CORBA::Any &any) const
static CORBA::Any_ptr createAny(StdType tp)
boost::intrusive_ptr< DataSourceBase > shared_ptr
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
virtual base::DataSourceBase::shared_ptr createDataSource(const CORBA::Any *any) const
value_t DataSourceType
Definition: Property.hpp:89
virtual base::DataSourceBase::shared_ptr createPropertyDataSource(CService_ptr serv, const std::string &vname)
virtual bool updateFromAny(const CORBA::Any *any, base::DataSourceBase::shared_ptr target) const
virtual bool evaluate() const


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:32