39 #ifndef ORO_SERVICE_PROVIDER_HPP 40 #define ORO_SERVICE_PROVIDER_HPP 42 #include "rtt-config.h" 53 #include <boost/shared_ptr.hpp> 54 #include <boost/static_assert.hpp> 55 #include <boost/type_traits/function_traits.hpp> 56 #include <boost/function_types/components.hpp> 57 #include <boost/enable_shared_from_this.hpp> 58 #if BOOST_VERSION >= 104000 && BOOST_VERSION < 105300 59 #include <boost/smart_ptr/enable_shared_from_this2.hpp> 61 #if BOOST_VERSION >= 105300 62 #include <boost/smart_ptr/enable_shared_from_raw.hpp> 68 #if BOOST_VERSION >= 104000 69 #if BOOST_VERSION < 105300 105 #if BOOST_VERSION >= 105300 139 const std::string&
getName()
const {
return mname; }
144 const std::string&
doc()
const {
return mdescription; }
149 void doc(
const std::string& description) { mdescription = description; }
154 void setName(
const std::string& name) { mname = name;}
166 void setParent(shared_ptr new_parent);
177 virtual ProviderNames getProviderNames()
const;
204 virtual bool addService( shared_ptr obj );
215 virtual void removeService( std::string
const& service_name );
245 shared_ptr getService(
const std::string& service_name);
252 bool hasService(
const std::string& service_name);
266 std::vector<std::string> getOperationNames()
const;
272 bool hasOperation(
const std::string& name)
const;
294 boost::shared_ptr<base::DisposableInterface> getLocalOperation( std::string name );
311 void removeOperation(
const std::string& name );
340 template<
class Signature>
343 if ( this->addLocalOperation( op ) ==
false )
349 #ifdef ORO_SIGNALLING_OPERATIONS 359 template<
class Signature>
363 if ( this->addLocalOperation( op ) ==
false )
365 this->add( op.
getName(),
new internal::EventOperationInterfacePartFused<Signature>( &op ) );
378 template<
class Signature>
381 if ( this->addLocalOperation( op ) ==
false )
400 template<
class Func,
class Class>
406 ownedoperations.push_back(op);
407 return addOperation( *op );
425 typedef Func Signature;
426 boost::function<Signature> bfunc = func;
428 ownedoperations.push_back(op);
429 return addOperation( *op );
432 #ifdef ORO_SIGNALLING_OPERATIONS 448 typedef Func Signature;
449 boost::function<Signature> bfunc = func;
451 ownedoperations.push_back(op);
452 return addEventOperation( *op );
467 template<
class Func,
class Class>
473 ownedoperations.push_back(op);
474 return addEventOperation( *op );
490 template<
class Func,
class Class>
496 ownedoperations.push_back(op);
497 return addSynchronousOperation( *op );
505 template<
class Func,
class ObjT>
511 ownedoperations.push_back(op);
512 return addOperationDS( sp, *op );
520 template<
class Signature,
class ObjT>
523 if ( this->addLocalOperation( op ) ==
false ) {
541 const std::vector<base::DataSourceBase::shared_ptr>& args,
ExecutionEngine* caller)
const 543 return this->produce(name, args, caller);
561 typedef std::map< std::string, shared_ptr >
Services;
const std::string & getName() const
TaskContext * getOwner() const
internal::ArgMember< typename boost::remove_pointer< FunctionT >::type >::type Signature
Operation< Signature > & addOperationDS(internal::DataSource< boost::shared_ptr< ObjT > > *sp, Operation< Signature > &op)
boost::shared_ptr< const Service > shared_constptr
Operation< Signature > & addOperation(Operation< Signature > &op)
void setName(const std::string &name)
shared_ptr getParent() const
std::vector< std::string > ProviderNames
Services services
the services we implement.
Operation< typename internal::GetSignature< Func >::Signature > & addSynchronousOperation(const std::string name, Func func, Class *obj, ExecutionThread et=ClientThread)
base::DataSourceBase::shared_ptr getOperation(std::string name, const std::vector< base::DataSourceBase::shared_ptr > &args, ExecutionEngine *caller) const
boost::shared_ptr< Service > shared_ptr
Operation< Signature > & addSynchronousOperation(Operation< Signature > &op)
void doc(const std::string &description)
const std::string & doc() const
std::map< std::string, base::OperationBase * > SimpleOperations
SimpleOperations simpleoperations
internal::UnMember< typename boost::remove_pointer< FunctionT >::type >::type Signature
std::vector< base::OperationBase * > OperationList
A class for keeping track of Attribute, Constant and Property objects of a TaskContext. It allows plugins and remote components to browse the attributes and properties of a TaskContext.
OperationList ownedoperations
std::map< std::string, shared_ptr > Services
Operation< typename internal::GetSignatureDS< Func >::Signature > & addOperationDS(const std::string &name, Func func, internal::DataSource< boost::shared_ptr< ObjT > > *sp, ExecutionThread et=ClientThread)
boost::intrusive_ptr< DataSourceBase > shared_ptr
Operation< Func > & addOperation(const std::string name, Func *func, ExecutionThread et=ClientThread)
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
const std::string & getName()
OperationInterface Factory
Holds all exported operations of a component and is able to produce callers for these operations...
Operation< typename internal::GetSignature< Func >::Signature > & addOperation(const std::string name, Func func, Class *obj, ExecutionThread et=ClientThread)
boost::enable_shared_from_this< Service > shared_from_raw