Portable Tools Library
2.3.1
This document provides reference information for the PTLib C++ class library. It is not intended as a tutorial document.
Last updated 17 May, 2004
Copyright (C) 1999-2003 Equivalence Pty Ltd, All right reserved
Portions Copyright (C) 2004 Post Increment, All Rights Reserved
PTLib is a moderately large C++ class library that originated many years ago as a method to produce applications that run on both Microsoft Windows and Unix X-Windows systems. It also was to have a Macintosh port as well, but this never eventuated. In those days it was called the PWLib the Portable Windows Library.
Since then, the availability of multi-platform GUI toolkits such as KDE and wxWindows, and the development of the OpenH323 and OPAL projects as primary user of the library, has emphasised the focus on networking, I/O portability, multi-threading and protocol portability. Mostly, the library is used to create high performance and highly portable network-centric applications. So all the GUI abstractions ahave been dropped and it was renamed the Portable Tools Library that you see today.
In addition to these high level functions, basic "container" classes such as arrays, linear lists, sorted lists (RB Tree) and dictionaries (hash tables) are available. These were created before the emergence of STL as a standard, so unfortunately these constructs are incompatible with iterators and generic algorithms.
Development continues in this area, and future versions of PTLib will see increased use of, and compatibility with, STL, but it is a long and slow process.
The library is used extensively by many companies for both commercial and Open Source products. The motivation in making PTLib available as Open Source was primarily to support the OpenH323 and OPAL projects, but it is definitely useful as a stand-alone library to anyone that wishes to write portable applications.
The classes within PTLib are seperated into two types: Base Classes and Console Components The Base Classes contain all of the essential support for constructs such as containers, threads and sockets that are dependent on platform specific features. All PTLib programs will require the Base Classes
The Console Components implement functionality that is usually platform independent, and may not be required for all programs. On some platforms (notably Windows) the Base Classes and Console Components may be divided into discrete library archives. Other platforms (notably Unix platforms) combine all of the code into a single library and rely on the linker to omit code that is not required.
Note that previous versions of PTLib also contained GUI classes and GUI components, but support for these classes has been discontinued.
Tutorial introductions for PTLib are available elsewhere (see http://toncar.cz/openh323/tut), but some information on how to create a simple program is always useful.
Here is the canonical "Hello world!" program written using the PTLib infrastructure.
// hello.cxx
#include <ptlib.h>
class Hello : public PProcess
{
PCLASSINFO(Hello, PProcess)
public:
void Main();
};
PCREATE_PROCESS(Hello)
void Hello::Main()
{
cout << "Hello world!\n";
}
// End of hello.cxx
The PCREATE_PROCESS macro actually defines the main()# function and creates an instance of Hello. This assures that everything is initialised in the correct order. C++ does initialisation of global statics badly (and destruction is even worse), so try to put everything into your PProcess descedent rather than globals.
- PObject - the base class for all other classes in the PTLib
- PContainer - the base class for all reference-counted classes in PTLib
- PAbstractArray - base class for array of objects. Equivalent to the STL vector template class
- PAbstractList - base class for lists of objects. Equivalent to the STL list template class
- PAbstractDictionary - base class for dictionaries. Equivalent to the STL map template class
- PString - base class for the string abstraction. Equivalent to the STL string class.
Classes that perform general I/O using the PChannel abstraction
- PChannel - base class for all I/O channels
- PIndirectChannel - a channel that encapsulates another channel
- PConsoleChannel - channel for accessing the system console
- PPipeChannel - execute a program and access input and output as a PChannel
- PSerialChannel - access a serial communications port as a PChannel
- PFile - access files on the host operating system using PChannels
- PTextFile - access text files on the host operating system as PChannels
- PStructuredFile - access files on the host operating system as arrays of structured records
- PFilePath - access directories on the host operating system
- PVideoChannel - read or write data to a video device as a PChannel. See also PVideoDevice and PColourConverter
- PSoundChannel - read or write data to sound device as a PChannel
Implementation of a network sockets abstraction (roughly based on Berkeley sockets)
- PSocket - base class for all network sockets
- PIPSocket - base class for all sockets using the IP protocol
- PUDPSocket - IP socket using the UDP protocol
- PTCPSocket - IP socket using the TCP/IP protocol
- PICMPSocket - IP socket using the ICMP protocl
- PIPXSocket - base class for sockets using the IPX protocol
- PEthSocket - socket interface for raw Ethernet interfaces
Classes that handle processes, multi-threading and synchronsiation.
- PProcess - implements the primary thread of control for a running program
- PServiceProcess - implements a "daemon" or "system process"
- PThread - abstracts a thread of control or execution context
- PSemaphore - synchronisation primitive based on a counter
- PMutex - synchronisation primitive based on mutual exclusion
- PCriticalSection - synchronisation primitive implementing exclusive access to a critical code section
- PSyncPoint - allows multiple threads to sychronise to a specific code point. See also PSyncPointAck
- PAtomicInteger - implements an integer counter with atomic increment and decrement operations
- PArgList - parse a command line passed to a console program
- PConfig - provide persistent storage for program settings using a platform-appropriate mechanism
- PTime - abstracts the notion of a wall-clock time and date
- PTimeInterval - abstracts the notion of a time interval as the difference between two PTime values
- PDynaLink - implements a dynamically loadable code module
- PRemoteConnection - controls for a dialup network connection
- PMail - send an email using a platform-appropriate mechanism
- PPluginManager - manage plugin code modules
- PAbstractFactory - an implementation of the "Abstract Factory" paradigm using templates
- PSmartPointer - a reference counted pointer
- PNotifier - a notifier function that allows any class to call a member function on any other class
- PSmartNotifierFunction - a smart notifier function that uses object IDs rather than pointers
Implementation of the HTTP protocol
- PHTTP - base class for HTTP protocol. See also PHTTPClient and PHTTPServer
- PURL - parse and maniulate uniform resource locations
- PHTML - a string stream that formats HTML information
- PHTTPForm - allows the creation of HTTP forms
- PHTTPServiceProcess - a PServiceProcess descendant that contains a HTTP server
Implementation of various Internet-related protocols. Some of these are implemented within PTLib - some require external libraries for support
- PInternetProtocol - base class for all text-based Internet protocols
- PPOP3 - base class for POP3 protocol classes. See also PPOP3Client and PPOP3Server
- PSMTMP - base class for SMTP protocol classes. See also PSMTPClient and PSMTPServer
- PFTP - base class for FTP protocol classes. See also PFTPClient and FTPServer
- PMIMEInfo - implements a list of key-value pairs in MIME format
- PTelnetSocket - implements the TELNET protocol
- PSocksProtocol - base class for SOCKS protocol implementation. See also PSocks4Socket, PSocks5Socket, PSocksSocket, PSocksUDPSocket
- PSTUNClient - implementation of a STUN client
- PSNMP - base classs for SNMP protocol implementations. See also PSNMPClient and PSNMPServer
- PSSLChannel - PIndirectChannel that implements the SSL protocol via OpenSSL.
- PSASL - implements the SASL protocol via the Cyrus SASL library
- PXMLRPC - implements the XMLRPC protocol via the Expat XML library and the HTTP classes
- PSOAPClient - implements a SOAP client
- PLDAPSession - implements a LDAP client via the OpenLDAP library
- PILSSession - implements a ILS client via the OpenLDAP library
- XMPP::Stream - implements a XMPP (Jabber) stream as a PChannel.
- PModem - a descendant of PSerialChannel that is customised for modems that obey the AT command set
- PIpAccessControlList - a list of entries that allow specification of a range of IP addresses or networks
- PRandom - a random number generator
- PCypher - implementation of various code cyphers such as PMessageDigest5, PTEACypher, and PMessageDigestSHA1
- PWAVFile - implements a AIFF format WAV file
- PDTMFDecoder - decodes DTMF digits from a stream of PCM data
- PMemoryFile - implements a PFile descendant that stores data in memory
- PSDLVideoDevice - implement a vide display device using the SDL library
- PXML - Implements a parser for XML using the Expat library
- PVXMLChannel - Implements a parser for the VXML language
- PTextToSpeech - Implement a Text to Speech converter
- 17 May 2004 - Converted from Doc++ to Doxygen format by Craig Southeren
Generated on Mon Sep 15 08:27:58 2008 for PTLib by
1.5.1