YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::sig::VectorOfFloat Class Reference

#include <yarp/sig/Vector.h>

+ Inheritance diagram for yarp::sig::VectorOfFloat:

Public Member Functions

std::string toFormattedString (int precision=-1, int width=-1) const
 Returns a human readable representation of the vector, with formatted numbers.
 
- Public Member Functions inherited from yarp::sig::VectorOfFloatData
 VectorOfFloatData ()=default
 
 VectorOfFloatData (const std::vector< float32 > &privdata)
 
bool read (yarp::os::idl::WireReader &reader) override
 
bool read (yarp::os::ConnectionReader &connection) override
 Read this object from a network connection.
 
bool write (const yarp::os::idl::WireWriter &writer) const override
 
bool write (yarp::os::ConnectionWriter &connection) const override
 Write this object to a network connection.
 
std::string toString () const
 
- Public Member Functions inherited from yarp::os::idl::WirePortable
virtual bool readBare (yarp::os::ConnectionReader &reader)
 
virtual bool writeBare (yarp::os::ConnectionWriter &writer) const
 
virtual bool readBottle (yarp::os::ConnectionReader &reader)
 
virtual bool writeBottle (yarp::os::ConnectionWriter &writer) const
 
- Public Member Functions inherited from yarp::os::Portable
virtual Type getType () const
 
- Public Member Functions inherited from yarp::os::PortReader
virtual ~PortReader ()
 Destructor.
 
virtual Type getReadType () const
 
- Public Member Functions inherited from yarp::os::PortWriter
virtual ~PortWriter ()
 Destructor.
 
virtual void onCompletion () const
 This is called when the port has finished all writing operations.
 
virtual void onCommencement () const
 This is called when the port is about to begin writing operations.
 
virtual yarp::os::Type getWriteType () const
 
- Public Member Functions inherited from yarp::sig::VectorBase< VectorOfFloat, float >
 VectorBase ()=default
 
 VectorBase (size_t size)
 
 VectorBase (std::initializer_list< float > values)
 Initializer list constructor.
 
 VectorBase (size_t s, const float &def)
 Build a vector and initialize it with def.
 
 VectorBase (size_t s, const float *p)
 Builds a vector and initialize it with values from 'p'.
 
 VectorBase (const VectorBase &r)=default
 
 VectorBase (VectorBase< VectorOfFloat, float > &&other) noexcept=default
 
VectorBase< VectorOfFloat, float > & operator= (const VectorBase< VectorOfFloat, float > &r)=default
 
VectorBase & operator= (VectorBase< VectorOfFloat, float > &&other) noexcept=default
 
VectorOfFloat & operator= (const float &val)
 
VectorOfFloat & operator= (std::initializer_list< float > values)
 Initializer list assignment.
 
 ~VectorBase ()=default
 
size_t capacity () const
 Returns the capacity of the vector.
 
void reserve (size_t size)
 Reserve space in the vector.
 
void resize (size_t size)
 Resize the vector.
 
void resize (size_t size, const float &def)
 Resize the vector and initialize the element to a default value.
 
void pop_back ()
 Pop an element out of the vector: size is changed.
 
float & operator[] (size_t i)
 Single element access, no range check.
 
const float & operator[] (size_t i) const
 Single element access, no range check, const version.
 
float & operator() (size_t i)
 Single element access, no range check.
 
const float & operator() (size_t i) const
 Single element access, no range check, const version.
 
size_t size () const
 Returns the number of elements in the vector.
 
void clear ()
 Clear (removes all elements) the vector.
 
void push_back (const float &elem)
 Push a new element in the vector: size is changed.
 
void push_back (float &&elem)
 Move a new element in the vector: size is changed.
 
float * data ()
 Return a pointer to the first element of the vector.
 
const float * data () const
 Return a pointer to the first element of the vector, const version.
 
VectorOfFloat subVector (unsigned int first, unsigned int last) const
 Creates and returns a new vector, being the portion of the original vector defined by the first and last indexes of the items to be included in the subvector.
 
void zero ()
 Set to zero the elements of the vector.
 
iterator begin () noexcept
 Returns an iterator to the beginning of the Vector.
 
const_iterator begin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
const_iterator cbegin () const noexcept
 
void erase (iterator pos)
 Remove an element from the vector.
 
void erase (iterator first, iterator last)
 Remove one or more elements from the vector.
 
size_t getElementSize () const
 

Protected Member Functions

auto & privVec ()
 
const auto & privVec () const
 

Friends

class VectorBase< VectorOfFloat, float >
 

Additional Inherited Members

- Public Types inherited from yarp::sig::VectorOfFloatData
typedef yarp::os::idl::Unwrapped< VectorOfFloatData > unwrapped
 
- Public Types inherited from yarp::sig::VectorBase< VectorOfFloat, float >
using value_type = float
 
using iterator = typename std::vector< float >::iterator
 
using const_iterator = typename std::vector< float >::const_iterator
 
- Static Public Member Functions inherited from yarp::os::Portable
static bool copyPortable (const PortWriter &writer, PortReader &reader)
 Copy one portable to another, via writing and reading.
 
- Protected Attributes inherited from yarp::sig::VectorOfFloatData
std::vector< float32 > privdata {}
 

Detailed Description

Definition at line 91 of file Vector.h.

Member Function Documentation

◆ privVec() [1/2]

auto & yarp::sig::VectorOfFloat::privVec ( )
inlineprotected

Definition at line 112 of file Vector.h.

◆ privVec() [2/2]

const auto & yarp::sig::VectorOfFloat::privVec ( ) const
inlineprotected

Definition at line 113 of file Vector.h.

◆ toFormattedString()

std::string VectorOfFloat::toFormattedString ( int  precision = -1,
int  width = -1 
) const

Returns a human readable representation of the vector, with formatted numbers.

Parameters
precisionnumber of digits after the decimal point. A negative value selects the printf default (6). Values greater than 100 are clamped.
widthminimum field width of each element. If negative, elements are separated by a tab, otherwise they are right-aligned in a field of the given width and separated by a space. Values greater than 100 are clamped.
Returns
the formatted string (empty if the vector is empty).

Definition at line 76 of file Vector.cpp.

Friends And Related Symbol Documentation

◆ VectorBase< VectorOfFloat, float >

friend class VectorBase< VectorOfFloat, float >
friend

Definition at line 87 of file Vector.h.


The documentation for this class was generated from the following files: