39 #ifndef ORO_CORBA_DATASOURCE_PROXY_HPP 40 #define ORO_CORBA_DATASOURCE_PROXY_HPP 42 #include "../../internal/DataSource.hpp" 43 #include "../../Logger.hpp" 44 #include "../../base/ActionInterface.hpp" 69 corba::CService_var mserv;
70 const std::string mname;
85 DataSourceProxy( corba::CService_ptr s,
const std::string& name,
bool isproperty )
86 : mserv( corba::
CService::_duplicate( s ) ), mname(name), misproperty(isproperty)
88 assert( !CORBA::is_nil(s) );
93 if ( misproperty && ! mserv->hasProperty( name.c_str()))
95 if ( !misproperty && ! mserv->hasAttribute( name.c_str()))
111 res = mserv->getProperty( mname.c_str() );
113 res = mserv->getAttribute( mname.c_str() );
123 return new DataSourceProxy<T>( corba::CService::_duplicate( mserv.in() ), mname, misproperty );
147 corba::CService_var mserv;
148 const std::string mname;
156 : mserv( corba::
CService::_duplicate(serv) ), mname(name), misproperty(isproperty)
164 if ( misproperty && !mserv->hasProperty( name.c_str()) )
166 if ( !misproperty && ( !mserv->hasAttribute( name.c_str()) || !mserv->isAttributeAssignable( name.c_str()) ))
184 res = mserv->getProperty( mname.c_str() );
186 res = mserv->getAttribute( mname.c_str() );
198 CORBA::Any_var toset = ctp->
createAny(&vds);
200 mserv->setProperty( mname.c_str(), toset.in() );
202 mserv->setAttribute( mname.c_str(), toset.in() );
209 return storage->
set();
214 this->
set( storage->
value() );
virtual internal::AssignableDataSource< T > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
Create a deep copy of this internal::DataSource, unless it is already cloned.
DataSource is a base class representing a generic way to read data of type T.
internal::DataSource< T >::result_t value() const
Return the result of the last evaluate() function.
virtual internal::DataSource< T > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
Create a deep copy of this internal::DataSource, unless it is already cloned.
This interface defines the function a transport protocol must support in order to allow Orocos compon...
boost::call_traits< value_t >::reference reference_t
virtual void set(param_t t)=0
Set this DataSource with a value.
virtual CORBA::Any_ptr createAny(base::DataSourceBase::shared_ptr source) const =0
Evaluate source and create an any which contains the value of source.
T value_t
The bare type of T is extracted into value_t.
virtual void updated()
In case the internal::DataSource returns a 'reference' type, call this method to notify it that the d...
A DataSource which is used to manipulate a reference to an external value.
ValueDataSourceProxy(corba::CService_ptr serv, const std::string &name, bool isproperty)
An Orocos Service which hosts operations, attributes and properties.
Mirrors a remote assignable value datasource.
virtual internal::DataSource< T > * clone() const
Return a shallow clone of this DataSource.
DataSourceProxy(corba::CService_ptr s, const std::string &name, bool isproperty)
Creates a new DataSource proxy for an attribute or property.
internal::AssignableDataSource< T >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
virtual const_reference_t rvalue() const =0
Get a const reference to the value of this DataSource.
static std::ostream & endl(std::ostream &__os)
Gets thrown by the constructor of DataSourceProxy or ValueDataSourceProxy when invalid service or pro...
virtual std::string getType() const
Return useful type info in a human readable format.
internal::AssignableDataSource< T >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
boost::intrusive_ptr< AssignableDataSource< T > > shared_ptr
Use this type to store a pointer to an AssignableDataSource.
A DataSource which has set() methods.
#define ORO_CORBA_PROTOCOL_ID
static Logger & log()
As Instance(), but more userfriendly.
virtual result_t value() const =0
Return the result of the last evaluate() function.
DataSource< T >::value_t value_t
virtual bool updateFromAny(const CORBA::Any *blob, base::DataSourceBase::shared_ptr target) const =0
Update an assignable datasource target with the contents of blob.
DataSource< T >::const_reference_t const_reference_t
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
virtual internal::AssignableDataSource< T > * clone() const
Return a shallow clone of this DataSource.
void ref() const
Increase the reference count by one.
A simple, yet very useful DataSource, which keeps a value, and returns it in its get() method...
Mirrors a remote DataSource.
static std::string GetType()
Return usefull type info in a human readable format.
Extends the TypeTransporter in order to allow the creation of channel elements or output halves for a...
boost::call_traits< value_t >::param_type param_t
internal::DataSource< T >::result_t value() const
Return the result of the last evaluate() function.