2 #include "../acl_cpp_define.hpp" 37 void *
operator new(
size_t size,
size_t nblock = 2);
39 #if defined(_WIN32) || defined(_WIN64) 40 void operator delete(
void* ptr, size_t);
42 void operator delete(
void* ptr);
50 bool dbuf_reset(
size_t reserve = 0);
59 void* dbuf_alloc(
size_t len);
66 void* dbuf_calloc(
size_t len);
73 char* dbuf_strdup(
const char* s);
81 char* dbuf_strndup(
const char* s,
size_t len);
89 void* dbuf_memdup(
const void* addr,
size_t len);
96 bool dbuf_free(
const void* addr);
103 bool dbuf_keep(
const void* addr);
110 bool dbuf_unkeep(
const void* addr);
227 dbuf_guard(
size_t nblock = 2,
size_t capacity = 500);
239 bool dbuf_reset(
size_t reserve = 0);
248 return dbuf_->dbuf_alloc(len);
258 return dbuf_->dbuf_calloc(len);
268 return dbuf_->dbuf_strdup(s);
279 return dbuf_->dbuf_strndup(s, len);
290 return dbuf_->dbuf_memdup(addr, len);
300 return dbuf_->dbuf_free(addr);
310 return dbuf_->dbuf_keep(addr);
320 return dbuf_->dbuf_unkeep(addr);
357 dbuf_obj* operator[](
size_t pos)
const;
370 void set_increment(
size_t incr);
373 template <
typename T>
376 T* t =
new (dbuf_alloc(
sizeof(T))) T();
381 template <
typename T,
typename P1>
384 T* t =
new (dbuf_alloc(
sizeof(T))) T(p);
389 template <
typename T,
typename P1,
typename P2>
392 T* t =
new (dbuf_alloc(
sizeof(T))) T(p1, p2);
397 template <
typename T,
typename P1,
typename P2,
typename P3>
400 T* t =
new (dbuf_alloc(
sizeof(T))) T(p1, p2, p3);
405 template <
typename T,
typename P1,
typename P2,
typename P3,
409 T* t =
new (dbuf_alloc(
sizeof(T))) T(p1, p2, p3, p4);
414 template <
typename T,
typename P1,
typename P2,
typename P3,
415 typename P4,
typename P5>
416 T*
create(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
418 T* t =
new (dbuf_alloc(
sizeof(T))) T(p1, p2, p3, p4, p5);
423 template <
typename T,
typename P1,
typename P2,
typename P3,
424 typename P4,
typename P5,
typename P6>
425 T*
create(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
427 T* t =
new (dbuf_alloc(
sizeof(T))) T(p1, p2, p3, p4, p5, p6);
432 template <
typename T,
typename P1,
typename P2,
typename P3,
433 typename P4,
typename P5,
typename P6,
typename P7>
434 T*
create(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
436 T* t =
new (dbuf_alloc(
sizeof(T)))
437 T(p1, p2, p3, p4, p5, p6, p7);
442 template <
typename T,
typename P1,
typename P2,
typename P3,
443 typename P4,
typename P5,
typename P6,
typename P7,
445 T*
create(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
447 T* t =
new (dbuf_alloc(
sizeof(T)))
448 T(p1, p2, p3, p4, p5, p6, p7, p8);
453 template <
typename T,
typename P1,
typename P2,
typename P3,
454 typename P4,
typename P5,
typename P6,
typename P7,
455 typename P8,
typename P9>
456 T*
create(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7,
459 T* t =
new (dbuf_alloc(
sizeof(T)))
460 T(p1, p2, p3, p4, p5, p6, p7, p8, p9);
465 template <
typename T,
typename P1,
typename P2,
typename P3,
466 typename P4,
typename P5,
typename P6,
typename P7,
467 typename P8,
typename P9,
typename P10>
468 T*
create(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7,
469 P8 p8, P9 p9, P10 p10)
471 T* t =
new (dbuf_alloc(
sizeof(T)))
472 T(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
487 struct dbuf_objs_link
493 struct dbuf_objs_link* next;
496 dbuf_objs_link head_;
497 dbuf_objs_link* curr_;
500 void init(
size_t capacity);
T * create(P1 p1, P2 p2, P3 p3)
T * create(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
void * dbuf_memdup(const void *addr, size_t len)
char * dbuf_strndup(const char *s, size_t len)
char * dbuf_strdup(const char *s)
T * create(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
dbuf_guard * get_guard() const
bool dbuf_free(const void *addr)
void * dbuf_alloc(size_t len)
void * dbuf_calloc(size_t len)
T * create(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9)
bool dbuf_unkeep(const void *addr)
ACL_DBUF_POOL * get_dbuf()
struct ACL_DBUF_POOL ACL_DBUF_POOL
T * create(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
T * create(P1 p1, P2 p2, P3 p3, P4 p4)
acl::dbuf_pool & get_dbuf() const
bool dbuf_keep(const void *addr)
T * create(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10)
T * create(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)