Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-19 08:08:30

0001 // Conditions (a.k.a. exceptions)
0002 
0003 #ifndef _CL_CONDITION_H
0004 #define _CL_CONDITION_H
0005 
0006 #include "cln/malloc.h"
0007 #include "cln/io.h"
0008 
0009 namespace cln {
0010 
0011 struct cl_condition {
0012     // Allocation.
0013     void* operator new (size_t size) { return malloc_hook(size); }
0014     // Deallocation.
0015     void operator delete (void* ptr) { free_hook(ptr); }
0016     // Name.
0017     virtual const char * name () const = 0;
0018     // Print.
0019     virtual void print (std::ostream&) const = 0;
0020     // Virtual destructor.
0021     virtual ~cl_condition () = 0;
0022 private:
0023     virtual void dummy ();
0024 };
0025 #define SUBCLASS_cl_condition() \
0026 public:                                   \
0027     /* Allocation. */                         \
0028     void* operator new (size_t size) { return malloc_hook(size); } \
0029     /* Deallocation. */                       \
0030     void operator delete (void* ptr) { free_hook(ptr); }
0031 
0032 // Functions which want to raise a condition return a `cl_condition*'.
0033 // The caller checks this value. NULL means no condition. The one who
0034 // disposes the condition (handles it without resignalling it) should
0035 // call `delete' on the condition pointer.
0036 
0037 }  // namespace cln
0038 
0039 #endif /* _CL_CONDITION_H */