feisty meow concerns codebase  2.140
enhance_cpp.h File Reference
Include dependency graph for enhance_cpp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  basis::enhance_cpp
 

Namespaces

 basis
 The guards collection helps in testing preconditions and reporting errors.
 

Macros

#define frame_tracking_instance
 Provides missing language features in C++. More...
 
#define __trail_of_function(a, b, c, d, e)
 
#define DEFINE_CLASS_NAME(objname)
 Defines the name of a class by providing a couple standard methods. More...
 
#define FUNCDEF(func_in)
 FUNCDEF sets the name of a function (and plugs it into the callstack). More...
 
#define BASE_FUNCTION(func)
 A macro used within the FUNCTION macro to do most of the work. More...
 
#define FUNCTION(func)
 This macro sets up a descriptive variable called "function_name". More...
 
#define BASE_INSTANCE_FUNCTION(func)
 A macro used within the INSTANCE_FUNCTION macro. More...
 
#define INSTANCE_FUNCTION(func)
 A function macro that contains more information. More...
 
#define __WHERE__   basis::a_sprintf("%s [line %d]", __FILE__, __LINE__)
 WHERE is a macro that combines the file and line number macros. More...
 

Macro Definition Documentation

◆ __trail_of_function

#define __trail_of_function (   a,
  b,
  c,
  d,
 
)

Definition at line 32 of file enhance_cpp.h.

◆ __WHERE__

#define __WHERE__   basis::a_sprintf("%s [line %d]", __FILE__, __LINE__)

WHERE is a macro that combines the file and line number macros.

These are available to most compilers as automatically updated macros called FILE and LINE. This macro can be used anywhere an astring can be used and reports the current file name and line number.

Definition at line 94 of file enhance_cpp.h.

◆ BASE_FUNCTION

#define BASE_FUNCTION (   func)
Value:
astring just_function = astring(func); \
astring function_name = static_class_name(); \
function_name += astring("::") + just_function
#define static_class_name()

A macro used within the FUNCTION macro to do most of the work.

Definition at line 65 of file enhance_cpp.h.

◆ BASE_INSTANCE_FUNCTION

#define BASE_INSTANCE_FUNCTION (   func)
Value:
astring just_function = astring(func); \
astring function_name = instance_name(); \
function_name += astring("::") + just_function

A macro used within the INSTANCE_FUNCTION macro.

Definition at line 77 of file enhance_cpp.h.

◆ DEFINE_CLASS_NAME

#define DEFINE_CLASS_NAME (   objname)
Value:
static const char *static_class_name() { return (objname); } \
virtual const char *class_name() const { return static_class_name(); }

Defines the name of a class by providing a couple standard methods.

This provides a virtual function functionality slice for the class name, as well as a static version that can be used when no instances of the class exist yet.

Definition at line 45 of file enhance_cpp.h.

◆ frame_tracking_instance

#define frame_tracking_instance

Provides missing language features in C++.

The most noticeable missing thing in C++ when trying to build debugging and tracking subsystems with it is reflection. This header attempts to ameliorate some of the worst missing parts, such as the fact that a function cannot get its own name, and other really helpful features.

Definition at line 31 of file enhance_cpp.h.

◆ FUNCDEF

#define FUNCDEF (   func_in)
Value:
const char *func = (const char *)func_in; \
frame_tracking_instance __trail_of_function(static_class_name(), func, \
__FILE__, __LINE__, true)
#define __trail_of_function(a, b, c, d, e)
Definition: enhance_cpp.h:32

FUNCDEF sets the name of a function (and plugs it into the callstack).

This macro establishes the function name and should be used at the top of functions that wish to participate in class based logged as well as the callstack tracing capability of hoople. A new variable is created on the stack to track the function's presence until the function exits, at which time the stack will no longer show it as active.

Definition at line 57 of file enhance_cpp.h.

◆ FUNCTION

#define FUNCTION (   func)
Value:
BASE_FUNCTION(func); \
function_name += ": "; \
update_current_stack_frame_line_number(__LINE__)
#define BASE_FUNCTION(func)
A macro used within the FUNCTION macro to do most of the work.
Definition: enhance_cpp.h:65

This macro sets up a descriptive variable called "function_name".

The variable includes the object's name (static_class_name() must be implemented for the current object) and the current function's name within that object (the macro "func" must be defined with that name).

Definition at line 72 of file enhance_cpp.h.

◆ INSTANCE_FUNCTION

#define INSTANCE_FUNCTION (   func)
Value:
function_name += ": "; \
update_current_stack_frame_line_number(__LINE__)
#define BASE_INSTANCE_FUNCTION(func)
A macro used within the INSTANCE_FUNCTION macro.
Definition: enhance_cpp.h:77

A function macro that contains more information.

This macro is similar to FUNCTION but it uses the class's instance_name() method (see root_object). The instance function usually will provide more information about the class.

Definition at line 84 of file enhance_cpp.h.