Introduction

Getting Started

Programming Guides

API Reference

Additional Resources

BStreamMemory.h
1 // Copyright (c) Tech Soft 3D, Inc.
2 //
3 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
4 // and considered a trade secret as defined under civil and criminal statutes.
5 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
6 // unauthorized use or misappropriation of its trade secrets. Use of this information
7 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
8 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
9 
10 #ifndef BSTREAM_MEMORY
11 #define BSTREAM_MEMORY
12 
13 #ifdef HPS_CORE_BUILD
14 # include "hoops.h"
15 # define BSTREAM_NEW(type) NEW(type)
16 # define BSTREAM_ALLOC(p, type) ALLOC(p, type)
17 # define BSTREAM_ALLOC_ARRAY(p, count, type) ALLOC_ARRAY(p, count, type)
18 # define BSTREAM_FREE(p, type) do { \
19  if (p != nullptr) \
20  FREE(p, type); \
21  } while (0)
22 # define BSTREAM_FREE_ARRAY(p, count, type) do { \
23  if (p != nullptr) \
24  FREE_ARRAY(p, count, type); \
25  } while (0)
26 # define BSTREAM_NEW_VLIST(p) p = new_vlist(DEFAULT_MEMORY_POOL())
27 # define BSTREAM_NEW_VHASH(p, size) p = new_vhash(size, DEFAULT_MEMORY_POOL())
28 #else
29 # define BSTREAM_NEW(type) new type
30 # define BSTREAM_ALLOC(p, type) p = new type
31 # define BSTREAM_ALLOC_ARRAY(p, count, type) p = new type [count]
32 # define BSTREAM_FREE(p, type) delete p
33 # define BSTREAM_FREE_ARRAY(p, count, type) delete [] p
34 # define BSTREAM_NEW_VLIST(p) p = new_vlist(malloc, free)
35 # define BSTREAM_NEW_VHASH(p, size) p = new_vhash(size, malloc, free)
36 #endif
37 
38 # define BSTREAM_DELETE(p) delete p
39 
40 #endif // BSTREAM_MEMORY