Yate: SliceVector< Obj > Class Template Reference

Yate

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SliceVector< Obj > Class Template Reference

A slice vector. More...

`#include <yatemath.h>`

Inheritance diagram for SliceVector< Obj >:

## Public Member Functions
| SliceVector ()
| SliceVector (const SliceVector &other)
| SliceVector (unsigned int len, const Obj *buf=0, unsigned int maxLen=0)
| SliceVector (const SliceVector &v1, const SliceVector &v2)
| SliceVector (const SliceVector &v1, const SliceVector &v2, const SliceVector &v3)
| SliceVector (const SliceVector &other, unsigned int offs, unsigned int len=0)
virtual | ~SliceVector ()
Obj * | data (unsigned int offs, unsigned int len)
const Obj * | data (unsigned int offs, unsigned int len) const
Obj * | data (unsigned int offs=0)
const Obj * | data (unsigned int offs=0) const
Obj * | data (unsigned int offs, unsigned int len, Obj *&eod)
const Obj * | data (unsigned int offs, unsigned int len, const Obj *&eod) const
unsigned int | length () const
unsigned int | maxLen () const
unsigned int | size () const
unsigned int | available (unsigned int offs, int len=-1) const
unsigned int | availableClamp (unsigned int clamp, unsigned int offs=0, int len=-1) const
virtual unsigned int | vectorSize () const
bool | resize (unsigned int len)
void | resizeMax ()
void | steal (SliceVector &other)
void | resetStorage (unsigned int len, unsigned int maxLen=0)
bool | setSlice (const SliceVector &other, unsigned int offs=0, unsigned int len=0)
SliceVector | head (unsigned int len) const
bool | head (SliceVector &dest, unsigned int len) const
SliceVector | tail (unsigned int len) const
bool | tail (SliceVector &dest, unsigned int len) const
SliceVector | slice (unsigned int offs, unsigned int len) const
bool | slice (SliceVector &dest, unsigned int offs, unsigned int len=0) const
bool | copy (const SliceVector &src, unsigned int len, unsigned int offs=0, unsigned int srcOffs=0)
void | bzero (unsigned int offs, unsigned int len)
void | bzero ()
void | fill (const Obj &value)
void | apply (void(*func)(Obj &))
Obj | sum () const
Obj | sumApply (Obj(*func)(const Obj &)) const
float | sumApplyF (float(*func)(const Obj &)) const
bool | sum (const SliceVector &other)
void | sum (const Obj &value)
bool | sub (const SliceVector &other)
void | sub (const Obj &value)
bool | mul (const SliceVector &other)
void | mul (const Obj &value)
void | mul (float value)
Obj & | operator[] (unsigned int index)
const Obj & | operator[] (unsigned int index) const
Obj & | operator[] (signed int index)
const Obj & | operator[] (signed int index) const
bool | operator== (const SliceVector &other) const
bool | operator!= (const SliceVector &other) const
SliceVector & | operator= (const SliceVector &other)
SliceVector & | operator+= (const SliceVector &other)
SliceVector & | operator+= (const Obj &value)
SliceVector & | operator-= (const SliceVector &other)
SliceVector & | operator-= (const Obj &value)
SliceVector & | operator*= (const SliceVector &other)
SliceVector & | operator*= (const Obj &value)
SliceVector & | operator*= (float value)
bool | equals (const SliceVector &other) const
String & | dump (String &buf, String &(*func)(String &s, const Obj &o, const char *sep, const char *fmt), const char *sep=",", const char *fmt=0) const
String & | dump (String &buf, unsigned int lineLen, String &(*func)(String &s, const Obj &o, const char *sep, const char *fmt), unsigned int offset=0, const char *linePrefix=0, const char *suffix="\r\n", const char *sep=",", const char *fmt=0) const
String & | hexify (String &buf, char sep=0) const
String & | dumpHex (String &buf, unsigned int lineLen, unsigned int offset=0, const char *linePrefix=0, const char *suffix="\r\n") const
int | unHexify (const char *str, unsigned int len, int sep=255)
int | unHexify (const String &str, int sep=255)
Public Member Functions inherited from MathVectorBase
virtual | ~MathVectorBase ()
Public Member Functions inherited from GenObject
| GenObject ()
virtual | ~GenObject ()
virtual bool | alive () const
virtual void | destruct ()
virtual const String & | toString () const
virtual void * | getObject (const String &name) const
NamedCounter * | getObjCounter () const
NamedCounter * | setObjCounter (NamedCounter *counter)

## Static Public Member Functions
static unsigned int | objSize ()
static unsigned int | size (unsigned int len)
Static Public Member Functions inherited from GenObject
static void * | getObject (const String &name, const GenObject *obj)
static bool | getObjCounting ()
static void | setObjCounting (bool enable)
static NamedCounter * | getObjCounter (const String &name, bool create=true)
static ObjList & | getObjCounters ()

## Protected Member Functions
Obj * | end (Obj *start, unsigned int len)
const Obj * | end (const Obj *start, unsigned int len) const
bool | setData (Obj *data=0, unsigned int len=0, unsigned int maxLen=0)
bool | initStorage (unsigned int len, const Obj *data=0, unsigned int maxLen=0)
bool | initSlice (bool del, const SliceVector &other, unsigned int offs=0, unsigned int len=0)

## Protected Attributes
RefStorage * | m_storage
Obj * | m_data
unsigned int | m_length
unsigned int | m_maxLen

## Detailed Description

### template<class Obj>
class TelEngine::SliceVector< Obj >

A slice vector.

Template for vectors holding a fixed storage and a slice in it. This class works with objects not holding pointers: it uses memcpy to copy data

## Constructor & Destructor Documentation

SliceVector | ( |  | ) |
| inline

Constructor

Referenced by SliceVector< Obj >::slice(), and SliceVector< Obj >::tail().

SliceVector | ( | const SliceVector< Obj > & | other | ) |
| inline

Copy constructor. Builds a slice of another vector

Parameters

  other | Original vector

SliceVector | ( | unsigned int | len,
|  | const Obj * | buf = `0`,
|  | unsigned int | maxLen = `0`
| ) |  |
| inlineexplicit

Constructor. Build the vector storage

Parameters

  len | Length of data
  buf | Optional init buffer ('len' elements will be copied from it to storage)
  maxLen | Optional vector maximum length (it will be adjusted to be at least len)

References SliceVector< Obj >::maxLen().

SliceVector | ( | const SliceVector< Obj > & | v1,
|  | const SliceVector< Obj > & | v2
| ) |  |
| inlineexplicit

Constructor. Build a vector by concatenating two existing ones

Parameters

  v1 | The first vector
  v2 | The second vector

References SliceVector< Obj >::data(), SliceVector< Obj >::length(), SliceVector< Obj >::resizeMax(), RefStorage::set(), and SliceVector< Obj >::size().

SliceVector | ( | const SliceVector< Obj > & | v1,
|  | const SliceVector< Obj > & | v2,
|  | const SliceVector< Obj > & | v3
| ) |  |
| inlineexplicit

Constructor. Build a vector by concatenating three existing ones

Parameters

  v1 | The first vector
  v2 | The second vector
  v3 | The third vector

References SliceVector< Obj >::data(), SliceVector< Obj >::length(), SliceVector< Obj >::resizeMax(), RefStorage::set(), and SliceVector< Obj >::size().

SliceVector | ( | const SliceVector< Obj > & | other,
|  | unsigned int | offs,
|  | unsigned int | len = `0`
| ) |  |
| inlineexplicit

Constructor. Builds a slice of another vector

Parameters

  other | Original vector
  offs | Offset in the original vector
  len | The number of elements (0 to use all available from offset)

virtual ~SliceVector | ( |  | ) |
| inlinevirtual

Destructor

## Member Function Documentation

void apply | ( | void(*)(Obj &) | func | ) |
| inline

Apply an unary function to all elements in this vector

Parameters

  func | Function to apply

References SliceVector< Obj >::data(), and SliceVector< Obj >::length().

unsigned int available | ( | unsigned int | offs,
|  | int | len = `-1`
| ) |  | const
| inline

Retrieve the available number of elements from given offset (not more than required number)

Parameters

  offs | The offset
  len | Required number of elements (-1: all available from offset)

Returns
  The available number of elements from given offset (may be less than required)

References SliceVector< Obj >::length().

Referenced by SliceVector< Obj >::availableClamp(), and SliceVector< Obj >::data().

unsigned int availableClamp | ( | unsigned int | clamp,
|  | unsigned int | offs = `0`,
|  | int | len = `-1`
| ) |  | const
| inline

Retrieve the available number of elements from given offset. Clamp the available number of elements to requested value

Parameters

  clamp | Maximum number of elements to check
  offs | The offset
  len | Required number of elements (-1: all available from offset)

Returns
  The available number of elements from given offset

References SliceVector< Obj >::available().

void bzero | ( | unsigned int | offs,
|  | unsigned int | len
| ) |  |
| inline

Fill the buffer with 0

Parameters

  offs | The offset
  len | The number of elements to retrieve (must not be 0)

References SliceVector< Obj >::data(), RefStorage::fill(), and SliceVector< Obj >::size().

void bzero | ( |  | ) |
| inline

Fill the buffer with 0

References SliceVector< Obj >::data(), RefStorage::fill(), and SliceVector< Obj >::size().

bool copy | ( | const SliceVector< Obj > & | src,
|  | unsigned int | len,
|  | unsigned int | offs = `0`,
|  | unsigned int | srcOffs = `0`
| ) |  |
| inline

Copies elements from another vector to this one. NOTE: This method don't check for overlapping data

Parameters

  src | The source vector
  len | The number of elements to copy
  offs | The start index in our vector
  srcOffs | The start index in the source vector

Returns
  True on success, false on failure (not enough data in source vector or not enough space in this vector)

References RefStorage::copy(), SliceVector< Obj >::data(), and SliceVector< Obj >::size().

Obj* data | ( | unsigned int | offs,
|  | unsigned int | len
| ) |  |
| inline

Get a pointer to data if 'len' elements are available from offset

Parameters

  offs | The offset
  len | The number of elements to retrieve (must not be 0)

Returns
  A pointer to data at requested offset, NULL if there is not enough data available

References SliceVector< Obj >::length().

Referenced by SliceVector< Obj >::apply(), SliceVector< Obj >::bzero(), SliceVector< Obj >::copy(), SliceVector< Obj >::data(), SliceVector< Obj >::dump(), SliceVector< Obj >::equals(), SliceVector< Obj >::fill(), SliceVector< Obj >::hexify(), SliceVector< Obj >::mul(), SliceVector< Obj >::SliceVector(), SliceVector< Obj >::sub(), SliceVector< Obj >::sum(), SliceVector< Obj >::sumApply(), and SliceVector< Obj >::sumApplyF().

const Obj* data | ( | unsigned int | offs,
|  | unsigned int | len
| ) |  | const
| inline

Get a pointer to data if 'len' elements are available from offset

Parameters

  offs | The offset
  len | The number of elements to retrieve (must not be 0)

Returns
  A pointer to data at requested offset, NULL if there is not enough data available

References SliceVector< Obj >::length().

Obj* data | ( | unsigned int | offs = `0` | ) |
| inline

Get a pointer to data from offset to vector end

Parameters

  offs | The offset

Returns
  A pointer to data at requested offset, NULL if there is no data available

References SliceVector< Obj >::available(), and SliceVector< Obj >::data().

const Obj* data | ( | unsigned int | offs = `0` | ) | const
| inline

Get a pointer to data from offset to vector end

Parameters

  offs | The offset

Returns
  A pointer to data at requested offset, NULL if there is no data available

References SliceVector< Obj >::available(), and SliceVector< Obj >::data().

Obj* data | ( | unsigned int | offs,
|  | unsigned int | len,
|  | Obj *& | eod
| ) |  |
| inline

Get a pointer to data from offset to vector end

Parameters

  offs | The offset
  len | The number of elements to retrieve (must not be 0)
  eod | Pointer to be filled with end of data element (pointer to first element after requested number of elements)

Returns
  A pointer to data data from requested offset, NULL if there is not enough data available

References SliceVector< Obj >::data().

const Obj* data | ( | unsigned int | offs,
|  | unsigned int | len,
|  | const Obj *& | eod
| ) |  | const
| inline

Get a pointer to data from offset to vector end

Parameters

  offs | The offset
  len | The number of elements to retrieve (must not be 0)
  eod | Pointer to be filled with end of data element (pointer to first element after requested number of elements)

Returns
  A pointer to data data from requested offset, NULL if there is not enough data available

References SliceVector< Obj >::data().

String& dump | ( | String & | buf,
|  | String &(*)(String &s, const Obj &o, const char *sep, const char *fmt) | func,
|  | const char * | sep = `","`,
|  | const char * | fmt = `0`
| ) |  | const
| inline

Dump data to a string (append)

Parameters

  buf | Destination string
  func | Pointer to function who appends the object to a String (0 to dump all available from offset)
  sep | Vector elements separator
  fmt | Optional format to use

Returns
  Destination string address

References String::append(), SliceVector< Obj >::data(), and SliceVector< Obj >::length().

Referenced by SliceVector< Obj >::dump().

String& dump | ( | String & | buf,
|  | unsigned int | lineLen,
|  | String &(*)(String &s, const Obj &o, const char *sep, const char *fmt) | func,
|  | unsigned int | offset = `0`,
|  | const char * | linePrefix = `0`,
|  | const char * | suffix = `"\r\n"`,
|  | const char * | sep = `","`,
|  | const char * | fmt = `0`
| ) |  | const
| inline

Dump this vector to string, split it and append lines to a buffer. Line prefix length is not included when line length is calculated. Separator length is included in line length

Parameters

  buf | Destination string
  lineLen | Line length in bytes
  func | Pointer to function who append the object to a String
  offset | Offset in first line (if incomplete). No data will be added on first line if offset is greater then line length
  linePrefix | Prefix for new lines. Empty string to use the suffix
  suffix | String to always add to final result (even if no data dumped)
  sep | Vector elements separator
  fmt | Optional format to use

Returns
  Destination string address

References String::append(), SliceVector< Obj >::data(), SliceVector< Obj >::dump(), SliceVector< Obj >::length(), String::length(), and TelEngine::null().

String& dumpHex | ( | String & | buf,
|  | unsigned int | lineLen,
|  | unsigned int | offset = `0`,
|  | const char * | linePrefix = `0`,
|  | const char * | suffix = `"\r\n"`
| ) |  | const
| inline

Hexify data, split it and append lines to a string

Parameters

  buf | Destination string
  lineLen | Line length, characters to copy
  offset | Offset in first line (if incomplete). No data will be added on first line if offset is greater then line length
  linePrefix | Prefix for new lines. Set it to empty string or 0 to use the suffix
  suffix | End of line for the last line

Returns
  Destination string address

References RefStorage::dumpSplit(), and SliceVector< Obj >::hexify().

bool equals | ( | const SliceVector< Obj > & | other | ) | const
| inline

Compare this vector to another one (compare storage)

Parameters

  other | Vector to compare with

Returns
  True if they are equal

References SliceVector< Obj >::data(), RefStorage::equals(), SliceVector< Obj >::length(), and SliceVector< Obj >::size().

Referenced by SliceVector< Obj >::operator!=(), and SliceVector< Obj >::operator==().

void fill | ( | const Obj & | value | ) |
| inline

Fill the vector with a given value

Parameters

  value | The value to be set in this vector

References SliceVector< Obj >::data(), and SliceVector< Obj >::length().

SliceVector head | ( | unsigned int | len | ) | const
| inline

Retrieve vector head

Parameters

  len | The number of elements to retrieve

Returns
  A vector containing the first elements of this vector

References SliceVector< Obj >::slice().

bool head | ( | SliceVector< Obj > & | dest,
|  | unsigned int | len
| ) |  | const
| inline

Retrieve vector head

Parameters

  dest | Destination vector
  len | The number of elements to retrieve

Returns
  True on success, false on failure (not enough data in our vector)

References SliceVector< Obj >::slice().

String& hexify | ( | String & | buf,
|  | char | sep = `0`
| ) |  | const
| inline

Hexify data

Parameters

  buf | Destination string
  sep | Optional separator

Returns
  Destination string address

References SliceVector< Obj >::data(), String::hexify(), and SliceVector< Obj >::size().

Referenced by SliceVector< Obj >::dumpHex().

unsigned int length | ( |  | ) | const
| inline

Get the length of the vector

Returns
  The length of the vector

Referenced by SliceVector< Obj >::apply(), SliceVector< Obj >::available(), SliceVector< Obj >::data(), SliceVector< Obj >::dump(), SliceVector< Obj >::equals(), SliceVector< Obj >::fill(), SliceVector< Obj >::mul(), SliceVector< Obj >::operator*=(), SliceVector< Obj >::operator+=(), SliceVector< Obj >::operator-=(), SliceVector< Obj >::size(), SliceVector< Obj >::SliceVector(), SliceVector< Obj >::sub(), SliceVector< Obj >::sum(), SliceVector< Obj >::sumApply(), SliceVector< Obj >::sumApplyF(), SliceVector< Obj >::tail(), and BitVector::tail().

unsigned int maxLen | ( |  | ) | const
| inline

Get the maximum length of the vector

Returns
  The maximum length of the vector (0 if the vector don't have a storage buffer)

Referenced by SliceVector< Obj >::resetStorage(), SliceVector< Obj >::resize(), SliceVector< Obj >::resizeMax(), and SliceVector< Obj >::SliceVector().

bool mul | ( | const SliceVector< Obj > & | other | ) |
| inline

Multiply this vector with another one

Parameters

  other | Vector to multiply with

Returns
  True on sucess, false on failure (vectors don't have the same length)

References SliceVector< Obj >::data(), and SliceVector< Obj >::length().

Referenced by SliceVector< Obj >::operator*=().

void mul | ( | const Obj & | value | ) |
| inline

Multiply this vector with a value

Parameters

  value | Value to multiply with

References SliceVector< Obj >::data(), and SliceVector< Obj >::length().

void mul | ( | float | value | ) |
| inline

Multiply this vector with a value

Parameters

  value | Value to multiply with

References SliceVector< Obj >::data(), and SliceVector< Obj >::length().

static unsigned int objSize | ( |  | ) |
| inlinestatic

Retrieve the object size

Returns
  Obj size in bytes

Referenced by SliceVector< Obj >::size(), and SliceVector< Obj >::unHexify().

bool operator!= | ( | const SliceVector< Obj > & | other | ) | const
| inline

Inequality operator

Parameters

  other | Original vector

Returns
  True if the vectors are not equal, false otherwise

References SliceVector< Obj >::equals().

SliceVector& operator*= | ( | const SliceVector< Obj > & | other | ) |
| inline

Multiply this vector with another one

Parameters

  other | Vector to multiply with

Returns
  A reference to this vector

References SliceVector< Obj >::length(), and SliceVector< Obj >::mul().

SliceVector& operator*= | ( | const Obj & | value | ) |
| inline

Multiply this vector with a value

Parameters

  value | Value to multiply with

Returns
  A reference to this vector

References SliceVector< Obj >::mul().

SliceVector& operator*= | ( | float | value | ) |
| inline

Multiply this vector with a value

Parameters

  value | Value to multiply with

Returns
  A reference to this vector

References SliceVector< Obj >::mul().

SliceVector& operator+= | ( | const SliceVector< Obj > & | other | ) |
| inline

Sum this vector with another one

Parameters

  other | Vector to sum with this one

Returns
  A reference to this vector

References SliceVector< Obj >::length(), and SliceVector< Obj >::sum().

SliceVector& operator+= | ( | const Obj & | value | ) |
| inline

Add a value to each element of the vector

Parameters

  value | Value to add

Returns
  A reference to this vector

References SliceVector< Obj >::sum().

SliceVector& operator-= | ( | const SliceVector< Obj > & | other | ) |
| inline

Substract another vector from this one

Parameters

  other | Vector to substract

Returns
  A reference to this vector

References SliceVector< Obj >::length(), and SliceVector< Obj >::sub().

SliceVector& operator-= | ( | const Obj & | value | ) |
| inline

Substract a value from each element of the vector

Parameters

  value | Value to substract

Returns
  A reference to this vector

References SliceVector< Obj >::sub().

SliceVector& operator= | ( | const SliceVector< Obj > & | other | ) |
| inline

Asignment operator. Builds a slice of another vector

Parameters

  other | Original vector

Returns
  A reference to this vector

References SliceVector< Obj >::setSlice().

bool operator== | ( | const SliceVector< Obj > & | other | ) | const
| inline

Equality operator

Parameters

  other | Original vector

Returns
  True if the vectors are equal, false otherwise

References SliceVector< Obj >::equals().

Obj& operator[] | ( | unsigned int | index | ) |
| inline

Indexing operator with unsigned int

Parameters

  index | Index of element to retrieve

Returns
  The element at requested index

const Obj& operator[] | ( | unsigned int | index | ) | const
| inline

Indexing operator with unsigned int

Parameters

  index | Index of element to retrieve

Returns
  The element at requested index

Obj& operator[] | ( | signed int | index | ) |
| inline

Indexing operator with signed int

Parameters

  index | Index of element to retrieve

Returns
  The element at requested index

const Obj& operator[] | ( | signed int | index | ) | const
| inline

Indexing operator with signed int

Parameters

  index | Index of element to retrieve

Returns
  The element at requested index

void resetStorage | ( | unsigned int | len,
|  | unsigned int | maxLen = `0`
| ) |  |
| inline

Change the vector storage (re-allocate)

Parameters

  len | New vector length (0 to clear vector data)
  maxLen | Optional vector maximum length (it will be adjusted to be at least len)

References SliceVector< Obj >::maxLen().

bool resize | ( | unsigned int | len | ) |
| inline

Change the vector length without changing the contents. If the vector length is increased the new elements' value are not reset

Parameters

  len | New vector length

Returns
  True on success, false if requested length is greater than max length

References SliceVector< Obj >::maxLen().

Referenced by SliceVector< Obj >::resizeMax().

void resizeMax | ( |  | ) |
| inline

Change the vector length to maximum allowed without changing the contents

References SliceVector< Obj >::maxLen(), and SliceVector< Obj >::resize().

Referenced by SliceVector< Obj >::SliceVector().

bool setSlice | ( | const SliceVector< Obj > & | other,
|  | unsigned int | offs = `0`,
|  | unsigned int | len = `0`
| ) |  |
| inline

Set a slice containing another vector

Parameters

  other | Original vector
  offs | Offset in the original vector
  len | The number of elements (0 to use all available from offset)

Returns
  True on success, false on failure

Referenced by SliceVector< Obj >::operator=().

unsigned int size | ( |  | ) | const
| inline

Get the vector size in bytes

Returns
  Vector size in bytes

References SliceVector< Obj >::length().

Referenced by SliceVector< Obj >::bzero(), SliceVector< Obj >::copy(), SliceVector< Obj >::equals(), SliceVector< Obj >::hexify(), SliceVector< Obj >::SliceVector(), and SliceVector< Obj >::vectorSize().

static unsigned int size | ( | unsigned int | len | ) |
| inlinestatic

Retrieve the length in bytes of a buffer containing 'count' objects

Parameters

  len | Buffer length

Returns
  Buffer length in bytes

References SliceVector< Obj >::objSize().

SliceVector slice | ( | unsigned int | offs,
|  | unsigned int | len
| ) |  | const
| inline

Retrieve a vector slice

Parameters

  offs | Offset in our vector
  len | The number of elements to retrieve

Returns
  A vector containing the requested slice (empty if offset/length are invalid)

References SliceVector< Obj >::SliceVector().

Referenced by SliceVector< Obj >::head().

bool slice | ( | SliceVector< Obj > & | dest,
|  | unsigned int | offs,
|  | unsigned int | len = `0`
| ) |  | const
| inline

Set a slice of this vector to another one. The destination vector will be changed

Parameters

  dest | Destination vector
  offs | Offset in our vector
  len | The number of elements (0 to use all available from offset)

Returns
  True on success, false on failure (not enough data in our vector)

void steal | ( | SliceVector< Obj > & | other | ) |
| inline

Steal other vector's data

Parameters

  other | Original vector

bool sub | ( | const SliceVector< Obj > & | other | ) |
| inline

Substract another vector from this one

Parameters

  other | Vector to substract

Returns
  True on sucess, false on failure (vectors don't have the same length)

References SliceVector< Obj >::data(), and SliceVector< Obj >::length().

Referenced by SliceVector< Obj >::operator-=().

void sub | ( | const Obj & | value | ) |
| inline

Substract a value from each element of the vector

Parameters

  value | Value to substract

References SliceVector< Obj >::data(), and SliceVector< Obj >::length().

Obj sum | ( |  | ) | const
| inline

Sum vector values

Returns
  The sum of the vector elements

References SliceVector< Obj >::data(), and SliceVector< Obj >::length().

Referenced by SliceVector< Obj >::operator+=().

bool sum | ( | const SliceVector< Obj > & | other | ) |
| inline

Sum this vector with another one

Parameters

  other | Vector to sum with this one

Returns
  True on sucess, false on failure (vectors don't have the same length)

References SliceVector< Obj >::data(), and SliceVector< Obj >::length().

void sum | ( | const Obj & | value | ) |
| inline

Add a value to each element of the vector

Parameters

  value | Value to add

References SliceVector< Obj >::data(), and SliceVector< Obj >::length().

Obj sumApply | ( | Obj(*)(const Obj &) | func | ) | const
| inline

Apply a function to all vector elements and take the sum of the results

Parameters

  func | Function to apply

Returns
  The result

References SliceVector< Obj >::data(), and SliceVector< Obj >::length().

float sumApplyF | ( | float(*)(const Obj &) | func | ) | const
| inline

Apply a function to all vector elements and take the sum of the results

Parameters

  func | Function to apply

Returns
  The result

References SliceVector< Obj >::data(), and SliceVector< Obj >::length().

SliceVector tail | ( | unsigned int | len | ) | const
| inline

Retrieve vector tail (last elements)

Parameters

  len | The number of elements to retrieve

Returns
  A vector containing the last elements of this vector

References SliceVector< Obj >::length(), and SliceVector< Obj >::SliceVector().

bool tail | ( | SliceVector< Obj > & | dest,
|  | unsigned int | len
| ) |  | const
| inline

Retrieve vector tail (last elements)

Parameters

  len | The number of elements to retrieve
  dest | Destination vector

Returns
  True on success, false on failure (not enough data in our vector)

References SliceVector< Obj >::length().

int unHexify | ( | const char * | str,
|  | unsigned int | len,
|  | int | sep = `255`
| ) |  |
| inline

Reset storage from a hexadecimal string representation. Clears the vector at start, i.e. the vector will be empty on failure. The vector may be empty on success also. Each octet must be represented in the input string with 2 hexadecimal characters. If a separator is specified, the octets in input string must be separated using exactly 1 separator. Only 1 leading or 1 trailing separators are allowed.

Parameters

  str | Input character string
  len | Length of input string
  sep | Separator character used between octets. [-128..127]: expected separator (0: no separator is expected). Detect the separator if other value is given

Returns
  0 on success, negative if unhexify fails, positive if the result is not a multiple of Obj size

References DataBlock::data(), DataBlock::length(), SliceVector< Obj >::objSize(), and DataBlock::unHexify().

Referenced by SliceVector< Obj >::unHexify().

int unHexify | ( | const String & | str,
|  | int | sep = `255`
| ) |  |
| inline

Unhexify data

Parameters

  str | Input string
  sep | Separator character used between octets

Returns
  See unHexify(const char*,unsigned int,char)

References String::c_str(), String::length(), and SliceVector< Obj >::unHexify().

virtual unsigned int vectorSize | ( |  | ) | const
| inlinevirtual

Retrieve vector size in bytes

Returns
  Vector size in bytes

Implements MathVectorBase.

References SliceVector< Obj >::size().

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

- yatemath.h