UCommon
Macros | Functions
misc.h File Reference

various miscellaneous classes historically used. More...

#include <commoncpp/config.h>
Include dependency graph for misc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define KEYDATA_INDEX_SIZE   97
 
#define KEYDATA_PAGER_SIZE   512
 
#define KEYDATA_PATH_SIZE   256
 

Functions

class ost::__attribute__ ((visibility("default"))) IPV4Validator
 Classes derived from IPV4Address would require an specific validator to pass to the IPV4Address constructor. More...
 

Detailed Description

various miscellaneous classes historically used.

Definition in file misc.h.

Macro Definition Documentation

◆ KEYDATA_INDEX_SIZE

#define KEYDATA_INDEX_SIZE   97

Definition at line 51 of file misc.h.

◆ KEYDATA_PAGER_SIZE

#define KEYDATA_PAGER_SIZE   512

Definition at line 52 of file misc.h.

◆ KEYDATA_PATH_SIZE

#define KEYDATA_PATH_SIZE   256

Definition at line 60 of file misc.h.

Function Documentation

◆ __attribute__()

class ost::__attribute__ ( (visibility("default"))  )

Classes derived from IPV4Address would require an specific validator to pass to the IPV4Address constructor.

XML streaming parser.

Splits delimited string into tokens.

Timer ports are used to provide synchronized timing events when managed under a "service thread" such as SocketService.

This class is used to access non-reentrant date and time functions in the standard C library.

The SemaphoreLock class is used to protect a section of code through a semaphore so that only x instances of the member function may execute concurrently.

The WriteLock class is used to protect a section of code through a ThreadLock for "write" access to the member function.

The ReadLock class is used to protect a section of code through a ThreadLock for "read" access to the member function.

The Mutex Counter is a counter variable which can safely be incremented or decremented by multiple threads.

The slog class is used to stream messages to the system's logging facility (syslogd).

The Serial class is used as the base for all serial I/O services under APE.

This class is used to create a "named" lock entity that can be used to control access to a resource between multiple processes.

A class for containing portable process related functions that help create portable code.

Stream serialization of persistent classes.

PersistObject.

Type manager for persistence engine.

The MapObject is a base class which can be used to make a derived class operate on a MapTable.

A map table allows for entities to be mapped (hash index) onto it.

Self managed double linked list object chain.

Self managed single linked list object chain.

Pointer to reference counted objects.

A reference countable object.

The shared mempager uses a mutex to protect key access methods.

The Multipart form is a MIME multipart document specific for the construction and delivery of form data to a web server through a post method.

A container class for multi-part MIME document objects which can be streamed to a std::ostream destination.

The purpose of this class is to define a base class for low level random file access that is portable between Win32 and Posix systems.

A low level portable directory class.

alog global log stream definition

Produces a dump of a buffer in a hexdump way with its code Ascii translation and relative buffer address.

Classes derived from IPV6Address would require an specific validator to pass to the IPV6Address constructor.

The network name and address objects are all derived from a common IPV4Address base class.

The CIDR class is used to support routing tables and validate address policies.

Class for the function object that validates multicast addresses.

This is a base class for classes of function objects used by such derived classes.

Author
Federico Montesino p5087.nosp@m.@qui.nosp@m.ntero.nosp@m..fie.nosp@m..us.e.nosp@m.s

Abstract base class for derived inet addresses validators.

Implements a specific application operator to validate multicast addresses.

Author
Federico Montesino p5087.nosp@m.@qui.nosp@m.ntero.nosp@m..fie.nosp@m..us.e.nosp@m.s

Validating class specialized for multicast addresses. The CIDR class is used to support routing tables and validate address policies.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Classless Internet Domain Routing

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Classless Internet Domain Routing

Specific classes, such as IPV4Host, IPV4Mask, etc, are defined from IPV4Address entirely so that the manner a network address is being used can easily be documented and understood from the code and to avoid common errors and accidental misuse of the wrong address object. For example, a "connection" to something that is declared as a "IPV4Host" can be kept type-safe from a "connection" accidently being made to something that was declared a "IPV4Broadcast".

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

Internet Address binary data type.

Implements a specific application operator to validate multicast addresses.

Author
Federico Montesino p5087.nosp@m.@qui.nosp@m.ntero.nosp@m..fie.nosp@m..us.e.nosp@m.s

Validating class specialized for multicast addresses. The network name and address objects are all derived from a common IPV6Address base class. Specific classes, such as IPV4Host, IPV6Mask, etc, are defined from IPV6Address entirely so that the manner a network address is being used can easily be documented and understood from the code and to avoid common errors and accidental misuse of the wrong address object. For example, a "connection" to something that is declared as a "IPV6Host" can be kept type-safe from a "connection" accidently being made to something that was declared a "IPV6Broadcast".

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

Internet Address binary data type.

For instance: 0000000 - 77 98 21 49 0e 00 05 00 40 1c 01 1c 2f 00 00 00 w.!I......./...

Used to support ccstd Directory container. This provides a basic mechanism for allocating and accessing file entries.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

low level directory access class. A generic class to walk a hierarchical directory structure.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

Directory tree walking.

This class is a foundation both for optimized thread shared and traditional locked file access that is commonly used to build database services, rather than the standard C++ streaming file classes.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

Portable random disk file access. This class defines a database I/O file service that can be shared by multiple processes. Each thread should access a dup of the database object, and mutex locks can be used to preserve transaction integrety if multiple threads are used.

SharedFile is used when a database may be shared between multiple processes. SharedFile automatically applies low level byte-range "file locks", and provides an interface to fetch and release byte-range locked portions of a file.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

This class defines a database I/O file service that can be shared by multiple processes. Create and map a disk file into memory. This portable class works under both Posix via mmap and under the win32 API. A mapped file can be referenced directly by it's memory segment. One can map and unmap portions of a file on demand, and update changed memory pages mapped from files immediately through sync().

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

Map a named disk file into memory. The DSO dynamic loader class is used to load object files. On elf based systems this is typically done with dlopen. A dummy stub class is generated for non-dl capable systems.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

Dynamic class file loader.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

container for streamable multi-part MIME documents.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

deliver form results as multipart document. This is used to attach an item part to a MIME multipart document that is being streamed. The base item part class is used by all derived items.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

item or part of a multi-part object.

This class is used when a mempager will be shared by multiple threads.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

mutex protected memory pager. This class is used to associate (object) pointers with named strings. A virtual is used to allocate memory which can be overriden in the derived class.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

associate names with pointers.

This is used in association with smart pointers (RefPointer).

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Object managed by smart pointer reference count.

This is a non-template form of a reference count smart pointer, and so uses common code. This can be subclassed to return explicit object types.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Pointer to reference count managed objects.

This is used for accumulating lists by using as a base class for a derived subclass.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Accumulating single linked list.

This is used for accumulating lists by using as a base class for a derived subclass.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Accumulating double linked list.

Unlike with Assoc, This form of map table also allows objects to be removed from the table. This table also includes a mutex lock for thread safety. A free list is also optionally maintained for reusable maps.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Table to hold hash indexed objects. The MapIndex allows linear access into a MapTable, that otherwise could have its elements being retrieved only by key. It can be increased, checked and dereferenced like a pointer, by means of suitable operators.

Author
Sergio Repetto s.rep.nosp@m.etto.nosp@m.@pent.nosp@m.aeng.nosp@m.ineer.nosp@m.ing..nosp@m.it

Index object to access MapTable elements

Derived classes may override new and delete operators to use managed free list from a MapTable.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Mappable object.

This class manages the types for generation of the persistent objects. Its data structures are managed automatically by the system. They are implicitly filled by the constructors who declare classes to the system.

Author
Daniel Silverstone

Base class for classes that will be persistent. This object is the base for all Persistent data which is not natively serialized by the persistence::engine

It registers itself with the persistence::TypeManager using a global constructor function. A matching deregister call is made in a global destructor, to allow DLL's to use the persistence::engine in a main executable.

Persistable objects must never maintain bad pointers. If a pointer doesn't point to something valid, it must be NULL. This is so the persistence engine knows whether to allocate memory for an object or whether the memory has been pre-allocated.

Author
Daniel Silverstone

This class constructs on a standard C++ STL stream and then operates in the mode specified. The stream passed into the constructor must be a binary mode to function properly.

Author
Daniel Silverstone

These are typically referenced thru Process::xxx static member functions. Many of these members are used both for win32 and posix systems although some may be platform specific.

Peocess wrapper class.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

The posix implimentation uses a pidfile and the win32 version uses a globally visible mutex.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

System-wide named lock

A serial is a system serial port that is used either for line or packet based data input. Serial ports may also be "streamable" in a derived form.

Common C++ serial I/O classes are used to manage serial devices and implement serial device protocols. From the point of view of Common C++, serial devices are supported by the underlying Posix specified "termios" call interface.

The serial I/O base class is used to hold a descriptor to a serial device and to provide an exception handling interface for all serial I/O classes. The base class is also used to specify serial I/O properties such as communication speed, flow control, data size, and parity. The "Serial" base class is not itself directly used in application development, however.

Common C++ Serial I/O is itself divided into two conceptual modes; frame oriented and line oriented I/O. Both frame and line oriented I/O makes use of the ability of the underlying tty driver to buffer data and return "ready" status from when select either a specified number of bytes or newline record has been reached by manipulating termios c_cc fields appropriately. This provides some advantage in that a given thread servicing a serial port can block and wait rather than have to continually poll or read each and every byte as soon as it appears at the serial port.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

base class for all serial I/O services.

A default slog object is used to avoid confusion with the native syslog facility and to imply a logical relationship to the C++ clog().

The key difference is that the slog object sends it's output to the system logging daemon (typically syslogd) rather than through stderr. slog can be streamed with the << operator just like clog; a default slog object is pre-initialized, and you stream character data to it.

The slog allows one to specify logging levels and other properties through the () operators. Hence, once can do:

slog("mydaemon", SLOG_DAEMON, SLOG_EMERGENCY) << I just died << endl; 

or things like:

slog("mydaemon", SLOG_DAEMON);
slog(SLOG_INFO) << "daemon initalized" << endl; 

The intent is to be as common-place and as convenient to use as the stderr based clog facility found in C++, and this is especially useful for C++ daemons.

The std::flush manipulator doesn't work. Either the std::endl or std::ends manipulators must be used to cause the output to be sent to the daemon.

When this class is used on a system that doesn't have the syslog headers (i.e. a non-posix win32 box), the output goes to the a file with the same name as the syslog identifier string with '.log' appended to it. If the identifier string ends in '.exe', the '.exe' is removed before the '.log' is appened. (e.g. the identifier foo.exe will generate a log file named foo.log)

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m
Minor docs & hacks by Jon Little littl.nosp@m.ej@a.nosp@m.rlut..nosp@m.utex.nosp@m.as.ed.nosp@m.u

system logging facility class.

A Mutex is used to protect access to the counter variable (an integer). An initial value can be specified for the counter, and it can be manipulated with the ++ and – operators.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

Thread protected integer counter. The MutexLock class is used to protect a section of code so that at any given time only a single thread can perform the protected operation.

It use Mutex to protect operation. Using this class is usefull and exception safe. The mutex that has been locked is automatically released when the function call stack falls out of scope, so one doesnt have to remember to unlock the mutex at each function return.

A common use is

void func_to_protect() { MutexLock lock(mutex); ... operation ... }

NOTE: do not declare variable as "MutexLock (mutex)", the mutex will be released at statement end.

Author
Frediano Ziglio fredd.nosp@m.y77@.nosp@m.angel.nosp@m.fire.nosp@m..com

Mutex automatic locker for protected access.

The ThreadLock is automatically released when the object falls out of scope.

A common use is

void func_to_protect() { ReadLock lock(threadlock); ... operation ... }

NOTE: do not declare variable as "ReadLock (threadlock)", the mutex will be released at statement end.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m..org

Read mode automatic locker for protected access.

The ThreadLock is automatically released when the object falls out of scope.

A common use is

void func_to_protect() { WriteLock lock(threadlock); ... operation ... }

NOTE: do not declare variable as "WriteLock (threadlock)", the mutex will be released at statement end.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m..org

Read mode automatic locker for protected access.

A common use is

void func_to_protect() { SemaphoreLock lock(semaphore); ... operation ... }

NOTE: do not declare variable as "SemaohoreLock (semaphore)", the mutex will be released at statement end.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m..org

Semaphore automatic locker for protected access.

The class has two purposes:

  • 1 To be used internaly in CommonCpp's date and time classes to make them thread safe.
  • 2 To be used by clients as thread safe replacements to the standard C functions, much like Thread::sleep() represents a thread safe version of the standard sleep() function.
Note
The class provides one function with the same name as its equivalent standard function and one with another, unique name. For new clients, the version with the unique name is recommended to make it easy to grep for accidental usage of the standard functions. The version with the standard name is provided for existing clients to sed replace their original version.
Also note that some functions that returned pointers have been redone to take that pointer as an argument instead, making the caller responsible for memory allocation/deallocation. This is almost how POSIX specifies *_r functions (reentrant versions of the standard time functions), except the POSIX functions also return the given pointer while we do not. We don't use the *_r functions as they aren't all generally available on all platforms yet.
Author
Idar Tollefsen idar@.nosp@m.cogn.nosp@m.ita.n.nosp@m.o

Thread safe date and time functions.

This is made into a stand-alone base class since other derived libraries (such as the serial handlers) may also use the pooled "service thread" model and hence also require this code for managing timing.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

synchronized millisecond timing for service threads.

The StringTokenizer takes a pointer to a string and a pointer to a string containing a number of possible delimiters. The StringTokenizer provides an input forward iterator which allows to iterate through all tokens. An iterator behaves like a logical pointer to the tokens, i.e. to shift to the next token, you've to increment the iterator, you get the token by dereferencing the iterator.

Memory consumption: This class operates on the original string and only allocates memory for the individual tokens actually requested, so this class allocates at maximum the space required for the longest token in the given string. Since for each iteration, memory is reclaimed for the last token, you MAY NOT store pointers to them; if you need them afterwards, copy them. You may not modify the original string while you operate on it with the StringTokenizer; the behaviour is undefined in that case.

The iterator has one special method 'nextDelimiter()' which returns a character containing the next delimiter following this tokenization process or '\0', if there are no following delimiters. In case of skipAllDelim, it returns the FIRST delimiter.

With the method 'setDelimiters(const char*)' you may change the set of delimiters. It affects all running iterators.

Example:

 StringTokenizer st("mary had a little lamb;its fleece was..", " ;");
 StringTokenizer::iterator i;
 for (i = st.begin() ; i != st.end() ; ++i) {
       cout << "Token: '" << *i << "'\t";
       cout << " next Delim: '" << i.nextDelimiter() << "'" << endl;
 }
 

Author
Henner Zeller H.Zel.nosp@m.ler@.nosp@m.acm.o.nosp@m.rg
License:\n LGPL

This class implements a basic XML stream parser that can be used to examine an XML resource thru virtual I/O methods. This class must be derived into one that can implement the physical I/O required to parse actual data. A mixer class using XMLParser and tcpstream would be one example of this. This can also be used to parse xml content in memory buffers easily. This parser is only concerned with well-formedness, and does not perform validation.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Constructor. Does not deal with any state.

keeps compilers happy.

Pure virtual application operator. Apply the validation algorithm specific to derived classes.

Get network address associated with this cidr.

Returns
system binary coded address.

Get network mask associated with this cidr.

Returns
system binary coded network mask.

Compute the broadcast address associated with this cidr.

Returns
system binary coded network address.

Set the cidr from a full or partial hostname, or from an address/mask, or a host/bits specification.

Parameters
cidrstring to use.

Construct a new cidr from a string.

Parameters
cidrstring to use.

Construct an empty cidr.

Construct a copy of a cidr.

Parameters
cidrto copy from.

See if a socket address is a member of this cidr's network.

Parameters
saddrpointer to test.
Returns
true if member of cidr.

See if a low level address object is a member of this cidr's net.

Parameters
inaddrobject to test.
Returns
true if member of cidr.

Get network address associated with this cidr.

Returns
system binary coded address.

Get network mask associated with this cidr.

Returns
system binary coded network mask.

Compute the broadcast address associated with this cidr.

Returns
system binary coded network address.

Set the cidr from a full or partial hostname, or from a host/bits specification.

Parameters
cidrstring to use.

Construct a new cidr from a string.

Parameters
cidrstring to use.

Construct an empty cidr.

Construct a copy of a cidr.

Parameters
cidrto copy from.

See if a socket address is a member of this cidr's network.

Parameters
saddrpointer to test.
Returns
true if member of cidr.

See if a low level address object is a member of this cidr's net.

Parameters
inaddrobject to test.
Returns
true if member of cidr.

Sets the IP address from a string representation of the numeric address, ie "127.0.0.1"

Parameters
hostThe string representation of the IP address
Returns
true if successful

Used to specify a host name or numeric internet address.

Parameters
hostThe string representation of the IP address or a hostname, , if NULL, it will default to INADDR_ANY

Create an Internet Address object with an empty (0.0.0.0) address.

Parameters
validatoroptional validator function object, intended for derived classes.

Convert the system internet address data type (struct in_addr) into a Common C++ IPV4Address object.

Parameters
addrstruct of system used binary internet address.
validatoroptional validator function object, intended for derived classes.

Convert a null terminated ASCII host address string (example: "127.0.0.1") or host address name (example: "www.voxilla.org") directly into a Common C++ IPV4Address object.

Parameters
addressnull terminated C string.
validatoroptional validator function object, intended for derived classes.

Copy constructor

Destructor

Provide a string representation of the value (Internet Address) held in the IPV4Address object.

Returns
string representation of IPV4Address.

May be used to verify if a given IPV4Address returned by another function contains a "valid" address, or "0.0.0.0" which is often used to mark "invalid" IPV4Address values.

Returns
true if address != 0.0.0.0.

Provide a low level system usable struct in_addr object from the contents of IPV4Address. This is needed for services such as bind() and connect().

Returns
system binary coded internet address.

Provide a low level system usable struct in_addr object from the contents of IPV4Address. This is needed for services such as bind() and connect().

Parameters
ifor IPV4Addresses with multiple addresses, returns the address at this index. User should call getAddressCount() to determine the number of address the object contains.
Returns
system binary coded internet address. If parameter i is out of range, the first address is returned.

Returns the number of internet addresses that an IPV4Address object contains. This usually only happens with IPV4Host objects where multiple IP addresses are returned for a DNS lookup

Allows assignment from the return of functions like inet_addr() or htonl()

Compare two internet addresses to see if they are equal (if they specify the physical address of the same internet host).

If there is more than one IP address in either IPV4Address object, this will return true if all of the IP addresses in the smaller are in the larger in any order.

Compare two internet addresses to see if they are not equal (if they each refer to unique and different physical ip addresses).

This is implimented in terms of operator==

Constructor. Does not deal with any state.

Keeps compilers happy.

Pure virtual application operator. Apply the validation algorithm specific to derived classes.

Sets the IP address from a string representation of the numeric address, ie "127.0.0.1"

Parameters
hostThe string representation of the IP address
Returns
true if successful

Used to specify a host name or numeric internet address.

Parameters
hostThe string representation of the IP address or a hostname, , if NULL, it will default to INADDR_ANY

Create an Internet Address object with an empty (0.0.0.0) address.

Parameters
validatoroptional validator function object, intended for derived classes.

Convert the system internet address data type (struct in_addr) into a Common C++ IPV6Address object.

Parameters
addrstruct of system used binary internet address.
validatoroptional validator function object, intended for derived classes.

Convert a null terminated ASCII host address string (example: "127.0.0.1") or host address name (example: "www.voxilla.org") directly into a Common C++ IPV6Address object.

Parameters
addressnull terminated C string.
validatoroptional validator function object, intended for derived classes.

Copy constructor

Destructor

Provide a string representation of the value (Internet Address) held in the IPV6Address object.

Returns
string representation of IPV6Address.

May be used to verify if a given IPV6Address returned by another function contains a "valid" address, or "0.0.0.0" which is often used to mark "invalid" IPV6Address values.

Returns
true if address != 0.0.0.0.

Provide a low level system usable struct in_addr object from the contents of IPV6Address. This is needed for services such as bind() and connect().

Returns
system binary coded internet address.

Provide a low level system usable struct in_addr object from the contents of IPV6Address. This is needed for services such as bind() and connect().

Parameters
ifor IPV6Addresses with multiple addresses, returns the address at this index. User should call getAddressCount() to determine the number of address the object contains.
Returns
system binary coded internet address. If parameter i is out of range, the first address is returned.

Returns the number of internet addresses that an IPV6Address object contains. This usually only happens with IPV6Host objects where multiple IP addresses are returned for a DNS lookup

Compare two internet addresses to see if they are equal (if they specify the physical address of the same internet host).

If there is more than one IP address in either IPV6Address object, this will return true if all of the IP addresses in the smaller are in the larger in any order.

Compare two internet addresses to see if they are not equal (if they each refer to unique and different physical ip addresses).

This is implimented in terms of operator==

output string

HEXdump constructor.

Parameters
bufferbuffer to be "hexdumped"
buff_lenbuffer length
max_lenmax number of bytes to be "hexdumped". Usefull to truncate output. mas_len=0 does prints all.

HEXdump destructor.

const char* cast provided for conveneince.

string cast provided for conveneince.

operator <<

Parameters
hdhexdump.
Returns
application logger stream

Virtual method to filter results. Virtual override methods should call baseclass method to assure . and .. names are stripped out.

Returns
true if current filename is accepted.
Parameters
filepath to examine
inoinfo of type, date, etc.

Construct a directory tree walk starting at the specified prefix. A maximum subdirectory depth is also specified.

Parameters
prefixto start walk.
maxdepthsubdirectory depth to examine.

Construct an un-opened directory tree of a known maximum depth

Parameters
maxdepthsubdirectory subdirectory depth.

Open a directory tree path.

Parameters
prefixdirectory path to open.

Close the directory path.

Extract the next full pathname from the directory walk. When returning directories, a '/' is appended. The returned string is a buffer of MAX_PATH size.

Returns
path of next subdirectory entry or NULL.

This is used to step through the filter virtual for an entire subtree, and is used for cases where a derived DirTree class performs it's primary operations through filter rather than externally by calling getPath().

Returns
number of files and directories examined.
Parameters
prefixdirectory path to examine.

Construct and load a DSO object file.

Parameters
filenamepathname of object file to load.

Retrieve error indicator associated with DSO failure. This is often used in catch handlers.

Detach a DSO object from running memory.

Lookup a symbol in the loaded file.

Find a specific DSO object by filename.

Parameters
nameof DSO object file (partial).

See if DSO object is valid.

Returns
true if valid.

Install debug handler...

Contruct a multi-part document, and describe it's type.

Parameters
document(content) type.

Stream the headers of the multi-part document. The headers of individual entities are streamed as part of the body.

Parameters
outputto stream document header into.

Stream the "body" of the multi-part document. This involves streaming the headers and body of each document part.

Parameters
outputto stream document body into.

Get a string array of the headers to use. This is used to assist URLStream::post.

Returns
array of headers.

Stream the header(s) for the current document part.

Parameters
outputto stream header into.

Stream the content of this document part.

Parameters
outputto stream document body into.

Construct and attach a document part to a multipart document.

Parameters
topmultipart document to attach to.
ctContent-Type to use.

The constructor simply initializes the count.

The destructor is called when the reference count returns to zero. This is done through a virtual destructor.

The actual object being managed can be returned by this method as a void and then recast to the actual type. This removes the need to dynamic cast from RefObject and the dependence on rtti this implies.

Returns
underlying object being referenced.

Detach current object, for example, when changing pointer.

Patch point for mutex in derived class. This may often be a single static mutex shared by a managed type.

Patch point for a mutex in derived class. This may often be a single static mutex shared by a managed type.

Create an unattached pointer.

Create a pointer attached to a reference counted object.

Object being referenced.

A copy constructor.

Pointer being copied.

Get first linked object in list. This may be dynamically recast, and may refer to a master static bookmark pointer in a derived class. Otherwise it simply returns the current object. In a "free" list, this may not only return the first object, but also set the first to next.

Returns
pointer to first object in list.

Gets the last object in the list. This normally follows the links to the end. This is a virtual because derived class may include a static member bookmark for the current end.

Returns
pointer to last object in list.

Get next object, for convenience. Derived class may use this with a dynamic cast.

Returns
next object in list.

Insert object into chain. This is a virtual because derived class may choose instead to perform an insert at head or tail, may manage bookmarks, and may add mutex lock.

Parameters
objectbeing inserted.

Requested in overloaded insert() method to indicate how to insert data into list

< insert at first position in list pointed by current object

< insert at last position in list pointed by current object

< insert in list before current object

< insert in list after current object

Get first linked object in list. This may be dynamically recast, and may refer to a master static bookmark pointer in a derived class. Otherwise it follows list to front.

Returns
pointer to first object in list.

Gets the last object in the list. This normally follows the links to the end. This is a virtual because derived class may include a static member bookmark for the current end.

Returns
pointer to last object in list.

Virtual to get the insert point to use when adding new members. This may be current, or always head or always tail. As a virtual, this allows derived class to establish "policy".

Returns
pointer to insertion point in list.

Get next object, for convenience. Derived class may use this with a dynamic cast.

Returns
next object in list.

Get prev object in the list.

Returns
pointer to previous object.

Insert object into chain at given pos, as indicated by InsertMode; If no pos is given, it defaults to modeAtLast, inserting element at list's end.

Parameters
objectbeing inserted.
positionwhere object is inserted.

Remove object from chain.

Creates an empty map index (pointing to nothing).

Creates a map index pointing to a specific map object

Parameters
theindexed object

Creates a copy of a given map index

Parameters
thesource index object

Dereference operator: the pointed object it is returned as void * for easy re-cast.

Returns
pointer to indexed object.

Assignment operator to avoid implicit cast.

Returns
the object itself, as changed.

Prefix increment operator, to be used in loops and such.

Returns
the object itself, as changed.

Postfix increment operator, to be used in loops and such.

Returns
the object itself, as changed.

Comparison operator, between two MapIndex's.

Returns
the object itself, as changed.

Comparison operator, between the MapIndex and a MapObject, useful to avoid casts for sake of clearness.

Returns
the object itself, as changed.

Remove the object from it's current table.

Save id, mark as not using any table.

Parameters
idstring for this object.

This manages a registration to the typemanager - attempting to remove problems with the optimizers

This adds a new construction function to the type manager

And this one removes a type from the managers lists

This function creates a new object of the required type and returns a pointer to it. NULL is returned if we couldn't find the type

This constructor is used in serialization processes. It is called in CreateNewInstance in order to create an instance of the class to have Read() called on it.

Default destructor

This returns the ID of the persistent object (Its type)

This method is used to write to the Persistence::Engine It is not equivalent to the << operator as it writes only the data and not the object type etc.

This method is used to read from a Persistence::Engine It is not equivalent to the >> operator as it does no typesafety or anything.

These are the modes the Persistence::Engine can work in

Constructs a Persistence::Engine with the specified stream in the given mode. The stream must be initialized properly prior to this call or problems will ensue.

writes a PersistObject from a reference.

writes a PersistObject from a pointer.

reads a PersistObject into a reference overwriting the object.

reads a PersistObject into a pointer allocating memory for the object if necessary.

reads the actual object data into a pre-instantiated object pointer by calling the read function of the derived class.

reads in a class name, and caches it into the ClassMap.

The underlying stream

The mode of the engine. read or write

Typedefs for the Persistence::PersistObject support

Detach current process into a daemon, posix only. Perhaps a similar method can be used for creating win32 "services"?

Attach the current process to another device or i/o session. It is deamonified and dissasociated with the prior parent process and controlling terminal.

Parameters
devnamepath to attach to.

Set a posix compliant signal handler.

Returns
previous handler.
Parameters
signosignal no.
handlertrap handler.

Set system call interuptable signal handler.

#return previous handler.

Parameters
signosignal no.
handlertrap handler.

Lock a process in memory. Ideally you should be deep enough where additional memallocs for functions will not kill you, or use false for future.

Returns
true if successful.
Parameters
futurepages as well...

Unlock process pages.

Spawn a process and wait for it's exit code. In win32 this is done with the spawn system call. In posix, this is done with a fork, an execvp, and a waitpid.

Warning
The implementation differences between posix and win32 systems may cause side effects. For instance, if you use atexit() and this spawn method, on posix systems the function set up with atexit() will be called when the parent process of the fork exits, which will not happen on Win32 systems.
Returns
error code from process.
Parameters
execname of executable.
argvlist of command arguments.
waitfor process to exit before return.

Get the exit status of another process, waiting for it to exit.

Returns
exit code from process.
Parameters
pidprocess id.

Cancel a running child process.

Returns
0 on success.
Parameters
pidprocess id.
sigcancel signal to apply.

Get system environment.

Returns
system environ symbol.
Parameters
nameof symbol.

Set system environment in a standard manner.

Parameters
nameof environment symbol to set.
valueof environment symbol.
overwritetrue if replace existing symbol.

Get etc prefix path.

Returns
etc prefix.

Get home directory.

Returns
user home directory.

Get user name.

Returns
user login id.

Set user id by name.

Returns
true if successful.

Set the effective group id by name.

Returns
true if successful.

Return the effective operating system page size.

Returns
system page size.

Used to set process priority and optionally enable realtime.

Used to set process scheduling policy.

Portable shortcut for setting realtime...

Return true if scheduler settable.

Return true if realtime scheduling.

Create a lock under a known name.

Parameters
nameof system-wide lock to create.

Create a new lock object that can be used to make locks.

Destroy the current lock and release it.

Lock a system-wide name for this process. If the lock is successful, return true. If an existing lock was already acquired, release it first.

Returns
true if lock successful.
Parameters
namesystem-wide lock to use.

Release an acquired lock.

Flag if the current process has aqcuired a lock.

Returns
true if we have the lock.

Used to properly initialize serial object.

Opens the serial device.

Parameters
fnamePathname of device to open

Closes the serial device.

Reads from serial device.

Parameters
DataPoint to character buffer to receive data. Buffers MUST be at least Length + 1 bytes in size.
LengthNumber of bytes to read.

Writes to serial device.

Parameters
DataPoint to character buffer containing data to write. Buffers MUST
LengthNumber of bytes to write.

This service is used to throw all serial errors which usually occur during the serial constructor.

Parameters
errordefined serial error id.
errstrstring or message to optionally pass.

This service is used to thow application defined serial errors where the application specific error code is a string.

Parameters
errstring or message to pass.

This method is used to turn the error handler on or off for "throwing" execptions by manipulating the thrown flag.

Parameters
enabletrue to enable handler.

Set packet read mode and "size" of packet read buffer. This sets VMIN to x. VTIM is normally set to "0" so that "isPending()" can wait for an entire packet rather than just the first byte.

Returns
actual buffer size set.
Parameters
sizeof packet read request.
btimeroptional inter-byte data packet timeout.

Set "line buffering" read mode and specifies the newline character to be used in seperating line records. isPending can then be used to wait for an entire line of input.

Parameters
newlinenewline character.
nl1EOL2 control character.
Returns
size of conical input buffer.

Restore serial device to the original settings at time of open.

Used to flush the input waiting queue.

Used to flush any pending output data.

Used to wait until all output has been sent.

Used as the default destructor for ending serial I/O services. It will restore the port to it's original state.

Used to initialize a newly opened serial file handle. You should set serial properties and DTR manually before first use.

This allows later ttystream class to open and close a serial device.

A serial object may be constructed from a named file on the file system. This named device must be "isatty()".

Parameters
nameof file.

The serial base class may be "thrown" as a result on an error, and the "catcher" may then choose to destory the object. By assuring the socket base class is a virtual destructor, we can assure the full object is properly terminated.

Serial ports may also be duplecated by the assignment operator.

Set serial port speed for both input and output.

Returns
0 on success.
Parameters
speedto select. 0 signifies modem "hang up".

Set character size.

Returns
0 on success.
Parameters
bitscharacter size to use (usually 7 or 8).

Set parity mode.

Returns
0 on success.
Parameters
paritymode.

Set number of stop bits.

Returns
0 on success.
Parameters
bitsstop bits.

Set flow control.

Returns
0 on success.
Parameters
flowcontrol mode.

Set the DTR mode off momentarily.

Parameters
millisecnumber of milliseconds.

Send the "break" signal.

Often used by a "catch" to fetch the last error of a thrown serial.

Returns
error numbr of last Error.

Often used by a "catch" to fetch the user set error string of a thrown serial.

Returns
string for error message.

Get the "buffer" size for buffered operations. This can be used when setting packet or line read modes to determine how many bytes to wait for in a given read call.

Returns
number of bytes used for buffering.

Get the status of pending operations. This can be used to examine if input or output is waiting, or if an error has occured on the serial device.

Returns
true if ready, false if timeout.
Parameters
pendready check to perform.
timeoutin milliseconds.

Acquire the mutex

Parameters
_mutexreference to mutex to aquire.

Release the mutex automatically

Wait for read access

Parameters
_tlreference to lock to aquire.

Post the semaphore automatically

Wait for write access

Parameters
_tlreference to threadlock to aquire.

Post the semaphore automatically

Wait for the semaphore

Post the semaphore automatically

Create a timer, mark it as inactive, and set the initial "start" time to the creation time of the timer object. This allows "incTimer" to initially refer to time delays relative to the original start time of the object.

Set a new start time for the object based on when this call is made and optionally activate the timer for a specified number of milliseconds. This can be used to set the starting time of a realtime session.

Parameters
timeoutdelay in milliseconds from "now"

Set a timeout based on the current time reference value either from object creation or the last setTimer(). This reference can be used to time synchronize realtime data over specified intervals and force expiration when a new frame should be released in a synchronized manner.

Parameters
timeoutdelay in milliseconds from reference.

Adjust a timeout based on the current time reference value either from object creation or the last setTimer(). This reference can be used to time synchronize realtime data over specified intervals and force expiration when a new frame should be released in a synchronized manner.

Parameters
timeoutdelay in milliseconds from reference.

Sleep until the current timer expires. This is useful in time syncing realtime periodic tasks.

This is used to "disable" the service thread from expiring the timer object. It does not effect the reference time from either creation or a setTimer().

This is used by service threads to determine how much time remains before the timer expires based on a timeout specified in setTimer() or incTimer(). It can also be called after setting a timeout with incTimer() to see if the current timeout has already expired and hence that the application is already delayed and should skip frame(s).

return time remaining in milliseconds, or TIMEOUT_INF if inactive.

This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set. This allows one to use setTimer() to set the timer to the current time and then measure elapsed time from that point forward.

return time elapsed in milliseconds, or TIMEOUT_INF if inactive.

a delimiter string containing all usual whitespace delimiters. These are space, tab, newline, carriage return, formfeed and vertical tab. (see isspace() manpage).

Exception thrown, if someone tried to read beyond the end of the tokens. Will not happen if you use it the 'clean' way with comparison against end(), but if you skip some tokens, because you 'know' they are there. Simplifies error handling a lot, since you can just read your tokens the way you expect it, and if there is some error in the input this Exception will be thrown.

The input forward iterator for tokens.

Author
Henner Zeller

copy constructor.

assignment operator.

shifts this iterator to the next token in the string.

returns the immutable string this iterator points to or '0' if no token is available (i.e. i == end()). Do not store pointers to this token, since it is invalidated for each iteration. If you need the token, copy it (e.g. with strdup());

returns the next delimiter after the current token or '\0', if there are no following delimiters. It returns the very next delimiter (even if skipAllDelim=true).

compares to other iterator. Usually used to compare against the end() iterator.

compares to other iterator. Usually used to compare against the end() iterator.

creates a new StringTokenizer for a string and a given set of delimiters.

Parameters
strString to be split up. This string will not be modified by this StringTokenizer, but you may as well not modfiy this string while tokenizing is in process, which may lead to undefined behaviour.
delimString containing the characters which should be regarded as delimiters.
skipAllDelimOPTIONAL. true, if subsequent delimiters should be skipped at once or false, if empty tokens should be returned for two delimiters with no other text inbetween. The first behaviour may be desirable for whitespace skipping, the second for input with delimited entry e.g. /etc/passwd like files or CSV input. NOTE, that 'true' here resembles the ANSI-C strtok(char *s,char *d) behaviour. DEFAULT = false
trimOPTIONAL. true, if the tokens returned should be trimmed, so that they don't have any whitespaces at the beginning or end. Whitespaces are any of the characters defined in StringTokenizer::SPACE. If delim itself is StringTokenizer::SPACE, this will result in a behaviour with skipAllDelim = true. DEFAULT = false

create a new StringTokenizer which splits the input string at whitespaces. The tokens are stripped from whitespaces. This means, if you change the set of delimiters in either the 'begin(const char *delim)' method or in 'setDelimiters()', you then get whitespace trimmed tokens, delimited by the new set. Behaves like StringTokenizer(s, StringTokenizer::SPACE,false,true);

returns the begin iterator

changes the set of delimiters used in subsequent iterations.

returns a begin iterator with an alternate set of delimiters.

the iterator marking the end.

Create xml parser.

Parameters
sizeof XML data buffer.

Destroy xml parser.

Virtual to receive embedded comments in XML document being parsed.

Parameters
textreceived.
sizeof text received.

Virtual to receive character text extracted from the document.

Parameters
textreceived.
sizeof text received.

Notify start of document event.

Notify end of document event.

Notify start of an element in the document.

Parameters
nameof element found.
attrlist of attributes extracted.

Notify end of an element in the document.

Parameters
nameof element ending.

Parse a chunk of data and return parser completion flag. This is used to externally drive data into the XML parser. The return status can be used to determine when a document has been fully parsed. This can be called multiple times to push stream data into the parser.

Parameters
addressof data to parse.
sizeof data to parse.

Parse a stream buffer and return parser document completion flag. This is used to scan a stream buffer for a complete XML document. The stream is scanned until the document is complete or EOF. Multiple XML document instances can be scanned from a continues XML streaming source.

Parameters
streambuffer to parse.
Returns
true if parse complete, false if invalid or EOF.

Parse a file buffer and return parser document completion flag. This is used to scan a file buffer for a complete XML document. The file is scanned until the document is complete or EOF. Multiple XML document instances can be scanned from a continues XML streaming source.

Parameters
filebuffer to parse.
Returns
true if parse complete, false if invalid or EOF.

End of document check.

Returns
true if end of document.

Get network address associated with this cidr.

Returns
system binary coded address.

Get network mask associated with this cidr.

Returns
system binary coded network mask.

Compute the broadcast address associated with this cidr.

Returns
system binary coded network address.

Set the cidr from a full or partial hostname, or from an address/mask, or a host/bits specification.

Parameters
cidrstring to use.

Construct a new cidr from a string.

Parameters
cidrstring to use.

Construct an empty cidr.

Construct a copy of a cidr.

Parameters
cidrto copy from.

See if a socket address is a member of this cidr's network.

Parameters
saddrpointer to test.
Returns
true if member of cidr.

See if a low level address object is a member of this cidr's net.

Parameters
inaddrobject to test.
Returns
true if member of cidr.

Get network address associated with this cidr.

Returns
system binary coded address.

Get network mask associated with this cidr.

Returns
system binary coded network mask.

Compute the broadcast address associated with this cidr.

Returns
system binary coded network address.

Set the cidr from a full or partial hostname, or from a host/bits specification.

Parameters
cidrstring to use.

Construct a new cidr from a string.

Parameters
cidrstring to use.

Construct an empty cidr.

Construct a copy of a cidr.

Parameters
cidrto copy from.

See if a socket address is a member of this cidr's network.

Parameters
saddrpointer to test.
Returns
true if member of cidr.

See if a low level address object is a member of this cidr's net.

Parameters
inaddrobject to test.
Returns
true if member of cidr.

Sets the IP address from a string representation of the numeric address, ie "127.0.0.1"

Parameters
hostThe string representation of the IP address
Returns
true if successful

Used to specify a host name or numeric internet address.

Parameters
hostThe string representation of the IP address or a hostname, , if NULL, it will default to INADDR_ANY

Create an Internet Address object with an empty (0.0.0.0) address.

Parameters
validatoroptional validator function object, intended for derived classes.

Convert the system internet address data type (struct in_addr) into a Common C++ IPV4Address object.

Parameters
addrstruct of system used binary internet address.
validatoroptional validator function object, intended for derived classes.

Convert a null terminated ASCII host address string (example: "127.0.0.1") or host address name (example: "www.voxilla.org") directly into a Common C++ IPV4Address object.

Parameters
addressnull terminated C string.
validatoroptional validator function object, intended for derived classes.

Copy constructor

Destructor

Provide a string representation of the value (Internet Address) held in the IPV4Address object.

Returns
string representation of IPV4Address.

May be used to verify if a given IPV4Address returned by another function contains a "valid" address, or "0.0.0.0" which is often used to mark "invalid" IPV4Address values.

Returns
true if address != 0.0.0.0.

Provide a low level system usable struct in_addr object from the contents of IPV4Address. This is needed for services such as bind() and connect().

Returns
system binary coded internet address.

Provide a low level system usable struct in_addr object from the contents of IPV4Address. This is needed for services such as bind() and connect().

Parameters
ifor IPV4Addresses with multiple addresses, returns the address at this index. User should call getAddressCount() to determine the number of address the object contains.
Returns
system binary coded internet address. If parameter i is out of range, the first address is returned.

Returns the number of internet addresses that an IPV4Address object contains. This usually only happens with IPV4Host objects where multiple IP addresses are returned for a DNS lookup

Allows assignment from the return of functions like inet_addr() or htonl()

Compare two internet addresses to see if they are equal (if they specify the physical address of the same internet host).

If there is more than one IP address in either IPV4Address object, this will return true if all of the IP addresses in the smaller are in the larger in any order.

Compare two internet addresses to see if they are not equal (if they each refer to unique and different physical ip addresses).

This is implimented in terms of operator==

Constructor. Does not deal with any state.

Keeps compilers happy.

Pure virtual application operator. Apply the validation algorithm specific to derived classes.

Sets the IP address from a string representation of the numeric address, ie "127.0.0.1"

Parameters
hostThe string representation of the IP address
Returns
true if successful

Used to specify a host name or numeric internet address.

Parameters
hostThe string representation of the IP address or a hostname, , if NULL, it will default to INADDR_ANY

Create an Internet Address object with an empty (0.0.0.0) address.

Parameters
validatoroptional validator function object, intended for derived classes.

Convert the system internet address data type (struct in_addr) into a Common C++ IPV6Address object.

Parameters
addrstruct of system used binary internet address.
validatoroptional validator function object, intended for derived classes.

Convert a null terminated ASCII host address string (example: "127.0.0.1") or host address name (example: "www.voxilla.org") directly into a Common C++ IPV6Address object.

Parameters
addressnull terminated C string.
validatoroptional validator function object, intended for derived classes.

Copy constructor

Destructor

Provide a string representation of the value (Internet Address) held in the IPV6Address object.

Returns
string representation of IPV6Address.

May be used to verify if a given IPV6Address returned by another function contains a "valid" address, or "0.0.0.0" which is often used to mark "invalid" IPV6Address values.

Returns
true if address != 0.0.0.0.

Provide a low level system usable struct in_addr object from the contents of IPV6Address. This is needed for services such as bind() and connect().

Returns
system binary coded internet address.

Provide a low level system usable struct in_addr object from the contents of IPV6Address. This is needed for services such as bind() and connect().

Parameters
ifor IPV6Addresses with multiple addresses, returns the address at this index. User should call getAddressCount() to determine the number of address the object contains.
Returns
system binary coded internet address. If parameter i is out of range, the first address is returned.

Returns the number of internet addresses that an IPV6Address object contains. This usually only happens with IPV6Host objects where multiple IP addresses are returned for a DNS lookup

Compare two internet addresses to see if they are equal (if they specify the physical address of the same internet host).

If there is more than one IP address in either IPV6Address object, this will return true if all of the IP addresses in the smaller are in the larger in any order.

Compare two internet addresses to see if they are not equal (if they each refer to unique and different physical ip addresses).

This is implimented in terms of operator==

output string

HEXdump constructor.

Parameters
bufferbuffer to be "hexdumped"
buff_lenbuffer length
max_lenmax number of bytes to be "hexdumped". Usefull to truncate output. mas_len=0 does prints all.

HEXdump destructor.

const char* cast provided for conveneince.

string cast provided for conveneince.

operator <<

Parameters
hdhexdump.
Returns
application logger stream

Virtual method to filter results. Virtual override methods should call baseclass method to assure . and .. names are stripped out.

Returns
true if current filename is accepted.
Parameters
filepath to examine
inoinfo of type, date, etc.

Construct a directory tree walk starting at the specified prefix. A maximum subdirectory depth is also specified.

Parameters
prefixto start walk.
maxdepthsubdirectory depth to examine.

Construct an un-opened directory tree of a known maximum depth

Parameters
maxdepthsubdirectory subdirectory depth.

Open a directory tree path.

Parameters
prefixdirectory path to open.

Close the directory path.

Extract the next full pathname from the directory walk. When returning directories, a '/' is appended. The returned string is a buffer of MAX_PATH size.

Returns
path of next subdirectory entry or NULL.

This is used to step through the filter virtual for an entire subtree, and is used for cases where a derived DirTree class performs it's primary operations through filter rather than externally by calling getPath().

Returns
number of files and directories examined.
Parameters
prefixdirectory path to examine.

Construct and load a DSO object file.

Parameters
filenamepathname of object file to load.

Retrieve error indicator associated with DSO failure. This is often used in catch handlers.

Detach a DSO object from running memory.

Lookup a symbol in the loaded file.

Find a specific DSO object by filename.

Parameters
nameof DSO object file (partial).

See if DSO object is valid.

Returns
true if valid.

Install debug handler...

Contruct a multi-part document, and describe it's type.

Parameters
document(content) type.

Stream the headers of the multi-part document. The headers of individual entities are streamed as part of the body.

Parameters
outputto stream document header into.

Stream the "body" of the multi-part document. This involves streaming the headers and body of each document part.

Parameters
outputto stream document body into.

Get a string array of the headers to use. This is used to assist URLStream::post.

Returns
array of headers.

Stream the header(s) for the current document part.

Parameters
outputto stream header into.

Stream the content of this document part.

Parameters
outputto stream document body into.

Construct and attach a document part to a multipart document.

Parameters
topmultipart document to attach to.
ctContent-Type to use.

The constructor simply initializes the count.

The destructor is called when the reference count returns to zero. This is done through a virtual destructor.

The actual object being managed can be returned by this method as a void and then recast to the actual type. This removes the need to dynamic cast from RefObject and the dependence on rtti this implies.

Returns
underlying object being referenced.

Detach current object, for example, when changing pointer.

Patch point for mutex in derived class. This may often be a single static mutex shared by a managed type.

Patch point for a mutex in derived class. This may often be a single static mutex shared by a managed type.

Create an unattached pointer.

Create a pointer attached to a reference counted object.

Object being referenced.

A copy constructor.

Pointer being copied.

Get first linked object in list. This may be dynamically recast, and may refer to a master static bookmark pointer in a derived class. Otherwise it simply returns the current object. In a "free" list, this may not only return the first object, but also set the first to next.

Returns
pointer to first object in list.

Gets the last object in the list. This normally follows the links to the end. This is a virtual because derived class may include a static member bookmark for the current end.

Returns
pointer to last object in list.

Get next object, for convenience. Derived class may use this with a dynamic cast.

Returns
next object in list.

Insert object into chain. This is a virtual because derived class may choose instead to perform an insert at head or tail, may manage bookmarks, and may add mutex lock.

Parameters
objectbeing inserted.

Requested in overloaded insert() method to indicate how to insert data into list

< insert at first position in list pointed by current object

< insert at last position in list pointed by current object

< insert in list before current object

< insert in list after current object

Get first linked object in list. This may be dynamically recast, and may refer to a master static bookmark pointer in a derived class. Otherwise it follows list to front.

Returns
pointer to first object in list.

Gets the last object in the list. This normally follows the links to the end. This is a virtual because derived class may include a static member bookmark for the current end.

Returns
pointer to last object in list.

Virtual to get the insert point to use when adding new members. This may be current, or always head or always tail. As a virtual, this allows derived class to establish "policy".

Returns
pointer to insertion point in list.

Get next object, for convenience. Derived class may use this with a dynamic cast.

Returns
next object in list.

Get prev object in the list.

Returns
pointer to previous object.

Insert object into chain at given pos, as indicated by InsertMode; If no pos is given, it defaults to modeAtLast, inserting element at list's end.

Parameters
objectbeing inserted.
positionwhere object is inserted.

Remove object from chain.

Creates an empty map index (pointing to nothing).

Creates a map index pointing to a specific map object

Parameters
theindexed object

Creates a copy of a given map index

Parameters
thesource index object

Dereference operator: the pointed object it is returned as void * for easy re-cast.

Returns
pointer to indexed object.

Assignment operator to avoid implicit cast.

Returns
the object itself, as changed.

Prefix increment operator, to be used in loops and such.

Returns
the object itself, as changed.

Postfix increment operator, to be used in loops and such.

Returns
the object itself, as changed.

Comparison operator, between two MapIndex's.

Returns
the object itself, as changed.

Comparison operator, between the MapIndex and a MapObject, useful to avoid casts for sake of clearness.

Returns
the object itself, as changed.

Remove the object from it's current table.

Save id, mark as not using any table.

Parameters
idstring for this object.

This manages a registration to the typemanager - attempting to remove problems with the optimizers

This adds a new construction function to the type manager

And this one removes a type from the managers lists

This function creates a new object of the required type and returns a pointer to it. NULL is returned if we couldn't find the type

This constructor is used in serialization processes. It is called in CreateNewInstance in order to create an instance of the class to have Read() called on it.

Default destructor

This returns the ID of the persistent object (Its type)

This method is used to write to the Persistence::Engine It is not equivalent to the << operator as it writes only the data and not the object type etc.

This method is used to read from a Persistence::Engine It is not equivalent to the >> operator as it does no typesafety or anything.

These are the modes the Persistence::Engine can work in

Constructs a Persistence::Engine with the specified stream in the given mode. The stream must be initialized properly prior to this call or problems will ensue.

writes a PersistObject from a reference.

writes a PersistObject from a pointer.

reads a PersistObject into a reference overwriting the object.

reads a PersistObject into a pointer allocating memory for the object if necessary.

reads the actual object data into a pre-instantiated object pointer by calling the read function of the derived class.

reads in a class name, and caches it into the ClassMap.

The underlying stream

The mode of the engine. read or write

Typedefs for the Persistence::PersistObject support

Detach current process into a daemon, posix only. Perhaps a similar method can be used for creating win32 "services"?

Attach the current process to another device or i/o session. It is deamonified and dissasociated with the prior parent process and controlling terminal.

Parameters
devnamepath to attach to.

Set a posix compliant signal handler.

Returns
previous handler.
Parameters
signosignal no.
handlertrap handler.

Set system call interuptable signal handler.

#return previous handler.

Parameters
signosignal no.
handlertrap handler.

Lock a process in memory. Ideally you should be deep enough where additional memallocs for functions will not kill you, or use false for future.

Returns
true if successful.
Parameters
futurepages as well...

Unlock process pages.

Spawn a process and wait for it's exit code. In win32 this is done with the spawn system call. In posix, this is done with a fork, an execvp, and a waitpid.

Warning
The implementation differences between posix and win32 systems may cause side effects. For instance, if you use atexit() and this spawn method, on posix systems the function set up with atexit() will be called when the parent process of the fork exits, which will not happen on Win32 systems.
Returns
error code from process.
Parameters
execname of executable.
argvlist of command arguments.
waitfor process to exit before return.

Get the exit status of another process, waiting for it to exit.

Returns
exit code from process.
Parameters
pidprocess id.

Cancel a running child process.

Returns
0 on success.
Parameters
pidprocess id.
sigcancel signal to apply.

Get system environment.

Returns
system environ symbol.
Parameters
nameof symbol.

Set system environment in a standard manner.

Parameters
nameof environment symbol to set.
valueof environment symbol.
overwritetrue if replace existing symbol.

Get etc prefix path.

Returns
etc prefix.

Get home directory.

Returns
user home directory.

Get user name.

Returns
user login id.

Set user id by name.

Returns
true if successful.

Set the effective group id by name.

Returns
true if successful.

Return the effective operating system page size.

Returns
system page size.

Used to set process priority and optionally enable realtime.

Used to set process scheduling policy.

Portable shortcut for setting realtime...

Return true if scheduler settable.

Return true if realtime scheduling.

Create a lock under a known name.

Parameters
nameof system-wide lock to create.

Create a new lock object that can be used to make locks.

Destroy the current lock and release it.

Lock a system-wide name for this process. If the lock is successful, return true. If an existing lock was already acquired, release it first.

Returns
true if lock successful.
Parameters
namesystem-wide lock to use.

Release an acquired lock.

Flag if the current process has aqcuired a lock.

Returns
true if we have the lock.

Used to properly initialize serial object.

Opens the serial device.

Parameters
fnamePathname of device to open

Closes the serial device.

Reads from serial device.

Parameters
DataPoint to character buffer to receive data. Buffers MUST be at least Length + 1 bytes in size.
LengthNumber of bytes to read.

Writes to serial device.

Parameters
DataPoint to character buffer containing data to write. Buffers MUST
LengthNumber of bytes to write.

This service is used to throw all serial errors which usually occur during the serial constructor.

Parameters
errordefined serial error id.
errstrstring or message to optionally pass.

This service is used to thow application defined serial errors where the application specific error code is a string.

Parameters
errstring or message to pass.

This method is used to turn the error handler on or off for "throwing" execptions by manipulating the thrown flag.

Parameters
enabletrue to enable handler.

Set packet read mode and "size" of packet read buffer. This sets VMIN to x. VTIM is normally set to "0" so that "isPending()" can wait for an entire packet rather than just the first byte.

Returns
actual buffer size set.
Parameters
sizeof packet read request.
btimeroptional inter-byte data packet timeout.

Set "line buffering" read mode and specifies the newline character to be used in seperating line records. isPending can then be used to wait for an entire line of input.

Parameters
newlinenewline character.
nl1EOL2 control character.
Returns
size of conical input buffer.

Restore serial device to the original settings at time of open.

Used to flush the input waiting queue.

Used to flush any pending output data.

Used to wait until all output has been sent.

Used as the default destructor for ending serial I/O services. It will restore the port to it's original state.

Used to initialize a newly opened serial file handle. You should set serial properties and DTR manually before first use.

This allows later ttystream class to open and close a serial device.

A serial object may be constructed from a named file on the file system. This named device must be "isatty()".

Parameters
nameof file.

The serial base class may be "thrown" as a result on an error, and the "catcher" may then choose to destory the object. By assuring the socket base class is a virtual destructor, we can assure the full object is properly terminated.

Serial ports may also be duplecated by the assignment operator.

Set serial port speed for both input and output.

Returns
0 on success.
Parameters
speedto select. 0 signifies modem "hang up".

Set character size.

Returns
0 on success.
Parameters
bitscharacter size to use (usually 7 or 8).

Set parity mode.

Returns
0 on success.
Parameters
paritymode.

Set number of stop bits.

Returns
0 on success.
Parameters
bitsstop bits.

Set flow control.

Returns
0 on success.
Parameters
flowcontrol mode.

Set the DTR mode off momentarily.

Parameters
millisecnumber of milliseconds.

Send the "break" signal.

Often used by a "catch" to fetch the last error of a thrown serial.

Returns
error numbr of last Error.

Often used by a "catch" to fetch the user set error string of a thrown serial.

Returns
string for error message.

Get the "buffer" size for buffered operations. This can be used when setting packet or line read modes to determine how many bytes to wait for in a given read call.

Returns
number of bytes used for buffering.

Get the status of pending operations. This can be used to examine if input or output is waiting, or if an error has occured on the serial device.

Returns
true if ready, false if timeout.
Parameters
pendready check to perform.
timeoutin milliseconds.

Acquire the mutex

Parameters
_mutexreference to mutex to aquire.

Release the mutex automatically

Wait for read access

Parameters
_tlreference to lock to aquire.

Post the semaphore automatically

Wait for write access

Parameters
_tlreference to threadlock to aquire.

Post the semaphore automatically

Wait for the semaphore

Post the semaphore automatically

Create a timer, mark it as inactive, and set the initial "start" time to the creation time of the timer object. This allows "incTimer" to initially refer to time delays relative to the original start time of the object.

Set a new start time for the object based on when this call is made and optionally activate the timer for a specified number of milliseconds. This can be used to set the starting time of a realtime session.

Parameters
timeoutdelay in milliseconds from "now"

Set a timeout based on the current time reference value either from object creation or the last setTimer(). This reference can be used to time synchronize realtime data over specified intervals and force expiration when a new frame should be released in a synchronized manner.

Parameters
timeoutdelay in milliseconds from reference.

Adjust a timeout based on the current time reference value either from object creation or the last setTimer(). This reference can be used to time synchronize realtime data over specified intervals and force expiration when a new frame should be released in a synchronized manner.

Parameters
timeoutdelay in milliseconds from reference.

Sleep until the current timer expires. This is useful in time syncing realtime periodic tasks.

This is used to "disable" the service thread from expiring the timer object. It does not effect the reference time from either creation or a setTimer().

This is used by service threads to determine how much time remains before the timer expires based on a timeout specified in setTimer() or incTimer(). It can also be called after setting a timeout with incTimer() to see if the current timeout has already expired and hence that the application is already delayed and should skip frame(s).

return time remaining in milliseconds, or TIMEOUT_INF if inactive.

This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set. This allows one to use setTimer() to set the timer to the current time and then measure elapsed time from that point forward.

return time elapsed in milliseconds, or TIMEOUT_INF if inactive.

a delimiter string containing all usual whitespace delimiters. These are space, tab, newline, carriage return, formfeed and vertical tab. (see isspace() manpage).

Exception thrown, if someone tried to read beyond the end of the tokens. Will not happen if you use it the 'clean' way with comparison against end(), but if you skip some tokens, because you 'know' they are there. Simplifies error handling a lot, since you can just read your tokens the way you expect it, and if there is some error in the input this Exception will be thrown.

The input forward iterator for tokens.

Author
Henner Zeller

copy constructor.

assignment operator.

shifts this iterator to the next token in the string.

returns the immutable string this iterator points to or '0' if no token is available (i.e. i == end()). Do not store pointers to this token, since it is invalidated for each iteration. If you need the token, copy it (e.g. with strdup());

returns the next delimiter after the current token or '\0', if there are no following delimiters. It returns the very next delimiter (even if skipAllDelim=true).

compares to other iterator. Usually used to compare against the end() iterator.

compares to other iterator. Usually used to compare against the end() iterator.

creates a new StringTokenizer for a string and a given set of delimiters.

Parameters
strString to be split up. This string will not be modified by this StringTokenizer, but you may as well not modfiy this string while tokenizing is in process, which may lead to undefined behaviour.
delimString containing the characters which should be regarded as delimiters.
skipAllDelimOPTIONAL. true, if subsequent delimiters should be skipped at once or false, if empty tokens should be returned for two delimiters with no other text inbetween. The first behaviour may be desirable for whitespace skipping, the second for input with delimited entry e.g. /etc/passwd like files or CSV input. NOTE, that 'true' here resembles the ANSI-C strtok(char *s,char *d) behaviour. DEFAULT = false
trimOPTIONAL. true, if the tokens returned should be trimmed, so that they don't have any whitespaces at the beginning or end. Whitespaces are any of the characters defined in StringTokenizer::SPACE. If delim itself is StringTokenizer::SPACE, this will result in a behaviour with skipAllDelim = true. DEFAULT = false

create a new StringTokenizer which splits the input string at whitespaces. The tokens are stripped from whitespaces. This means, if you change the set of delimiters in either the 'begin(const char *delim)' method or in 'setDelimiters()', you then get whitespace trimmed tokens, delimited by the new set. Behaves like StringTokenizer(s, StringTokenizer::SPACE,false,true);

returns the begin iterator

changes the set of delimiters used in subsequent iterations.

returns a begin iterator with an alternate set of delimiters.

the iterator marking the end.

Create xml parser.

Parameters
sizeof XML data buffer.

Destroy xml parser.

Virtual to receive embedded comments in XML document being parsed.

Parameters
textreceived.
sizeof text received.

Virtual to receive character text extracted from the document.

Parameters
textreceived.
sizeof text received.

Notify start of document event.

Notify end of document event.

Notify start of an element in the document.

Parameters
nameof element found.
attrlist of attributes extracted.

Notify end of an element in the document.

Parameters
nameof element ending.

Parse a chunk of data and return parser completion flag. This is used to externally drive data into the XML parser. The return status can be used to determine when a document has been fully parsed. This can be called multiple times to push stream data into the parser.

Parameters
addressof data to parse.
sizeof data to parse.

Parse a stream buffer and return parser document completion flag. This is used to scan a stream buffer for a complete XML document. The stream is scanned until the document is complete or EOF. Multiple XML document instances can be scanned from a continues XML streaming source.

Parameters
streambuffer to parse.
Returns
true if parse complete, false if invalid or EOF.

Parse a file buffer and return parser document completion flag. This is used to scan a file buffer for a complete XML document. The file is scanned until the document is complete or EOF. Multiple XML document instances can be scanned from a continues XML streaming source.

Parameters
filebuffer to parse.
Returns
true if parse complete, false if invalid or EOF.

End of document check.

Returns
true if end of document.

Definition at line 80 of file address.h.