41 #include "../internal/DataSourceTypeInfo.hpp" 42 #include "../internal/ConnFactory.hpp" 47 #include "../Logger.hpp" 48 #include "../base/AttributeBase.hpp" 53 using namespace detail;
59 for (Transporters::iterator i = transporters.begin(); i != transporters.end(); ++i)
63 for (Constructors::iterator i= constructors.begin(); i != constructors.end(); ++i)
74 if ( !alias.empty() && find(mtypenames.begin(), mtypenames.end(), alias) == mtypenames.end() )
75 mtypenames.push_back(alias);
79 return (find(mtypenames.begin(), mtypenames.end(), name) != mtypenames.end() );
84 return mdsf ? mdsf->buildVariable(name, hint) : 0;
100 if ( args.size() == 1 && args.front()->getTypeInfo() == this )
103 Constructors::const_iterator i= constructors.begin();
104 while (i != constructors.end() ) {
105 ds = (*i)->build( args );
115 constructors.push_back(tb);
120 if ( arg->getTypeInfo() == this )
125 Constructors::const_iterator i= constructors.begin();
126 while (i != constructors.end() ) {
127 ds = (*i)->convert( arg );
139 if (transporters.size() <
static_cast<size_t>(protocol_id + 1))
140 transporters.resize(protocol_id + 1);
141 if ( transporters[protocol_id] ) {
142 log(
Debug) <<
"A protocol with id "<<protocol_id<<
" was already added for type "<< getTypeName()<<endlog();
146 transporters[protocol_id] = tt;
156 if ( protocol_id + 1 >
int(transporters.size()) || transporters[protocol_id] == 0) {
160 log(
Warning) <<
"The protocol with id "<<protocol_id<<
" did not register a fall-back handler for unknown types!"<<endlog();
161 log(
Warning) <<
" triggered by: "<< getTypeName() <<
" which does not have a transport."<<endlog();
165 return transporters[protocol_id];
174 if ( protocol_id + 1 >
int(transporters.size()) || transporters[protocol_id] == 0) {
182 std::vector<int> ret;
183 for (
size_t i=0; i<transporters.size(); ++i)
188 if (0 != transporters[i])
199 return mconnf ? mconnf->inputPort(name) : 0;
204 return mconnf ? mconnf->outputPort(name) : 0;
std::vector< int > getTransportNames() const
Return a list of protocols that have transporters.
base::DataSourceBase::shared_ptr convert(base::DataSourceBase::shared_ptr arg) const
Automatic conversion: convert a internal::DataSource to this type.
void addAlias(const std::string &alias)
Adds an alias to the this type.
void addConstructor(TypeConstructor *tb)
Add a constructor/convertor object.
boost::intrusive_ptr< SharedConnectionBase > shared_ptr
base::ChannelElementBase::shared_ptr buildChannelOutput(base::InputPortInterface &port, ConnPolicy const &policy) const
This interface defines the function a transport protocol must support in order to allow Orocos compon...
base::ChannelElementBase::shared_ptr buildDataStorage(ConnPolicy const &policy) const
Creates single data or buffered storage for this type.
base::ChannelElementBase::shared_ptr buildChannelInput(base::OutputPortInterface &port, ConnPolicy const &policy) const
virtual DataSourceBase::shared_ptr getDataSource() const =0
Return a internal::DataSource which contains the same contents.
A connection policy object describes how a given connection should behave.
The base class of each OutputPort.
std::vector< std::string > getTypeNames() const
Returns all registered names and aliases of this type.
An attribute is a minimalistic, named placeholder for data.
bool hasProtocol(int protocol_id) const
Check if this type is transporable over a given protocol.
bool isType(const std::string &name)
Returns true if this type is known by the type system under the given name.
bool addProtocol(int protocol_id, TypeTransporter *tt)
Register a protocol for data transport over a network.
boost::intrusive_ptr< ChannelElementBase > shared_ptr
Every DataSource of type T has a type info class which it can ask type information.
base::AttributeBase * buildVariable(std::string name, int sizehint) const
Build a modifyable instance of this type.
base::DataSourceBase::shared_ptr construct(const std::vector< base::DataSourceBase::shared_ptr > &args) const
Constructor syntax: construct a internal::DataSource which returns an instance of data depending on t...
TypeTransporter * getProtocol(int protocol_id) const
Returns this type's transport for a given protocol.
base::OutputPortInterface * outputPort(std::string const &name) const
Returns a new OutputPort<T> object where T is the type represented by this TypeInfo object...
This interface describes how constructors work.
boost::intrusive_ptr< DataSourceBase > shared_ptr
Use this type to store a pointer to a DataSourceBase.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
internal::SharedConnectionBase::shared_ptr buildSharedConnection(base::OutputPortInterface *output_port, base::InputPortInterface *input_port, ConnPolicy const &policy) const
base::InputPortInterface * inputPort(std::string const &name) const
Returns a new InputPort<T> object where T is the type represented by this TypeInfo object...