39 #ifndef ORO_SEQUENCE_TYPE_INFO_BASE_HPP 40 #define ORO_SEQUENCE_TYPE_INFO_BASE_HPP 47 #include "../internal/FusedFunctorDataSource.hpp" 48 #include "../internal/DataSourceGenerator.hpp" 49 #include <boost/lexical_cast.hpp> 63 return cont.capacity();
87 if (index >= (
int) (cont.size()) || index < 0)
102 if (index >= (
int) (cont.size()) || index < 0)
146 T t_init(size,
typename T::value_type() );
153 if (arg->isAssignable()) {
155 asarg->
set().resize( size );
203 std::vector<std::string> result;
204 result.push_back(
"size");
205 result.push_back(
"capacity");
212 unsigned int indx = boost::lexical_cast<
unsigned int>(name);
226 if ( id_name->
get() ==
"size" ) {
231 if ( id_name->
get() ==
"capacity" ) {
240 if ( item->isAssignable() )
247 log(
Error) <<
"SequenceTypeInfo: No such member : " << id_name->
get() << endlog();
250 log(
Error) <<
"SequenceTypeInfo: Invalid index : " << id_indx->
get() <<
":"<< id_indx->
getTypeName() << endlog();
252 if ( !id_name && ! id_indx)
253 log(
Error) <<
"SequenceTypeInfo: Not a member or index : " <<
id <<
":"<<
id->getTypeName() << endlog();
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.
void addConstructor(TypeConstructor *tb)
Add a constructor/convertor object.
Sequence constructor which takes the number of elements in the sequence.
A function object which returns a vector of DataSources.
boost::call_traits< value_t >::reference reference_t
const std::string & getType() const
bool resize(base::DataSourceBase::shared_ptr arg, int size) const
Constructs a sequence from the number of elements and a prototype element for these elements...
std::vector< std::string > getMemberNames() const
virtual void set(param_t t)=0
Set this DataSource with a value.
int get_capacity(T const &cont)
Returns the capacity of an STL container which has the capacity() member function.
bool RTT_API composePropertyBag(PropertyBag const &sourcebag, PropertyBag &target)
Uses the type composition to compose all typed properties from a property bag.
base::DataSourceBase * newFunctorDataSource(Function f, const std::vector< base::DataSourceBase::shared_ptr > &args)
Creates a data source that returns the result of a given function.
A container for holding references to properties.
bool get_container_item_copy(const std::vector< bool > &cont, int index)
base::DataSourceBase::shared_ptr getMember(base::DataSourceBase::shared_ptr item, const std::string &name) const
An attribute is a minimalistic, named placeholder for data.
base::DataSourceBase::shared_ptr decomposeType(base::DataSourceBase::shared_ptr source) const
Use getMember() for decomposition...
TypeConstructor * newConstructor(Function *foo, bool automatic=false)
Create a new Constructor.
virtual const_reference_t rvalue() const =0
Get a const reference to the value of this DataSource.
static std::ostream & endl(std::ostream &__os)
A class for representing a user type, and which can build instances of that type. ...
base::AttributeBase * buildVariable(std::string name, int size) const
boost::intrusive_ptr< DataSource< T > > shared_ptr
boost::intrusive_ptr< AssignableDataSource< T > > shared_ptr
Use this type to store a pointer to an AssignableDataSource.
bool composeType(base::DataSourceBase::shared_ptr dssource, base::DataSourceBase::shared_ptr dsresult) const
Specialize to resize result given the size of source.
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...
Template for data types that are C++ STL Sequences with operator[], size() and capacity() methods...
A DataSource which holds a constant value and returns it in its get() method.
base::DataSourceBase::shared_ptr getMember(base::DataSourceBase::shared_ptr item, base::DataSourceBase::shared_ptr id) const
static AssignableDataSource< T > * narrow(base::DataSourceBase *db)
This method narrows a base::DataSourceBase to a typeded AssignableDataSource, possibly returning a ne...
bool installTypeInfoObject(TypeInfo *ti)
A DataSource which has set() methods.
static Logger & log()
As Instance(), but more userfriendly.
static DataSource< T > * narrow(base::DataSourceBase *db)
This method narrows a base::DataSourceBase to a typeded DataSource, possibly returning a new object...
bool get_container_item(std::vector< bool > &cont, int index)
Specialisation for vector<bool>, we don't return references to bits aka std::_Bit_reference.
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.
int get_size(T const &cont)
Returns the size of an STL container which has the size() member function.
virtual void updated()
In case the internal::DataSource returns a 'reference' type, call this method to notify it that the d...
virtual std::string getTypeName() const
Return the Orocos type name, without const, pointer or reference qualifiers.
Constructs an sequence with n elements, which are given upon construction time.
bool composeTemplateProperty(const PropertyBag &bag, T &result)