00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00018 #ifndef LIBCWD_CLASS_ALLOC_H
00019 #define LIBCWD_CLASS_ALLOC_H
00020
00021 #ifndef LIBCWD_CONFIG_H
00022 #include <libcwd/config.h>
00023 #endif
00024
00025 #ifndef LIBCWD_ENUM_MEMBLK_TYPES_H
00026 #include <libcwd/enum_memblk_types.h>
00027 #endif
00028 #ifndef LIBCW_LOCKABLE_AUTO_PTR_H
00029 #include <libcwd/lockable_auto_ptr.h>
00030 #endif
00031 #if CWDEBUG_LOCATION && !defined(LIBCWD_CLASS_LOCATION_H)
00032 #include <libcwd/class_location.h>
00033 #endif
00034 #ifndef LIBCW_CSTDDEF
00035 #define LIBCW_CSTDDEF
00036 #include <cstddef>
00037 #endif
00038 #ifndef LIBCWD_SMART_PTR_H
00039 #include <libcwd/smart_ptr.h>
00040 #endif
00041 #ifndef LIBCW_SYS_TIME_H
00042 #define LIBCW_SYS_TIME_H
00043 #include <sys/time.h>
00044 #endif
00045
00046 namespace libcwd {
00047
00048
00049 class type_info_ct;
00050
00051
00052
00053
00054
00055
00060 class alloc_ct {
00061 protected:
00062 void const* a_start;
00063 size_t a_size;
00064 memblk_types_nt a_memblk_type;
00065 type_info_ct const* type_info_ptr;
00066 _private_::smart_ptr a_description;
00067 struct timeval a_time;
00068 #if CWDEBUG_LOCATION
00069 location_ct const* M_location;
00070 #endif
00071
00072 public:
00076 size_t size(void) const { return a_size; }
00077
00081 void const* start(void) const { return a_start; }
00082
00086 memblk_types_nt memblk_type(void) const { return a_memblk_type; }
00087
00095 type_info_ct const& type_info(void) const { return *type_info_ptr; }
00096
00102 char const* description(void) const { return a_description; }
00103
00109 struct timeval const& time(void) const { return a_time; }
00110
00111 #if CWDEBUG_LOCATION
00112
00119 location_ct const& location(void) const { return *M_location; }
00120 #endif
00121
00122 protected:
00127 alloc_ct(void const* s, size_t sz, memblk_types_nt type, type_info_ct const& ti, struct timeval const& t
00128 #if CWDEBUG_LOCATION
00129 , location_ct const* l
00130 #endif
00131 ) : a_start(s), a_size(sz), a_memblk_type(type), type_info_ptr(&ti), a_time(t)
00132 #if CWDEBUG_LOCATION
00133 , M_location(l)
00134 #endif
00135 , M_tagged(false)
00136 { }
00137
00145 virtual ~alloc_ct() { }
00146
00147
00148 private:
00149 bool M_tagged;
00150 public:
00151 bool is_tagged(void) const { return M_tagged; }
00152 void alloctag_called(void) { M_tagged = true; }
00153 };
00154
00155 }
00156
00157 #endif // LIBCWD_CLASS_ALLOC_H