38 #ifndef ORO_CORELIB_TYPEINFO_HPP 39 #define ORO_CORELIB_TYPEINFO_HPP 43 #include "../base/DataSourceBase.hpp" 44 #include "../base/ChannelElementBase.hpp" 45 #include "../internal/SharedConnection.hpp" 47 #ifndef NO_TYPE_INFO_FACTORY_FUNCTIONS 51 #ifndef NO_TYPE_INFO_STREAMS 70 typedef const std::type_info *
TypeId;
72 TypeInfo(
const std::string& name) : mtypenames(1,name) {}
83 const std::string&
getTypeName()
const {
return mtypenames[0]; }
88 std::vector<std::string> getTypeNames()
const;
95 void addAlias(
const std::string& alias);
103 bool isType(
const std::string& name);
155 bool hasProtocol(
int protocol_id)
const;
160 std::vector<int> getTransportNames()
const;
162 #ifndef NO_TYPE_INFO_FACTORY_FUNCTIONS 175 return mdsf ? mdsf->buildConstant(name, source, sizehint) : 0;
180 return mdsf ? mdsf->buildConstant(name, source) : 0;
190 return mdsf ? mdsf->buildVariable(name) : 0;
199 return mmembf ? mmembf->resize(arg, size) :
false;
208 return mdsf ? mdsf->buildAlias(name, b) : 0;
216 return mdsf ? mdsf->buildProperty(name, desc, source) : 0;
224 return mdsf ? mdsf->buildAttribute(name, source) : 0;
255 #ifndef NO_TYPE_INFO_STREAMS 268 return mstrf->write(os,in);
270 #ifdef OS_HAVE_STREAMS 271 std::string output = std::string(
"(")+ in->getTypeName() +
")";
284 return mstrf ? mstrf->read(os, out) : os;
293 return mstrf ? mstrf->toString(in) : std::string();
301 return mstrf ? mstrf->fromString(value, out) :
false;
310 return mstrf ? mstrf->isStreamable() :
false;
326 return mmembf ? mmembf->getMemberNames() : std::vector<std::string>();
352 return mmembf ? mmembf->getMember(ref, item,name) :
false;
388 return mcompf ? mcompf->composeType(source,target) :
false;
446 #endif // NO_TYPE_INFO_FACTORY_FUNCTIONS 450 mtid_name = tid->name();
484 boost::shared_ptr<internal::ConnFactory>
mconnf;
486 boost::shared_ptr<ValueFactory>
mdsf;
487 boost::shared_ptr<CompositionFactory>
mcompf;
488 boost::shared_ptr<StreamFactory>
mstrf;
base::DataSourceBase::shared_ptr buildReference(void *ptr) const
bool composeType(base::DataSourceBase::shared_ptr source, base::DataSourceBase::shared_ptr target) const
boost::shared_ptr< MemberFactory > MemberFactoryPtr
boost::intrusive_ptr< SharedConnectionBase > shared_ptr
void setStreamFactory(StreamFactoryPtr sf)
base::AttributeBase * buildVariable(std::string name) const
base::AttributeBase * buildAttribute(std::string name, base::DataSourceBase::shared_ptr source=0) const
const std::string & getTypeName() const
boost::shared_ptr< CompositionFactory > mcompf
TypeInfo(const std::string &name)
bool isStreamable() const
void setValueFactory(ValueFactoryPtr dsf)
std::string toString(base::DataSourceBase::shared_ptr in) const
boost::shared_ptr< MemberFactory > mmembf
bool resize(base::DataSourceBase::shared_ptr arg, int size) const
const std::type_info * TypeId
void setCompositionFactory(CompositionFactoryPtr cf)
base::DataSourceBase::shared_ptr buildActionAlias(base::ActionInterface *action, base::DataSourceBase::shared_ptr source) const
Transporters transporters
CompositionFactoryPtr getCompositionFactory() const
boost::shared_ptr< internal::ConnFactory > mconnf
const char * getTypeIdName() const
bool getMember(internal::Reference *ref, base::DataSourceBase::shared_ptr item, const std::string &name) const
MemberFactoryPtr getMemberFactory() const
std::vector< std::string > getMemberNames() const
void setTypeId(TypeId tid)
boost::shared_ptr< StreamFactory > StreamFactoryPtr
bool fromString(const std::string &value, base::DataSourceBase::shared_ptr out) const
base::AttributeBase * buildConstant(std::string name, base::DataSourceBase::shared_ptr source, int sizehint) const
base::DataSourceBase::shared_ptr getMember(base::DataSourceBase::shared_ptr item, const std::string &name) const
boost::shared_ptr< internal::ConnFactory > ConnFactoryPtr
base::DataSourceBase::shared_ptr getMember(base::DataSourceBase::shared_ptr item, base::DataSourceBase::shared_ptr id) const
ConnFactoryPtr getPortFactory() const
base::AttributeBase * buildConstant(std::string name, base::DataSourceBase::shared_ptr source) const
Based on the software pattern 'command', this interface allows execution of action objects...
base::AttributeBase * buildAlias(std::string name, base::DataSourceBase::shared_ptr b) const
void setMemberFactory(MemberFactoryPtr mf)
base::DataSourceBase::shared_ptr convertType(base::DataSourceBase::shared_ptr source) const
base::PropertyBase * buildProperty(const std::string &name, const std::string &desc, base::DataSourceBase::shared_ptr source=0) const
boost::shared_ptr< ValueFactory > ValueFactoryPtr
boost::intrusive_ptr< ChannelElementBase > shared_ptr
Constructors constructors
boost::shared_ptr< CompositionFactory > CompositionFactoryPtr
ValueFactoryPtr getValueFactory() const
std::vector< std::string > mtypenames
base::DataSourceBase::shared_ptr buildValue() const
boost::shared_ptr< ValueFactory > mdsf
boost::shared_ptr< StreamFactory > mstrf
void setPortFactory(ConnFactoryPtr cf)
boost::intrusive_ptr< DataSourceBase > shared_ptr
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
StreamFactoryPtr getStreamFactory() const
std::vector< TypeConstructor * > Constructors
base::DataSourceBase::shared_ptr decomposeType(base::DataSourceBase::shared_ptr source) const
std::vector< TypeTransporter * > Transporters
std::istream & read(std::istream &os, base::DataSourceBase::shared_ptr out) const
std::ostream & write(std::ostream &os, base::DataSourceBase::shared_ptr in) const