39 #ifndef ORO_TEMPLATE_CARRAY_INFO_HPP 40 #define ORO_TEMPLATE_CARRAY_INFO_HPP 43 #include "../internal/ArrayPartDataSource.hpp" 44 #include <boost/lexical_cast.hpp> 46 #include "../internal/carray.hpp" 62 template<
typename T,
bool has_ostream = false>
104 std::vector<std::string> result;
105 result.push_back(
"size");
106 result.push_back(
"capacity");
115 if (name ==
"size" || name ==
"capacity") {
126 unsigned int indx = boost::lexical_cast<
unsigned int>(name);
130 log(
Error) <<
"CArrayTypeInfo: No such part (or invalid index): " << name << endlog();
146 if (id_name->
get() ==
"size" || id_name->
get() ==
"capacity") {
149 log(
Error) <<
"CArrayTypeInfo: No such part : " << id_name->
get() << endlog();
156 log(
Error) <<
"CArrayTypeInfo: need assignable data type for indexing " << this->
getTypeName() << endlog();
164 log(
Error) <<
"CArrayTypeInfo: Invalid index) for type " << this->
getTypeName() << endlog();
188 if(result.count() != source.
size()) {
189 log(
Error) <<
"Refusing to compose C Arrays from a property list of different size. Use the same number of properties as the C array size." << endlog();
202 assert(result.count() == source.
size());
203 assert(source.
size() == target.size());
204 assert(source.
size() == decomp.size());
DataSource is a base class representing a generic way to read data of type T.
virtual result_t get() const =0
Return the data as type T.
virtual base::DataSourceBase::shared_ptr decomposeType(base::DataSourceBase::shared_ptr source) const
Use getMember() for decomposition...
virtual std::vector< std::string > getMemberNames() const
Returns the list of struct member names of this type.
bool installTypeInfoObject(TypeInfo *ti)
Installs the type info object in the global data source type info handler and adds any additional fea...
virtual base::AttributeBase * buildVariable(std::string name, int sizehint) const
Build a modifyable instance of this type.
boost::call_traits< value_t >::reference reference_t
const std::string & getType() const
void newArray(std::size_t size)
Clears the array of this data source and creates a new one.
boost::intrusive_ptr< ArrayDataSource< T > > shared_ptr
virtual base::DataSourceBase::shared_ptr getMember(base::DataSourceBase::shared_ptr item, const std::string &name) const
Returns a member of a given data source struct identified by its name.
virtual void set(param_t t)=0
Set this DataSource with a value.
Template for data types that are C-style arrays.
bool RTT_API composePropertyBag(PropertyBag const &sourcebag, PropertyBag &target)
Uses the type composition to compose all typed properties from a property bag.
void setCompositionFactory(CompositionFactoryPtr cf)
A DataSource which is used to manipulate a reference to an external value.
A container for holding references to properties.
A factory for composing/decomposing and converting types to a form suitable for persistent storage...
DataSource< T >::result_t get() const
Return the data as type T.
A DataSource which is used to manipulate a reference to a part of a data source holding a C-style arr...
virtual base::DataSourceBase::shared_ptr getMember(base::DataSourceBase::shared_ptr item, base::DataSourceBase::shared_ptr id) const
Returns a member of a given data source identified by a data source id.
bool installTypeInfoObject(TypeInfo *ti)
Installs the type info object in the global data source type info handler and adds any additional fea...
An attribute is a minimalistic, named placeholder for data.
virtual const_reference_t rvalue() const =0
Get a const reference to the value of this DataSource.
virtual const std::string & getTypeName() const
A class for representing a user type, and which can build instances of that type. ...
void setMemberFactory(MemberFactoryPtr mf)
TypeInfoRepository::shared_ptr Types()
Obtain a pointer to the global type system.
boost::intrusive_ptr< DataSource< T > > shared_ptr
boost::intrusive_ptr< AssignableDataSource< T > > shared_ptr
Use this type to store a pointer to an AssignableDataSource.
Every DataSource of type T has a type info class which it can ask type information.
A special DataSource only to be used for if you understand the copy()/clone() semantics very well...
A DataSource which holds a constant value and returns it in its get() method.
A DataSource which has set() methods.
static DataSource< T > * narrow(base::DataSourceBase *db)
This method narrows a base::DataSourceBase to a typeded DataSource, possibly returning a new object...
bool typeDecomposition(base::DataSourceBase::shared_ptr dsb, PropertyBag &targetbag, bool recurse)
Identical to RTT::types::propertyDecomposition(), but takes a DataSourceBase as source.
boost::intrusive_ptr< DataSourceBase > shared_ptr
Use this type to store a pointer to a DataSourceBase.
An Attribute has a name and contains data which can be set and get.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
size_t size() const
Get the number of Properties in this bag.
void ref() const
Increase the reference count by one.
bool refreshProperties(const PropertyBag &target, const PropertyBag &source, bool allprops)
This function refreshes the values of the properties in one PropertyBag with the values of the proper...
boost::shared_ptr< TypeInfoRepository > shared_ptr
CArrayTypeInfo(std::string name)
virtual bool composeType(base::DataSourceBase::shared_ptr dssource, base::DataSourceBase::shared_ptr dsresult) const
Compose a type (target) from a DataSourceBase (source) containing its members.
This template class allows primitive types, which are not sent over ports, to be added to Orocos...
boost::shared_ptr< PrimitiveTypeInfo< T, use_ostream > > getSharedPtr()