]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Docs: CBDATA documentation update
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 10 Oct 2014 17:46:03 +0000 (10:46 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 10 Oct 2014 17:46:03 +0000 (10:46 -0700)
No logic changes.

* replace documentation advocating the deprecated CBDATA_TYPE() and
  CBDATA_TYPE_INIT() macros with text advocating CBDATA_CLASS2() API.

* remove unused macro CBDATA_GLOBAL_TYPE()

src/cbdata.h

index 240197ac246d0406dda192099748aff75b1cd794..af6bafb30fbefd0eb47d653de37d8ed35832d134 100644 (file)
@@ -26,7 +26,6 @@
  *      possible. It is not suitable or intended as a generic RefCount
  *      memory allocator.
  *
- \todo CODE: make cbdata a template or class-inheritance system instead of Macros.
  *
  \section Examples Examples
  \par
  *
  \par
  *     To add new module specific data types to the allocator one uses the
- *     macros CBDATA_TYPE() and CBDATA_INIT_TYPE(). These creates a local cbdata
- *     definition (file or block scope). Any cbdataAlloc() calls must be made
- *     within this scope. However, cbdataFree() might be called from anywhere.
- *
- \par
- *     First the cbdata type needs to be defined in the module. This
- *     is usually done at file scope, but it can also be local to a
- *     function or block..
- \code
-       CBDATA_TYPE(type_of_data);
- \endcode
- *     Then in the code somewhere before the first allocation
- *     (can be called multiple times with only a minimal overhead)
- \code
-       CBDATA_INIT_TYPE(type_of_data);
- \endcode
- *     Or if a free function is associated with the data type. This
- *     function is responsible for cleaning up any dependencies etc
- *     referenced by the structure and is called on cbdataFree() or
- *     when the last reference is deleted by cbdataReferenceDone() /
- *     cbdataReferenceValidDone()
- \code
-       CBDATA_INIT_TYPE_FREECB(type_of_data, free_function);
- \endcode
- *
- \subsection AddingGlobalCBDATATypes Adding a new cbdata registered data type globally
- *
- \par
- *     To add new global data types that can be allocated from anywhere
- *     within the code one have to add them to the cbdata_type enum in
- *     enums.h, and a corresponding CREATE_CBDATA() call in
- *     cbdata.c:cbdataInit(). Or alternatively add a CBDATA_GLOBAL_TYPE()
- *     definition to globals.h as shown below and use CBDATA_INIT_TYPE() at
- *     the appropriate location(s) as described above.
- *
- \code
-       extern CBDATA_GLOBAL_TYPE(type_of_data);        // CBDATA_UNDEF
- \endcode
+ *     macro CBDATA_CLASS2() in the class private section, and CBDATA_CLASS_INIT()
+ *      or CBDATA_NAMESPACED_CLASS_INIT() in the .cc file.
+ *      This creates new(), delete() and toCbdata() methods
+ *     definition in class scope. Any allocate calls must be made with
+ *      new() and destruction with delete(), they may be called from anywhere.
  */
 
 /**
@@ -366,23 +332,6 @@ cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size,
  */
 #define CBDATA_TYPE(type)      static cbdata_type CBDATA_##type = CBDATA_UNKNOWN
 
-/**
- \ingroup CBDATAAPI
- * Defines a global cbdata type that can be referenced anywhere in the code.
- *
- \code
-        external CBDATA_GLOBAL_TYPE(datatype);
- \endcode
- * Should be added to the module *.h header file.
- *
- \code
-        CBDATA_GLOBAL_TYPE(datatype);
- \endcode
- *
- *  Should be added to the module main *.cc file.
- */
-#define CBDATA_GLOBAL_TYPE(type)       cbdata_type CBDATA_##type
-
 /**
  \ingroup CBDATAAPI
  *