3 #ifndef __u3d_defines_hpp
4 #define __u3d_defines_hpp
8 #include <u3d_message.hpp>
16 #define MIN_(a,b) ( ((a)<(b))?(a):(b) )
17 #define MAX_(a,b) ( ((a)>(b))?(a):(b) )
22 #define U3D_FILE_NAME_BUFFER_SIZE 1024
23 #define U3D_EPSILON 1.e-6
24 #define U3D_EPSILON_TRIGONOM 1.e-13 // Ilya magic
25 #define U3D_EPS_LENGTH 1
27 #define U3D_MIGR_PROG_NAME "rtmigr3d"
30 #define EQUAL_REALS(a,b) ( (fabs((a)-(b)) < U3D_EPSILON ? true : false) )
32 typedef set<int> int_set;
36 enum U3D_COLOR {WHITE, BLACK};
39 void fiazr2xyz(
double f,
double az,
double r,
double &px,
double &py,
double &pz);
42 void xyz2fiazr(
double px,
double py,
double pz,
double &f,
double &az,
double &r);
59 #define DMU_FILL_CHAR 0xbe
60 #define DMU_SZONE_SIZE 512
67 void* dmu_malloc(
size_t size,
const char* file,
int line);
69 void dmu_free(
void* ptr,
const char* file,
int line);
75 int dmu_check (
void* ptr,
const char* file,
int line);
79 #ifndef __use_standard_malloc__
93 # define malloc(size) dmu_malloc((size), __FILE__, __LINE__)
94 # define free(ptr) dmu_free((ptr), __FILE__, __LINE__)
97 #endif // __use_standard_malloc__
103 #ifndef __use_standard_vector__
109 typedef std::size_t size_type;
110 typedef std::ptrdiff_t difference_type;
112 typedef const T* const_pointer;
113 typedef T& reference;
114 typedef const T& const_reference;
115 typedef T value_type;
129 pointer address(reference x)
const {
return &x; };
131 const_pointer address(const_reference x)
const {
return &x; };
133 pointer allocate(size_type n,
void* hint=0) {
134 return static_cast<T*
>(::operator
new(n*
sizeof(T)));
137 void deallocate(
void* p, size_type n) {
138 ::operator
delete(p);
141 size_type max_size()
const throw() {
142 return std::numeric_limits<size_type>::max() /
sizeof(T);
145 void construct(pointer p,
const T& val) {
146 new (
static_cast<void*
>(p)) T(val);
149 void destroy(pointer p) {
160 typedef void* pointer;
161 typedef const void* const_pointer;
162 typedef void value_type;
164 template<
class U>
struct rebind {
191 std::vector<T, MyAllocator<T> >()
195 std::vector<T, MyAllocator<T> >(ndx)
199 std::vector<T, MyAllocator<T> > (other)
204 this->resize(other.size());
205 std::copy(other.begin(), other.end(), this->begin());
210 const T& operator[] (std::size_t ndx)
const
214 ret = &(this->at(ndx));
216 catch (std::out_of_range& e) {
224 T& operator[] (std::size_t ndx) {
227 ret = &(this->at(ndx));
229 catch (std::out_of_range& e) {
238 #else // __use_standard_vector__
240 #define safe_vector vector
242 #endif // __use_standard_vector__
static void error(const char *format,...)
Definition: u3d_defines.hpp:118
Definition: u3d_defines.hpp:188
Definition: u3d_defines.hpp:106