Chapter 4. Class Reference

Table of Contents
4.1. Assert_exit() Macro
4.2. Assert_return() Macro
4.3. AutoPtr Class
4.4. CmdLineOpts class
4.5. Fork Class
4.6. IdSet Class
4.7. MemDump Class
4.8. Reactor Class
4.9. Semaphore Class
4.10. SigAction Class
4.11. SigHandler Class
4.12. SigHandlers Class
4.13. SigSet Class
4.14. Singleton Class
4.15. PidFileLock Class
4.16. TimeVal Class
4.17. TimerCountdown CLASS
4.18. trace()/ trace_with_macro() Macros
4.19. xdrIOBuffer CLASS
4.20. CharInBuffer CLASS

This chapter attempts to describe some of the classes found in libassa library. Please, consult on-line libassa Reference Guide for class interfaces and hierarchical dependencies.

4.1. Assert_exit() Macro

Assert_exit () macro serves the same functionality as assert() function of a standard C library.

#include <assa/Assert.h>

#define Assert_exit (a_)

If expression a_ is false, error message is written to the application log file, and process gets SIGHUP which triggers graceful exit.

For example, I might want to test some critical pre-condition before proceeding with a function call, and if condition fails, write an error message to the log file and kill the process:

229: int IO_Handler::handle_read (int fd_)
230: {
231:    // Test precondition
233:    Assert_exit (fd_ == m_peerStream->getHandler ());
235:    // proceed with functions execution ...
236: }

If my condition were to fail, an error message would appear in the log file:

Assert Aborted False Expression!
Error on line 233 in file IO_Handler.cpp