Yate: RefStorage Class Reference

Yate

Public Member Functions | Static Public Member Functions | List of all members
RefStorage Class Reference

A fixed ref counted storage. More...

`#include <yatemath.h>`

Inheritance diagram for RefStorage:

## Public Member Functions
| RefStorage (const void *value, unsigned int len)
unsigned int | length () const
void * | data (unsigned int offs, unsigned int len) const
bool | set (const void *buf, unsigned int len, unsigned int offs=0)
Public Member Functions inherited from RefObject
| RefObject ()
virtual | ~RefObject ()
virtual void * | getObject (const String &name) const
virtual bool | alive () const
bool | ref ()
bool | deref ()
int | refcount () const
virtual void | destruct ()
Public Member Functions inherited from GenObject
| GenObject ()
virtual | ~GenObject ()
virtual const String & | toString () const
virtual const String & | traceId () const
NamedCounter * | getObjCounter () const
NamedCounter * | setObjCounter (NamedCounter *counter)

## Static Public Member Functions
static void | fill (void *dest, unsigned int len, int val=0)
static bool | copy (void *dest, const void *src, unsigned int len)
static bool | equals (const void *buf1, const void *buf2, unsigned int len)
static String & | dumpSplit (String &buf, const String &str, unsigned int lineLen, unsigned int offset=0, const char *linePrefix=0, const char *suffix="\r\n")
Static Public Member Functions inherited from RefObject
static bool | alive (const RefObject *obj)
static bool | efficientIncDec ()
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 ()

## Additional Inherited Members
Protected Member Functions inherited from RefObject
virtual void | zeroRefs ()
bool | resurrect ()
virtual void | destroyed ()

## Detailed Description

A fixed ref counted storage.

This class holds a ref counted storage

## Constructor & Destructor Documentation

## ◆ RefStorage()

RefStorage | ( | const void * | value,
|  | unsigned int | len )
| inline

Constructor

Parameters

  value | Data to assign, may be NULL to fill with zeros
  len | Length of data, may be zero (then value is ignored)

## Member Function Documentation

## ◆ copy()

bool copy | ( | void * | dest,
|  | const void * | src,
|  | unsigned int | len )
| inlinestatic

Copy data

Parameters

  dest | Destination buffer
  src | Source buffer
  len | The number of bytes to copy

Returns
  True on success, false if parameters are invalid

Referenced by SliceVector< Complex >::copy(), and set().

## ◆ data()

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

Get a pointer to a byte range inside the stored data

Parameters

  offs | Byte offset inside the stored data
  len | Number of bytes that must be valid starting at offset (must not be 0)

Returns
  A pointer to the data or NULL if the range is not available

Referenced by set().

## ◆ dumpSplit()

String & dumpSplit | ( | String & | buf,
|  | const String & | str,
|  | unsigned int | lineLen,
|  | unsigned int | offset = 0,
|  | const char * | linePrefix = 0,
|  | const char * | suffix = "\r\n" )
| static

Split a string and append lines to another one

Parameters

  buf | Destination string
  str | Input 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

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

## ◆ equals()

bool equals | ( | const void * | buf1,
|  | const void * | buf2,
|  | unsigned int | len )
| inlinestatic

Compare data

Parameters

  buf1 | First buffer
  buf2 | Second buffer
  len | The number of bytes to compare

Returns
  True if equal

Referenced by SliceVector< Complex >::equals().

## ◆ fill()

void fill | ( | void * | dest,
|  | unsigned int | len,
|  | int | val = 0 )
| inlinestatic

Fill a buffer

Parameters

  dest | Destination buffer
  len | The number of bytes to fill
  val | Value to fill with

Referenced by SliceVector< Complex >::bzero(), and SliceVector< Complex >::bzero().

## ◆ length()

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

Get the length of the stored data

Returns
  The length of the stored data, zero for NULL

## ◆ set()

bool set | ( | const void * | buf,
|  | unsigned int | len,
|  | unsigned int | offs = 0 )
| inline

Copy data to this storage

Parameters

  buf | Buffer to copy
  len | The number of bytes to copy
  offs | The start index in this storage

Returns
  True on success, false if there is not enough space in our storage or the buffer pointer is NULL

References copy(), and data().

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

- yatemath.h