41 #include "../internal/DataSourceTypeInfo.hpp" 42 #include "../internal/ConnFactory.hpp" 45 #include "rtt-config.h" 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
base::DataSourceBase::shared_ptr convert(base::DataSourceBase::shared_ptr arg) const
void addAlias(const std::string &alias)
void addConstructor(TypeConstructor *tb)
boost::intrusive_ptr< SharedConnectionBase > shared_ptr
base::ChannelElementBase::shared_ptr buildChannelOutput(base::InputPortInterface &port, ConnPolicy const &policy) const
base::ChannelElementBase::shared_ptr buildDataStorage(ConnPolicy const &policy) const
base::ChannelElementBase::shared_ptr buildChannelInput(base::OutputPortInterface &port, ConnPolicy const &policy) const
virtual DataSourceBase::shared_ptr getDataSource() const =0
std::vector< std::string > getTypeNames() const
bool hasProtocol(int protocol_id) const
bool isType(const std::string &name)
bool addProtocol(int protocol_id, TypeTransporter *tt)
boost::intrusive_ptr< ChannelElementBase > shared_ptr
base::AttributeBase * buildVariable(std::string name, int sizehint) const
base::DataSourceBase::shared_ptr construct(const std::vector< base::DataSourceBase::shared_ptr > &args) const
TypeTransporter * getProtocol(int protocol_id) const
base::OutputPortInterface * outputPort(std::string const &name) const
boost::intrusive_ptr< DataSourceBase > shared_ptr
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
static Logger::LogFunction endlog()