class chain : public sys_message

Used to make a chained list of unsigned chars

Inheritance:


Public Methods

chain (void)
The constructor
~chain (void)
The destructor

Protected Methods

bool add (unsigned char *data, int n=1)
Add a string
int available (void)
Sizing method
bool read (unsigned char *data, int n=1)
Read a string

Private Fields

unsigned char* cp
Pointer to sub-string
int cp_len
Number of bytes left for reading
unsigned char* dcp
Pointer for later release to data
int dcp_len
Number of bytes over all
chain* link
Pointer for chaining

Private Methods

chain* reduce (void)
Shrinks the linked list

Inherited from sys_message:

Public Methods

void error(error_set id_num, char *text)
void message(char *text)
void warning(char *text)

Inherited from mail:

Protected Methods

void send(const char *text)

Inherited from memory:

Public Methods

void epilog_on(void)
void operator delete (void *pointer_to_bytes, size_t size)
void* operator new (size_t size)
long status(int id)

Documentation

Used to make a chained list of unsigned chars. The object is build to make an unrestricted list of char's. The only limitation is the main memory itself. It is mainly used to read an amount of bytes from a serial port and give them back in a different length. Not so easy as one might think... It is all dynamically organized! The first element stays always and the last ones containing data too.

chain* link
Pointer for chaining

unsigned char* dcp
Pointer for later release to data

int dcp_len
Number of bytes over all

unsigned char* cp
Pointer to sub-string

int cp_len
Number of bytes left for reading

chain* reduce(void)
Shrinks the linked list. The first object stay and all linked objects containing data's stay too. All objects between were erased. This method is only private, invoked from the read method after copying the data. This avoid deletion of the very first element.

Returns:
Pointer to the first object which contains data

bool add(unsigned char *data, int n=1)
Add a string. This method is used to expand the linked list with the given string. If nothing is specified only one data is written. The return flags success or not.

Returns:
TRUE or FALSE, depends on the memory allocation
Parameters:
data - The pointer to the data
n - How many bytes to write

bool read(unsigned char *data, int n=1)
Read a string. Reads an amount of data into the by data pointed string. If the gig fails nothing is internally changed. On success the returned data's were erased in the linked list. If nothing more is defined, only one char is returned.

Returns:
TRUE or FALSE, depends on availability of data
Parameters:
data - The pointer for the data to store on success
n - How many bytes requested

int available(void)
Sizing method. This method is necessary to get an idea how many bytes are ready to read.

Returns:
Number of available data's

chain(void)
The constructor. Initialize the own data. Quite easy.

~chain(void)
The destructor. Release the memory if some was accounted.


Direct child classes:
rs232
Author:
Henry Koplien
Version:
1.0 (first release 19. November 1998, last edit 27. November 1998)

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de