#include <CArch.h>
Inherits IArchConsole, IArchDaemon, IArchFile, IArchLog, IArchMultithread, IArchNetwork, IArchSleep, IArchString, IArchSystem, IArchTaskBar, and IArchTime.
Inheritance diagram for CArch:
Public Member Functions | |
CArch (void *args=NULL) | |
virtual void | openConsole (const char *) |
Open the console. | |
virtual void | closeConsole () |
Close the console. | |
virtual void | showConsole (bool showIfEmpty) |
Show the console. | |
virtual void | writeConsole (const char *) |
Write to the console. | |
virtual const char * | getNewlineForConsole () |
Returns the newline sequence for the console. | |
virtual void | installDaemon (const char *name, const char *description, const char *pathname, const char *commandLine, const char *dependencies, bool allUsers) |
Install daemon. | |
virtual void | uninstallDaemon (const char *name, bool allUsers) |
Uninstall daemon. | |
virtual int | daemonize (const char *name, DaemonFunc func) |
Daemonize the process. | |
virtual bool | canInstallDaemon (const char *name, bool allUsers) |
Check if user has permission to install the daemon. | |
virtual bool | isDaemonInstalled (const char *name, bool allUsers) |
Check if the daemon is installed. | |
virtual const char * | getBasename (const char *pathname) |
Extract base name. | |
virtual std::string | getUserDirectory () |
Get user's home directory. | |
virtual std::string | getSystemDirectory () |
Get system directory. | |
virtual std::string | concatPath (const std::string &prefix, const std::string &suffix) |
Concatenate path components. | |
virtual void | openLog (const char *) |
Open the log. | |
virtual void | closeLog () |
Close the log. | |
virtual void | showLog (bool showIfEmpty) |
Show the log. | |
virtual void | writeLog (ELevel, const char *) |
Write to the log. | |
virtual CArchCond | newCondVar () |
Create a condition variable. | |
virtual void | closeCondVar (CArchCond) |
Destroy a condition variable. | |
virtual void | signalCondVar (CArchCond) |
Signal a condition variable. | |
virtual void | broadcastCondVar (CArchCond) |
Broadcast a condition variable. | |
virtual bool | waitCondVar (CArchCond, CArchMutex, double timeout) |
Wait on a condition variable. | |
virtual CArchMutex | newMutex () |
Create a recursive mutex. | |
virtual void | closeMutex (CArchMutex) |
Destroy a mutex. | |
virtual void | lockMutex (CArchMutex) |
Lock a mutex. | |
virtual void | unlockMutex (CArchMutex) |
Unlock a mutex. | |
virtual CArchThread | newThread (ThreadFunc, void *) |
Start a new thread. | |
virtual CArchThread | newCurrentThread () |
Get a reference to the calling thread. | |
virtual CArchThread | copyThread (CArchThread) |
Copy a thread object. | |
virtual void | closeThread (CArchThread) |
Release a thread reference. | |
virtual void | cancelThread (CArchThread) |
Force a thread to exit. | |
virtual void | setPriorityOfThread (CArchThread, int n) |
Change thread priority. | |
virtual void | testCancelThread () |
Cancellation point. | |
virtual bool | wait (CArchThread, double timeout) |
Wait for a thread to exit. | |
virtual bool | isSameThread (CArchThread, CArchThread) |
Compare threads. | |
virtual bool | isExitedThread (CArchThread) |
Test if thread exited. | |
virtual void * | getResultOfThread (CArchThread) |
Returns the exit code of a thread. | |
virtual ThreadID | getIDOfThread (CArchThread) |
Returns an ID for a thread. | |
virtual void | setSignalHandler (ESignal, SignalFunc, void *) |
Set the interrupt handler. | |
virtual void | raiseSignal (ESignal) |
Invoke the signal handler. | |
virtual CArchSocket | newSocket (EAddressFamily, ESocketType) |
Create a new socket. | |
virtual CArchSocket | copySocket (CArchSocket s) |
Copy a socket object. | |
virtual void | closeSocket (CArchSocket s) |
Release a socket reference. | |
virtual void | closeSocketForRead (CArchSocket s) |
Close socket for further reads. | |
virtual void | closeSocketForWrite (CArchSocket s) |
Close socket for further writes. | |
virtual void | bindSocket (CArchSocket s, CArchNetAddress addr) |
Bind socket to address. | |
virtual void | listenOnSocket (CArchSocket s) |
Listen for connections on socket. | |
virtual CArchSocket | acceptSocket (CArchSocket s, CArchNetAddress *addr) |
Accept connection on socket. | |
virtual bool | connectSocket (CArchSocket s, CArchNetAddress name) |
Connect socket. | |
virtual int | pollSocket (CPollEntry[], int num, double timeout) |
Check socket state. | |
virtual void | unblockPollSocket (CArchThread thread) |
Unblock thread in pollSocket(). | |
virtual size_t | readSocket (CArchSocket s, void *buf, size_t len) |
Read data from socket. | |
virtual size_t | writeSocket (CArchSocket s, const void *buf, size_t len) |
Write data from socket. | |
virtual void | throwErrorOnSocket (CArchSocket) |
Check error on socket. | |
virtual bool | setNoDelayOnSocket (CArchSocket, bool noDelay) |
Turn Nagle algorithm on or off on socket. | |
virtual bool | setReuseAddrOnSocket (CArchSocket, bool reuse) |
Turn address reuse on or off on socket. | |
virtual std::string | getHostName () |
Return local host's name. | |
virtual CArchNetAddress | newAnyAddr (EAddressFamily) |
Create an "any" network address. | |
virtual CArchNetAddress | copyAddr (CArchNetAddress) |
Copy a network address. | |
virtual CArchNetAddress | nameToAddr (const std::string &) |
Convert a name to a network address. | |
virtual void | closeAddr (CArchNetAddress) |
Destroy a network address. | |
virtual std::string | addrToName (CArchNetAddress) |
Convert an address to a host name. | |
virtual std::string | addrToString (CArchNetAddress) |
Convert an address to a string. | |
virtual EAddressFamily | getAddrFamily (CArchNetAddress) |
Get an address's family. | |
virtual void | setAddrPort (CArchNetAddress, int port) |
Set the port of an address. | |
virtual int | getAddrPort (CArchNetAddress) |
Get the port of an address. | |
virtual bool | isAnyAddr (CArchNetAddress) |
Test for the "any" address. | |
virtual bool | isEqualAddr (CArchNetAddress, CArchNetAddress) |
Test addresses for equality. | |
virtual void | sleep (double timeout) |
Sleep. | |
virtual int | vsnprintf (char *str, int size, const char *fmt, va_list ap) |
printf() to limited size buffer with va_list | |
virtual int | convStringMBToWC (wchar_t *, const char *, UInt32 n, bool *errors) |
Convert multibyte string to wide character string. | |
virtual int | convStringWCToMB (char *, const wchar_t *, UInt32 n, bool *errors) |
Convert wide character string to multibyte string. | |
virtual EWideCharEncoding | getWideCharEncoding () |
Return the architecture's native wide character encoding. | |
virtual std::string | getOSName () const |
Identify the OS. | |
virtual std::string | getPlatformName () const |
Identify the platform. | |
virtual void | addReceiver (IArchTaskBarReceiver *) |
Add a receiver. | |
virtual void | removeReceiver (IArchTaskBarReceiver *) |
Remove a receiver. | |
virtual void | updateReceiver (IArchTaskBarReceiver *) |
Update a receiver. | |
virtual double | time () |
Get the current time. | |
Static Public Member Functions | |
CArch * | getInstance () |
Return the singleton instance. |
This class is a centralized interface to all architecture dependent interface implementations (except miscellaneous functions). It instantiates an implementation of each interface and delegates calls to each method to those implementations. Clients should use the ARCH
macro to access this object. Clients must also instantiate exactly one of these objects before attempting to call any method, typically at the beginning of main()
.
Definition at line 48 of file CArch.h.
|
Accept connection on socket.
Accepts a connection on socket Implements IArchNetwork. Definition at line 456 of file CArch.cpp. References IArchNetwork::acceptSocket(). |
|
Add a receiver. Add a receiver object to be notified of user and application events. This should be called before other methods. When the receiver is added to the task bar, its icon appears on the task bar. Implements IArchTaskBar. Definition at line 624 of file CArch.cpp. References IArchTaskBar::addReceiver(). |
|
Bind socket to address.
Binds socket Implements IArchNetwork. Definition at line 444 of file CArch.cpp. References IArchNetwork::bindSocket(). |
|
Broadcast a condition variable. Broadcasting a condition variable releases all waiting threads. Implements IArchMultithread. Definition at line 294 of file CArch.cpp. References IArchMultithread::broadcastCondVar(). |
|
Force a thread to exit.
Causes Implements IArchMultithread. Definition at line 354 of file CArch.cpp. References IArchMultithread::cancelThread(). |
|
Check if user has permission to install the daemon. Returns true iff the caller has permission to install or uninstall the daemon. Note that even if this method returns true it's possible that installing/uninstalling the service may still fail. This method ignores whether or not the service is already installed. Implements IArchDaemon. Definition at line 216 of file CArch.cpp. References IArchDaemon::canInstallDaemon(). |
|
Close the console. Close the console. Calling this method on an already closed console must have no effect. Implements IArchConsole. Definition at line 168 of file CArch.cpp. References IArchConsole::closeConsole(). |
|
Close the log. Close the log. Implements IArchLog. Definition at line 258 of file CArch.cpp. References IArchLog::closeLog(). |
|
Release a socket reference. Deletes the given socket object. This does not destroy the socket the object referred to until there are no remaining references for the socket. Implements IArchNetwork. Definition at line 426 of file CArch.cpp. References IArchNetwork::closeSocket(). |
|
Close socket for further reads.
Calling this disallows future reads on socket Implements IArchNetwork. Definition at line 432 of file CArch.cpp. References IArchNetwork::closeSocketForRead(). |
|
Close socket for further writes.
Calling this disallows future writes on socket Implements IArchNetwork. Definition at line 438 of file CArch.cpp. References IArchNetwork::closeSocketForWrite(). |
|
Release a thread reference. Deletes the given thread object. This does not destroy the thread the object referred to, even if there are no remaining references. Use cancelThread() and waitThread() to stop a thread and wait for it to exit. Implements IArchMultithread. Definition at line 348 of file CArch.cpp. References IArchMultithread::closeThread(). |
|
Concatenate path components. Concatenate pathname components with a directory separator between them. This should not check if the resulting path is longer than allowed by the system; we'll rely on the system calls to tell us that. Implements IArchFile. Definition at line 246 of file CArch.cpp. References IArchFile::concatPath(). |
|
Connect socket.
Connects the socket Implements IArchNetwork. Definition at line 462 of file CArch.cpp. References IArchNetwork::connectSocket(). |
|
Copy a socket object.
Returns a reference to to socket referred to by Implements IArchNetwork. Definition at line 420 of file CArch.cpp. References IArchNetwork::copySocket(). |
|
Copy a thread object.
Returns a reference to to thread referred to by Implements IArchMultithread. Definition at line 342 of file CArch.cpp. References IArchMultithread::copyThread(). |
|
Daemonize the process.
Daemonize. Throw XArchDaemonFailed on error. Exactly what happens when daemonizing depends on the platform.
Implements IArchDaemon. Definition at line 210 of file CArch.cpp. References IArchDaemon::daemonize(). |
|
Extract base name.
Find the base name in the given Implements IArchFile. Definition at line 228 of file CArch.cpp. References IArchFile::getBasename(). |
|
Returns an ID for a thread.
Returns some ID number for Implements IArchMultithread. Definition at line 396 of file CArch.cpp. References IArchMultithread::getIDOfThread(). |
|
Return the singleton instance. The client must have instantiated exactly once CArch object before calling this function. |
|
Returns the newline sequence for the console. Different consoles use different character sequences for newlines. This method returns the appropriate newline sequence for the console. Implements IArchConsole. Definition at line 186 of file CArch.cpp. References IArchConsole::getNewlineForConsole(). |
|
Identify the OS. Returns a string identifying the operating system. Implements IArchSystem. Definition at line 612 of file CArch.cpp. References IArchSystem::getOSName(). |
|
Identify the platform. Returns a string identifying the platform this OS is running on. Implements IArchSystem. Definition at line 618 of file CArch.cpp. References IArchSystem::getPlatformName(). |
|
Returns the exit code of a thread.
Waits indefinitely for (Cancellation point) Implements IArchMultithread. Definition at line 390 of file CArch.cpp. References IArchMultithread::getResultOfThread(). |
|
Get system directory. Returns the ussystem configuration file directory. Implements IArchFile. Definition at line 240 of file CArch.cpp. References IArchFile::getSystemDirectory(). |
|
Get user's home directory. Returns the user's home directory. Returns the empty string if this cannot be determined. Implements IArchFile. Definition at line 234 of file CArch.cpp. References IArchFile::getUserDirectory(). |
|
Install daemon.
Install a daemon. Implements IArchDaemon. Definition at line 192 of file CArch.cpp. References IArchDaemon::installDaemon(). |
|
Test for the "any" address.
Returns true if Implements IArchNetwork. Definition at line 570 of file CArch.cpp. References IArchNetwork::isAnyAddr(). |
|
Check if the daemon is installed. Returns true iff the daemon is installed. Implements IArchDaemon. Definition at line 222 of file CArch.cpp. References IArchDaemon::isDaemonInstalled(). |
|
Test if thread exited.
Returns true iff Implements IArchMultithread. Definition at line 384 of file CArch.cpp. References IArchMultithread::isExitedThread(). |
|
Compare threads. Returns true iff two thread objects refer to the same thread. Note that comparing thread objects directly is meaningless. Implements IArchMultithread. Definition at line 378 of file CArch.cpp. References IArchMultithread::isSameThread(). |
|
Listen for connections on socket.
Causes the socket Implements IArchNetwork. Definition at line 450 of file CArch.cpp. References IArchNetwork::listenOnSocket(). |
|
Create a condition variable. The condition variable is an opaque data type. Implements IArchMultithread. Definition at line 276 of file CArch.cpp. References IArchMultithread::newCondVar(). |
|
Get a reference to the calling thread. Returns a thread representing the current (i.e. calling) thread. Implements IArchMultithread. Definition at line 336 of file CArch.cpp. References IArchMultithread::newCurrentThread(). |
|
Create a recursive mutex. Creates a recursive mutex. A thread may lock a recursive mutex when it already holds a lock on that mutex. The mutex is an opaque data type. Implements IArchMultithread. Definition at line 306 of file CArch.cpp. References IArchMultithread::newMutex(). |
|
Create a new socket. The socket is an opaque data type. Implements IArchNetwork. Definition at line 414 of file CArch.cpp. References IArchNetwork::newSocket(). |
|
Start a new thread.
Creates and starts a new thread, using Implements IArchMultithread. Definition at line 330 of file CArch.cpp. References IArchMultithread::newThread(). |
|
Open the console.
Opens the console for writing. The console is opened automatically on the first write so calling this method is optional. Uses Implements IArchConsole. Definition at line 162 of file CArch.cpp. References IArchConsole::openConsole(). |
|
Open the log. Opens the log for writing. The log must be opened before being written to. Implements IArchLog. Definition at line 252 of file CArch.cpp. References IArchLog::openLog(). |
|
Check socket state.
Tests the state of (Cancellation point) Implements IArchNetwork. Definition at line 468 of file CArch.cpp. References IArchNetwork::pollSocket(). |
|
Invoke the signal handler.
Invokes the signal handler for Implements IArchMultithread. Definition at line 408 of file CArch.cpp. References IArchMultithread::raiseSignal(). |
|
Read data from socket.
Read up to Implements IArchNetwork. Definition at line 480 of file CArch.cpp. References IArchNetwork::readSocket(). |
|
Remove a receiver. Remove a receiver object from the task bar. This removes the icon from the task bar. Implements IArchTaskBar. Definition at line 630 of file CArch.cpp. References IArchTaskBar::removeReceiver(). |
|
Turn Nagle algorithm on or off on socket. Set socket to send messages immediately (true) or to collect small messages into one packet (false). Returns the previous state. Implements IArchNetwork. Definition at line 498 of file CArch.cpp. References IArchNetwork::setNoDelayOnSocket(). |
|
Change thread priority.
Changes the priority of Implements IArchMultithread. Definition at line 360 of file CArch.cpp. References IArchMultithread::setPriorityOfThread(). |
|
Turn address reuse on or off on socket. Allows the address this socket is bound to to be reused while in the TIME_WAIT state. Returns the previous state. Implements IArchNetwork. Definition at line 504 of file CArch.cpp. References IArchNetwork::setReuseAddrOnSocket(). |
|
Set the interrupt handler.
Sets the function to call on receipt of an external interrupt. By default and when Implements IArchMultithread. Definition at line 402 of file CArch.cpp. References IArchMultithread::setSignalHandler(). |
|
Show the console.
Causes the console to become visible. This generally only makes sense for a console in a graphical user interface. Other implementations will do nothing. Iff Implements IArchConsole. Definition at line 174 of file CArch.cpp. References IArchConsole::showConsole(). |
|
Show the log.
Causes the log to become visible. This generally only makes sense for a log in a graphical user interface. Other implementations will do nothing. Iff Implements IArchLog. Definition at line 264 of file CArch.cpp. References IArchLog::showLog(). |
|
Signal a condition variable. Signalling a condition variable releases one waiting thread. Implements IArchMultithread. Definition at line 288 of file CArch.cpp. References IArchMultithread::signalCondVar(). |
|
Sleep.
Blocks the calling thread for (cancellation point) Implements IArchSleep. Definition at line 582 of file CArch.cpp. References IArchSleep::sleep(). |
|
Cancellation point. This method does nothing but is a cancellation point. Clients can make their own functions cancellation points by calling this method at appropriate times. (Cancellation point) Implements IArchMultithread. Definition at line 366 of file CArch.cpp. References IArchMultithread::testCancelThread(). |
|
Check error on socket.
If the socket Implements IArchNetwork. Definition at line 492 of file CArch.cpp. References IArchNetwork::throwErrorOnSocket(). |
|
Get the current time. Returns the number of seconds since some arbitrary starting time. This should return as high a precision as reasonable. Implements IArchTime. Definition at line 642 of file CArch.cpp. References IArchTime::time(). |
|
Unblock thread in pollSocket(). Cause a thread that's in a pollSocket() call to return. This call may return before the thread is unblocked. If the thread is not in a pollSocket() call this call has no effect. Implements IArchNetwork. Definition at line 474 of file CArch.cpp. References IArchNetwork::unblockPollSocket(). |
|
Uninstall daemon.
Uninstall a daemon. Throws an Implements IArchDaemon. Definition at line 204 of file CArch.cpp. References IArchDaemon::uninstallDaemon(). |
|
Update a receiver. Updates the display of the receiver on the task bar. This should be called when the receiver appearance may have changed (e.g. it's icon or tool tip has changed). Implements IArchTaskBar. Definition at line 636 of file CArch.cpp. References IArchTaskBar::updateReceiver(). |
|
printf() to limited size buffer with va_list
This method is equivalent to vsprintf() except it will not write more than Implements IArchString. Definition at line 588 of file CArch.cpp. References IArchString::vsnprintf(). |
|
Wait for a thread to exit.
Waits for up to (Cancellation point) Implements IArchMultithread. Definition at line 372 of file CArch.cpp. References IArchMultithread::wait(). |
|
Wait on a condition variable.
Wait on a conditation variable for up to (Cancellation point) Implements IArchMultithread. Definition at line 300 of file CArch.cpp. References IArchMultithread::waitCondVar(). |
|
Write to the console. Writes the given string to the console, opening it if necessary. Implements IArchConsole. Definition at line 180 of file CArch.cpp. References IArchConsole::writeConsole(). |
|
Write to the log. Writes the given string to the log with the given level. Implements IArchLog. Definition at line 270 of file CArch.cpp. References IArchLog::writeLog(). |
|
Write data from socket.
Write up to Implements IArchNetwork. Definition at line 486 of file CArch.cpp. References IArchNetwork::writeSocket(). |