39 #ifndef ORO_MATRIX_TYPE_INFO_HPP 40 #define ORO_MATRIX_TYPE_INFO_HPP 46 #include <boost/lexical_cast.hpp> 71 return cont.columns();
84 if (index_row >= (
int) (cont.rows()) || index_row < 0 || index_column >= (
int) (cont.columns()) || index_column < 0)
86 return cont[index_row,index_column];
99 template<
typename T,
bool has_ostream = false>
123 T t_init(size_rows, size_columns,
typename T::value_type() );
125 log(
Debug) <<
"Building variable '"<<name <<
"' of type " << this->
getTypeName() <<
" and number of rows "<< size <<
" and number of columns " << size <<
Logger::endl;
131 if (arg->isAssignable()) {
133 asarg->
set().resize( size_rows, size_columns );
145 if ( bag.
getType() ==
"Matrix" ) {
146 unsigned int rows = bag.
size();
147 unsigned int cols = 0;
149 for (
unsigned int i = 1; i <= rows ; i++) {
150 std::stringstream out;
158 if(!(row_p.getDataSource()->composeType(row_bag->
getDataSource()))){
164 cols = row_p.get().size();
165 result.resize(rows,cols);
167 if(row_p.get().size()!=cols){
168 log(
Error)<<
"Row "<<i+1<<
" size does not match matrix columns"<<
endlog();
171 for (
unsigned int j=1; j <= row_p.get().size() ; j++){
172 result(i,j)=row_p.
get()(j);
175 log(
Error)<<
"Property of Row "<<i<<
"was not ready for use"<<
endlog();
180 log(
Error) <<
"Composing Property< Matrix > :" 181 <<
" type mismatch, got type '"<< bag.
getType()
182 <<
"', expected type "<<
"Matrix."<<
endlog();
220 unsigned int indx = boost::lexical_cast<
unsigned int>(name);
232 if ( !item->isAssignable() )
233 log(
Error) <<
"Can't return reference to members of type "<< this->
getTypeName() <<
" since given object is not assignable." <<
endlog();
235 log(
Error) <<
"Consistency error: TypeInfo of type "<< this->
getTypeName() <<
" can't handle types of type "<< item->getType() <<
endlog();
243 if ( id_name->
get() ==
"size" ) {
248 if ( id_name->
get() ==
"capacity" ) {
virtual base::DataSourceBase::shared_ptr getDataSource() const
virtual result_t get() const =0
boost::call_traits< value_t >::reference reference_t
const std::string & getType() const
bool resize(base::DataSourceBase::shared_ptr arg, int size_rows, int size_columns) const
virtual void set(param_t t)=0
base::DataSourceBase * newFunctorDataSource(Function f, const std::vector< base::DataSourceBase::shared_ptr > &args)
A container for holding references to properties.
int get_columns(T const &cont)
virtual bool composeTypeImpl(const PropertyBag &bag, typename internal::AssignableDataSource< T >::reference_t result) const
MatrixTypeInfo(std::string name)
virtual const std::string & getTypeName() const
static std::ostream & endl(std::ostream &__os)
const std::string & getDescription() const
static AssignableDataSource< T > * narrow(base::DataSourceBase *db)
void setMemberFactory(MemberFactoryPtr mf)
boost::intrusive_ptr< DataSource< T > > shared_ptr
boost::intrusive_ptr< AssignableDataSource< T > > shared_ptr
base::PropertyBase * getProperty(const std::string &name) const
int get_rows(T const &cont)
static DataSource< T > * narrow(base::DataSourceBase *db)
bool installTypeInfoObject(TypeInfo *ti)
virtual std::string getTypeName() const
const std::string & getName() const
virtual base::DataSourceBase::shared_ptr getMember(base::DataSourceBase::shared_ptr item, base::DataSourceBase::shared_ptr id) const
base::AttributeBase * buildVariable(std::string name, int size) const
bool get_container_item(std::vector< bool > &cont, int index)
boost::intrusive_ptr< DataSourceBase > shared_ptr
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
bool installTypeInfoObject(TypeInfo *ti)
static Logger::LogFunction endlog()
boost::shared_ptr< PrimitiveTypeInfo< T, use_ostream > > getSharedPtr()
virtual base::DataSourceBase::shared_ptr getMember(base::DataSourceBase::shared_ptr item, const std::string &name) const