Orocos Real-Time Toolkit
2.8.3
|
Wraps a C array such that we can return a C array from a DataSource. More...
#include <rtt/types/carray.hpp>
Public Types | |
typedef T | value_type |
Public Member Functions | |
carray (value_type *t, std::size_t s) | |
Create an C array wrapper. More... | |
carray () | |
Creates an empty carray. More... | |
carray (boost::serialization::array< T > const &orig) | |
We are constructible from boost::serialization::array<T> Makes a shallow copy in order to keep the reference to the original data. More... | |
template<std::size_t N> | |
carray (boost::array< T, N > &orig) | |
We are constructible from boost::array<T,N> Makes a shallow copy in order to keep the reference to the original data. More... | |
void | init (value_type *t, std::size_t s) |
(Re-)initialize this carray to a new address and size. More... | |
value_type * | address () const |
The address of the first element of the array. More... | |
std::size_t | count () const |
template<class OtherT > | |
const carray< T > & | operator= (const carray< OtherT > &orig) |
Assignment only copies max(this->count(), orig.count()) elements from orig to this object. More... | |
template<class OtherT > | |
const carray< T > & | operator= (boost::serialization::array< OtherT > const &orig) |
Assignment only copies max(this->count(), orig.count()) elements from orig to this object. More... | |
template<class OtherT , std::size_t OtherN> | |
const carray< T > & | operator= (const boost::array< OtherT, OtherN > &orig) |
Assignment only copies max(this->count(), orig.size()) elements from orig to this object. More... | |
Wraps a C array such that we can return a C array from a DataSource.
Inspired on boost::serialization::array.
Default copy-constructible (shallow copy).
An assignment (operator=) makes a 'deep copy', while copy construction makes a 'shallow copy', where the copy refers to the same C array. This was chosen in the spirit of this class, where it keeps track of the original data, but when assigned from another carray, is meant as copying the data itself.
You can also point to parts of arrays. An uninitialized carray object returns null for both count() and address().
T | The data type of the array. |
Definition at line 77 of file carray.hpp.
typedef T RTT::types::carray< T >::value_type |
Definition at line 80 of file carray.hpp.
|
inline |
Create an C array wrapper.
t | Pointer to first element of array. |
s | Length of array. If zero, the parameter t will be ignored. |
Definition at line 88 of file carray.hpp.
|
inline |
Creates an empty carray.
You are not allowed to read or write (operator=) to this array until it has been initialized.
Definition at line 99 of file carray.hpp.
|
inline |
We are constructible from boost::serialization::array<T> Makes a shallow copy in order to keep the reference to the original data.
orig |
Definition at line 110 of file carray.hpp.
|
inline |
We are constructible from boost::array<T,N> Makes a shallow copy in order to keep the reference to the original data.
orig |
Definition at line 124 of file carray.hpp.
|
inline |
The address of the first element of the array.
Definition at line 142 of file carray.hpp.
Referenced by RTT::types::carray< T >::operator=().
|
inline |
Definition at line 150 of file carray.hpp.
Referenced by RTT::types::carray< T >::operator=().
|
inline |
(Re-)initialize this carray to a new address and size.
Definition at line 133 of file carray.hpp.
Referenced by RTT::internal::PartDataSource< types::carray< T > >::copy().
|
inline |
Assignment only copies max(this->count(), orig.count()) elements from orig to this object.
If orig.count() is smaller than this->count() the contents of the remaining elements is left unmodified. If it's greater, the excess elements are ignored.
Definition at line 162 of file carray.hpp.
References RTT::types::carray< T >::address(), and RTT::types::carray< T >::count().
|
inline |
Assignment only copies max(this->count(), orig.count()) elements from orig to this object.
If orig.count() is smaller than this->count() the contents of the remaining elements is left unmodified. If it's greater, the excess elements are ignored.
orig |
Definition at line 180 of file carray.hpp.
References RTT::types::carray< T >::count().
|
inline |
Assignment only copies max(this->count(), orig.size()) elements from orig to this object.
If orig.size() is smaller than this->count() the contents of the remaining elements is left unmodified. If it's greater, the excess elements are ignored.
orig |
Definition at line 196 of file carray.hpp.
References RTT::types::carray< T >::count().