ucommon Namespace Reference

Common namespace for all ucommon objects. More...

Data Structures

class  _character_operators
 At least with gcc, linking of stream operators was broken. More...
class  _stream_operators
 At least with gcc, linking of stream operators was broken. More...
class  array_reuse
 An array of reusable types. More...
class  ArrayReuse
 An array of reusable objects. More...
class  auto_protect
 A mutex locked object smart pointer helper class. More...
class  barrier
 A portable implimentation of "barrier" thread sychronization. More...
class  BufferProtocol
 Common buffer protocol class. More...
class  CharacterProtocol
 Common character processing protocol. More...
class  charbuf
 A template to create a character array that can be manipulated as a string. More...
class  cidr
 A class to hold internet segment routing rules. More...
class  Cipher
 A generic data ciphering class. More...
class  Conditional
 The conditional is a common base for other thread synchronizing classes. More...
class  ConditionalAccess
 The conditional rw seperates scheduling for optizming behavior or rw locks. More...
class  ConditionalLock
 An optimized and convertable shared lock. More...
class  DetachedThread
 A detached thread object that is stand-alone. More...
class  Digest
 A cryptographic digest class. More...
class  filestream
 Streamable tcp connection between client and server. More...
class  HMAC
 A cryptographic message authentication code class. More...
class  InputProtocol
 Used for processing input. More...
class  JoinableThread
 A child thread object that may be joined by parent. More...
class  keyrandom
 A template to create a random generated key of specified size. More...
class  keystring
 A template to create a string array that automatically erases. More...
class  linked_pointer< sockaddr_struct >
 Linked pointer for address lists. More...
class  ListenSocket
 A bound socket used to listen for inbound socket connections. More...
class  locked_instance
 A templated smart pointer instance for lock protected objects. More...
class  locked_pointer
 Templated locked pointer for referencing locked objects of specific type. More...
class  locked_release
 Auto-pointer support class for locked objects. More...
class  LockedPointer
 An object pointer that uses mutex to assure thread-safe singleton use. More...
class  LockingProtocol
 Common locking protocol. More...
class  MemoryRedirect
 A redirection base class for the memory protocol. More...
class  memstring
 A string class that uses a cstring buffer that is fixed in memory. More...
class  MemVector
 Vector with fixed size member list. More...
class  Mutex
 Generic non-recursive exclusive lock class. More...
class  mutex_pointer
 Typed smart locked pointer class. More...
class  ObjectProtocol
 A common base class for all managed objects. More...
class  paged_reuse
 A reusable private pool of reusable types. More...
class  PagerReuse
 A mempager source of reusable objects. More...
class  pipestream
 Streamable tcp connection between client and server. More...
class  PrintProtocol
 Used for forming stream output. More...
class  Random
 Cryptographically relevant random numbers. More...
class  RecursiveMutex
 Portable recursive exclusive lock. More...
class  ReusableAllocator
 Class for resource bound memory pools between threads. More...
class  secure
 Common secure socket support. More...
class  Semaphore
 A portable counting semaphore class. More...
class  shared_instance
 A templated smart pointer instance for shared singleton typed objects. More...
class  shared_pointer
 Templated shared pointer for singleton shared objects of specific type. More...
class  shared_release
 Auto-pointer support class for shared singleton objects. More...
class  SharedObject
 Shared singleton object. More...
class  SharedPointer
 The shared pointer is used to manage a singleton instance of shared object. More...
class  shell
 A utility class for generic shell operations. More...
class  Socket
 A generic socket base class. More...
class  SSLBuffer
 Secure socket buffer. More...
class  sstream
 Secure socket using std::iostream. More...
class  StreamBuffer
 Common stream buffer for std C++ i/o classes. More...
class  String
 A copy-on-write string class that operates by reference count. More...
class  stringbuf
 A string class that has a predefined string buffer. More...
class  TCPServer
 A generic tcp server class. More...
class  tcpstream
 Streamable tcp connection between client and server. More...
class  Thread
 An abstract class for defining classes that operate as a thread. More...
class  ThreadLock
 A generic and portable implimentation of Read/Write locking. More...
class  TimedEvent
 Event notification to manage scheduled realtime threads. More...
class  Timer
 Timer class to use when scheduling realtime events. More...
class  TimerQueue
 A timer queue for timer events. More...
class  UString
 A copy-on-write utf8 string class that operates by reference count. More...
class  utf8
 A core class of ut8 encoded string functions. More...
class  utf8_pointer
 Pointer to utf8 encoded character data. More...
class  Vector
 A managed vector for generic object pointers. More...
class  vectorbuf
 Allocated vector list of a specified type. More...
class  vectorof
 A templated vector for a list of a specific Object subtype. More...
class  XMLParser
 XML streaming parser. More...

Typedefs

typedef ConditionalAccess accesslock_t
 Convenience type for scheduling access.
typedef barrier barrier_t
 Convenience type for using thread barriers.
typedef Cipher cipher_t
 Convenience type for generic ciphers.
typedef ConditionalLock condlock_t
 Convenience type for using conditional locks.
typedef Digest digest_t
 Convenience type for generic digests.
typedef HMAC hmac_t
 Convenience type for generic digests.
typedef Mutex mutex_t
 Convenience type for using exclusive mutex locks.
typedef RecursiveMutex rexlock_t
 Convenience type for using recursive exclusive locks.
typedef ThreadLock rwlock_t
 Convenience type for using read/write locks.
typedef Semaphore semaphore_t
 Convenience type for using counting semaphores.
typedef shell shell_t
 Convenience type to manage and pass shell objects.
typedef Cipher::Key skey_t
 Convenience type for generic cipher key.
typedef SSLBuffer ssl_t
 Convenience type for secure socket.
typedef String string_t
 A convenience type for string.
typedef String::regex stringex_t
typedef unsigned short strsize_t
 A convenience class for size of strings.
typedef TCPServer tcpserv_t
typedef TimedEvent timedevent_t
 Convenience type for using timed events.
typedef Timer timer_t
 A convenience type for timers.
typedef TimerQueue::event TQEvent
 A convenience type for timer queue timer events.
typedef int16_t ucs2_t
 16 bit unicode character code.
typedef int32_t ucs4_t
 32 bit unicode character code.
typedef void * unicode_t
 Resolves issues where wchar_t is not defined.
typedef UString ustring_t
 Convenience type for utf8 encoded strings.
typedef utf8_pointer utf8_t
 Convenience type for utf8_pointer strings.

Functions

struct sockaddr * _getaddrinfo (struct addrinfo *addrinfo)
 Helper function for linked_pointer<struct sockaddr>.
socket_t _getaddrsock (struct addrinfo *addrinfo)
 Helper function for linked_pointer<struct sockaddr>.
struct addrinfo * _nextaddrinfo (struct addrinfo *addrinfo)
 Helper function for linked_pointer<struct sockaddr>.
bool _rw_reader_ (const void *obj)
bool _rw_release_ (const void *obj)
bool _rw_writer_ (const void *obj)
bool _sync_protect_ (const void *obj)
bool _sync_release_ (const void *obj)
const char * _TEXT (const char *s)
 Invoke translation lookup if available.
void access (condlock_t &lock)
 Convenience function for shared access to a conditional lock.
void access (accesslock_t &lock)
 Convenience function to shared read schedule conditional access.
void acquire (mutex_t &mutex)
 Convenience function to acquire a mutex.
struct sockaddr * addr (Socket::address &address)
 A convenience function to convert a socket address list into a socket address.
struct addrinfo * addrinfo (Socket::address &address)
 A convenience function to convert a socket address list into an addrinfo.
void commit (condlock_t &lock)
 Convenience function to commit and release an exclusively locked conditional lock.
void commit (accesslock_t &lock)
 Convenience function to commit an exclusive access lock.
template<>
void dupfree< ucs2_t * > (ucs2_t *string)
template<>
void dupfree< ucs4_t * > (ucs4_t *string)
template<>
void dupfree< unicode_t > (unicode_t string)
bool eq (String &s1, const char *s2)
 Compare two string objects if equal.
bool eq (char const *s1, char const *s2, size_t size)
 Compare two null terminated strings if equal up to specified size.
bool eq (char const *s1, char const *s2)
 Compare two null terminated strings if equal.
bool eq (const struct sockaddr_storage *s1, const struct sockaddr_storage *s2)
 Compare two stored socket addresses to see if equal.
bool eq (const struct sockaddr *s1, const struct sockaddr *s2)
 Compare two socket addresses to see if equal.
bool eq_case (char const *s1, char const *s2, size_t size)
 Compare two null terminated strings if equal for a specified size ignoring case.
bool eq_case (char const *s1, char const *s2)
 Compare two null terminated strings if equal ignoring case.
bool eq_host (const struct sockaddr *s1, const struct sockaddr *s2)
 Compare two host addresses to see if equal.
bool eq_subnet (const struct sockaddr *s1, const struct sockaddr *s2)
bool exclusive (rwlock_t &lock, timeout_t timeout=Timer::inf)
 Convenience function for exclusive write access to a read/write lock.
void exclusive (condlock_t &lock)
 Convenience function to exclusively lock shared conditional lock.
bool ge (String &s1, const char *s2)
bool gt (String &s1, const char *s2)
bool le (String &s1, const char *s2)
void lock (rexlock_t &lock)
 Convenience function to lock a shared recursive mutex lock.
bool lt (String &s1, const char *s2)
void modify (condlock_t &lock)
 Convenience function to exclusively aquire a conditional lock.
void modify (accesslock_t &lock)
 Convenience function to exclusively schedule conditional access.
bool ne (String &s1, String &s2)
bool ne (char const *s1, char const *s2, size_t size)
bool ne (char const *s1, char const *s2)
bool ne_case (char const *s1, char const *s2)
std::ostream & operator<< (std::ostream &out, const stringlist_t &list)
std::ostream & operator<< (std::ostream &out, const string_t &str)
std::ostream & operator<< (std::ostream &out, const PrintProtocol &format)
CharacterProtocoloperator<< (CharacterProtocol &p, const double &value)
CharacterProtocoloperator<< (CharacterProtocol &p, const long &value)
CharacterProtocoloperator<< (CharacterProtocol &p, const StringPager &list)
CharacterProtocoloperator<< (CharacterProtocol &p, const PrintProtocol &format)
CharacterProtocoloperator<< (CharacterProtocol &p, const char &ch)
CharacterProtocoloperator<< (CharacterProtocol &p, const char *s)
std::istream & operator>> (std::istream &in, stringlist_t &list)
std::istream & operator>> (std::istream &inp, string_t &str)
std::istream & operator>> (std::istream &inp, InputProtocol &format)
CharacterProtocoloperator>> (CharacterProtocol &p, double &value)
CharacterProtocoloperator>> (CharacterProtocol &p, long &value)
CharacterProtocoloperator>> (CharacterProtocol &p, StringPager &list)
CharacterProtocoloperator>> (CharacterProtocol &p, InputProtocol &format)
CharacterProtocoloperator>> (CharacterProtocol &p, String &str)
CharacterProtocoloperator>> (CharacterProtocol &p, char &ch)
void release (rexlock_t &lock)
 Convenience function to release a shared recursive mutex lock.
void release (rwlock_t &lock)
 Convenience function to release a shared lock.
void release (condlock_t &lock)
 Convenience function to release shared access to a conditional lock.
void release (accesslock_t &lock)
 Convenience function to release an access lock.
void release (mutex_t &mutex)
 Convenience function to release a mutex.
void release (semaphore_t &semaphore)
 Convenience function to release a semaphore.
bool share (rwlock_t &lock, timeout_t timeout=Timer::inf)
 Convenience function for shared read access to a read/write lock.
void share (condlock_t &lock)
 Convenience function to restore shared access on a conditional lock.
void start (DetachedThread *thread, int priority=0)
 Convenience function to start a detached thread.
void start (JoinableThread *thread, int priority=0)
 Convenience function to start a joinable thread.
String str (CharacterProtocol &cp, strsize_t size)
String str (double value)
String str (unsigned long value)
String str (long value)
String str (unsigned short value)
String str (short value)
String str (String &string)
String str (const char *string)
String str (Socket &so, strsize_t size)
int stricmp (const char *string1, const char *string2)
 Convenience function for case insensitive null terminated string compare.
int strnicmp (const char *string1, const char *string2, size_t max)
 Convenience function for case insensitive null terminated string compare.
ucs4_tstrudup (const char *string)
ucs2_tstrwdup (const char *string)
template<>
void swap< string_t > (string_t &s1, string_t &s2)
unicode_t unidup (const char *string)
void wait (semaphore_t &semaphore, timeout_t timeout=Timer::inf)
 Convenience function to wait on a semaphore.
void wait (barrier_t &barrier)
 Convenience function to wait on a barrier.
void zerofill (void *addr, size_t size)

Detailed Description

Common namespace for all ucommon objects.

We are using a common namespace to easily separate ucommon from other libraries. This namespace usage is set to the package name and controlled by macros so future changes will be hidden from user applications so long as the namespace macros (UCOMMON_NAMESPACE, NAMESPACE_UCOMMON, END_NAMESPACE) are used in place of direct namespace declarations.


Typedef Documentation

typedef int16_t ucommon::ucs2_t

16 bit unicode character code.

Java and some api's like these.

Definition at line 50 of file unicode.h.

typedef int32_t ucommon::ucs4_t

32 bit unicode character code.

We may extract this from a ucs2 or utf8 string.

Definition at line 45 of file unicode.h.


Function Documentation

const char* ucommon::_TEXT ( const char *  s  )  [inline]

Invoke translation lookup if available.

This can also be used to mark text constants that need to be translated. It should not be used with pointer variables, which should instead call shell::text directly. The primary purpose is to allow extraction of text to be internationalized with xgettext "--keyword=_TEXT:1".

Definition at line 864 of file shell.h.

void ucommon::access ( condlock_t &  lock  )  [inline]

Convenience function for shared access to a conditional lock.

Parameters:
lock to access.

Definition at line 1971 of file thread.h.

Here is the call graph for this function:

void ucommon::access ( accesslock_t &  lock  )  [inline]

Convenience function to shared read schedule conditional access.

Parameters:
lock to access shared.

Definition at line 1920 of file thread.h.

Here is the call graph for this function:

void ucommon::acquire ( mutex_t &  mutex  )  [inline]

Convenience function to acquire a mutex.

Parameters:
mutex to acquire.

Definition at line 1899 of file thread.h.

Here is the call graph for this function:

struct sockaddr* ucommon::addr ( Socket::address &  address  )  [read]

A convenience function to convert a socket address list into a socket address.

Parameters:
address list object.
Returns:
first socket address in list or NULL if empty.

Definition at line 1796 of file socket.h.

Here is the call graph for this function:

struct addrinfo* ucommon::addrinfo ( Socket::address &  address  )  [read]

A convenience function to convert a socket address list into an addrinfo.

Parameters:
address list object.
Returns:
addrinfo list or NULL if empty.

Definition at line 1787 of file socket.h.

Here is the call graph for this function:

void ucommon::commit ( condlock_t &  lock  )  [inline]

Convenience function to commit and release an exclusively locked conditional lock.

Parameters:
lock to commit.

Definition at line 1964 of file thread.h.

Here is the call graph for this function:

void ucommon::commit ( accesslock_t &  lock  )  [inline]

Convenience function to commit an exclusive access lock.

lock.

Parameters:
lock to commit.

Definition at line 1935 of file thread.h.

Here is the call graph for this function:

bool ucommon::eq ( String &  s1,
const char *  s2 
) [inline]

Compare two string objects if equal.

The left string is an object, the right may be an object or converted to a const string. The compare virtual method of the left object is used, so we can do things like collation order or derived class specific sorting.

Parameters:
s1 string to compare.
s2 string to compare.
Returns:
true if equal.

Definition at line 1679 of file string.h.

Here is the call graph for this function:

bool ucommon::eq ( char const *  s1,
char const *  s2,
size_t  size 
) [inline]

Compare two null terminated strings if equal up to specified size.

Parameters:
s1 string to compare.
s2 string to compare.
size of string to compare.
Returns:
true if equal.

Definition at line 1664 of file string.h.

bool ucommon::eq ( char const *  s1,
char const *  s2 
) [inline]

Compare two null terminated strings if equal.

Parameters:
s1 string to compare.
s2 string to compare.
Returns:
true if equal.

Definition at line 1651 of file string.h.

bool ucommon::eq ( const struct sockaddr_storage *  s1,
const struct sockaddr_storage *  s2 
) [inline]

Compare two stored socket addresses to see if equal.

If the port is zero then this is the same as comparing host address alone.

Parameters:
s1 stored socket address to compare.
s2 stored socket address to compare.
Returns:
true if addresses same.

Definition at line 1816 of file socket.h.

bool ucommon::eq ( const struct sockaddr *  s1,
const struct sockaddr *  s2 
) [inline]

Compare two socket addresses to see if equal.

If the port is zero then this is the same as comparing host address alone.

Parameters:
s1 socket address to compare.
s2 socket address to compare.
Returns:
true if addresses same.
Examples:
cipher.cpp, datetime.cpp, digest.cpp, shell.cpp, and string.cpp.

Definition at line 1806 of file socket.h.

bool ucommon::eq_case ( char const *  s1,
char const *  s2,
size_t  size 
) [inline]

Compare two null terminated strings if equal for a specified size ignoring case.

This is related to stricmp or gcc strcasecmp.

Parameters:
s1 string to compare.
s2 string to compare.
size of string to compare.
Returns:
true if equal.

Definition at line 1718 of file string.h.

Here is the call graph for this function:

bool ucommon::eq_case ( char const *  s1,
char const *  s2 
) [inline]

Compare two null terminated strings if equal ignoring case.

This is related to stricmp or gcc strcasecmp.

Parameters:
s1 string to compare.
s2 string to compare.
Returns:
true if equal.
Examples:
keydata.cpp, and string.cpp.

Definition at line 1704 of file string.h.

bool ucommon::eq_host ( const struct sockaddr *  s1,
const struct sockaddr *  s2 
) [inline]

Compare two host addresses to see if equal.

The port numbers are ignored.

Parameters:
s1 socket address to compare.
s2 socket address to compare.
Returns:
true if addresses same.

Definition at line 1826 of file socket.h.

bool ucommon::exclusive ( rwlock_t &  lock,
timeout_t  timeout = Timer::inf 
) [inline]

Convenience function for exclusive write access to a read/write lock.

Parameters:
lock to write lock.
timeout to wait for exclusive locking.

Definition at line 1986 of file thread.h.

Here is the call graph for this function:

void ucommon::exclusive ( condlock_t &  lock  )  [inline]

Convenience function to exclusively lock shared conditional lock.

Parameters:
lock to make exclusive.

Definition at line 1942 of file thread.h.

Here is the call graph for this function:

void ucommon::lock ( rexlock_t &  lock  )  [inline]

Convenience function to lock a shared recursive mutex lock.

Parameters:
lock to acquire.

Definition at line 2008 of file thread.h.

Here is the call graph for this function:

void ucommon::modify ( condlock_t &  lock  )  [inline]

Convenience function to exclusively aquire a conditional lock.

Parameters:
lock to acquire for modify.

Definition at line 1956 of file thread.h.

Here is the call graph for this function:

void ucommon::modify ( accesslock_t &  lock  )  [inline]

Convenience function to exclusively schedule conditional access.

Parameters:
lock to make exclusive.

Definition at line 1913 of file thread.h.

Here is the call graph for this function:

void ucommon::release ( rexlock_t &  lock  )  [inline]

Convenience function to release a shared recursive mutex lock.

Parameters:
lock to release.

Definition at line 2015 of file thread.h.

Here is the call graph for this function:

void ucommon::release ( rwlock_t &  lock  )  [inline]

Convenience function to release a shared lock.

Parameters:
lock to release.

Definition at line 2001 of file thread.h.

Here is the call graph for this function:

void ucommon::release ( condlock_t &  lock  )  [inline]

Convenience function to release shared access to a conditional lock.

Parameters:
lock to release.

Definition at line 1978 of file thread.h.

Here is the call graph for this function:

void ucommon::release ( accesslock_t &  lock  )  [inline]

Convenience function to release an access lock.

Parameters:
lock to release.

Definition at line 1927 of file thread.h.

Here is the call graph for this function:

void ucommon::release ( mutex_t &  mutex  )  [inline]

Convenience function to release a mutex.

Parameters:
mutex to release.

Definition at line 1906 of file thread.h.

Here is the call graph for this function:

void ucommon::release ( semaphore_t &  semaphore  )  [inline]

Convenience function to release a semaphore.

Parameters:
semaphore to release.

Definition at line 1892 of file thread.h.

Here is the call graph for this function:

bool ucommon::share ( rwlock_t &  lock,
timeout_t  timeout = Timer::inf 
) [inline]

Convenience function for shared read access to a read/write lock.

Parameters:
lock to share read lock.
timeout to wait for shared access.

Definition at line 1994 of file thread.h.

Here is the call graph for this function:

void ucommon::share ( condlock_t &  lock  )  [inline]

Convenience function to restore shared access on a conditional lock.

Parameters:
lock to make shared.

Definition at line 1949 of file thread.h.

Here is the call graph for this function:

void ucommon::start ( DetachedThread *  thread,
int  priority = 0 
) [inline]

Convenience function to start a detached thread.

Parameters:
thread to start.
priority of thread.

Definition at line 1830 of file thread.h.

Here is the call graph for this function:

void ucommon::start ( JoinableThread *  thread,
int  priority = 0 
) [inline]

Convenience function to start a joinable thread.

Parameters:
thread to start.
priority of thread.
Examples:
thread.cpp.

Definition at line 1822 of file thread.h.

Here is the call graph for this function:

int ucommon::stricmp ( const char *  string1,
const char *  string2 
) [inline]

Convenience function for case insensitive null terminated string compare.

Parameters:
string1 to compare.
string2 to compare.
Returns:
0 if equal, > 0 if s2 > s1, < 0 if s2 < s1.

Definition at line 1630 of file string.h.

int ucommon::strnicmp ( const char *  string1,
const char *  string2,
size_t  max 
) [inline]

Convenience function for case insensitive null terminated string compare.

Parameters:
string1 to compare.
string2 to compare.
max size of string to compare.
Returns:
0 if equal, > 0 if s2 > s1, < 0 if s2 < s1.

Definition at line 1640 of file string.h.

void ucommon::wait ( semaphore_t &  semaphore,
timeout_t  timeout = Timer::inf 
) [inline]

Convenience function to wait on a semaphore.

Parameters:
semaphore to wait on.
timeout to wait for.

Definition at line 1885 of file thread.h.

Here is the call graph for this function:

void ucommon::wait ( barrier_t &  barrier  )  [inline]

Convenience function to wait on a barrier.

Parameters:
barrier to wait.

Definition at line 1877 of file thread.h.

Here is the call graph for this function:


Generated on 24 Sep 2014 for ucommon by  doxygen 1.6.1