VR-Vantage
Loading...
Searching...
No Matches
vrvUtil.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2019 MAK Technologies, Inc.
3** All rights reserved.
4*******************************************************************************/
5
9
10#pragma once
11#ifdef _WIN32
12# pragma warning( error : 4700 )
13# pragma warning( error : 4701 )
14# pragma warning( error : 4101 )
15# pragma warning( error : 4189 )
16# pragma warning( error : 4715 )
17# pragma warning( error : 4239 )
18# pragma warning( error : 4150 )
19# pragma warning( error : 4553 )
20# pragma warning( disable : 4512 )
21# pragma warning( disable : 4511 )
22# pragma warning( disable : 4396 )
23# pragma warning( disable : 4832 )
24# pragma warning( disable : 4996 )
25# ifdef _M_X64 //64bit application, set DT_MEMORY_64
26# define DT_MEMORY_64
27# endif
28# ifdef vrvUtil_EXPORTS
29# define DT_DLL_VRVUTIL __declspec ( dllexport )
30# else
31# define DT_DLL_VRVUTIL __declspec ( dllimport )
32# endif
33#else
34# define DT_DLL_VRVUTIL
35# if defined(__LP64__) || defined(_LP64) //64bit application, set DT_MEMORY_64
36# define DT_MEMORY_64
37# endif
38#endif
39#include <memory>
40
41// Defining this to 1 gets the memory track capability compiled into your application
42// (which also needs to call mem_start() and mem_stop() - see stealth\stealth.cxx for example).
43// #define MEMTRACK 1
44
45//
46
47#if MEMTRACK
48
49namespace makVrv
50{
51 DT_DLL_VRVUTIL void mem_enable(bool enabled);
52 DT_DLL_VRVUTIL bool mem_enabled();
53 DT_DLL_VRVUTIL void mem_initializeSymbols();
54 DT_DLL_VRVUTIL void mem_track(void * p, size_t size);
55 DT_DLL_VRVUTIL void mem_release(void * p);
56 DT_DLL_VRVUTIL void mem_start( );
57 DT_DLL_VRVUTIL void mem_stop( );
58 DT_DLL_VRVUTIL void mem_frame( double time );
59 DT_DLL_VRVUTIL void mem_long( );
60 DT_DLL_VRVUTIL void mem_clear( );
61 DT_DLL_VRVUTIL void mem_print( bool pointers );
62}
63
64inline void* operator new (size_t size)
65{
66 void *p=malloc(size);
67 makVrv::mem_track(p, size);
68 if (p==0) // did malloc succeed?
69 {
70 throw std::bad_alloc(); // ANSI/ISO compliant behavior
71 }
72 return p;
73}
74
75inline void * operator new[] (size_t size)
76{
77 void *p=malloc(size);
78 makVrv::mem_track(p, size);
79 if (p==0) // did malloc succeed?
80 {
81 throw std::bad_alloc(); // ANSI/ISO compliant behavior
82 }
83 return p;
84}
85
86inline void operator delete (void *p)
87{
88 if(p)
89 {
90 makVrv::mem_release(p);
91 free(p);
92 }
93}
94
95inline void operator delete[] (void* p)
96{
97 if(p)
98 {
99 makVrv::mem_release(p);
100 free(p);
101 }
102}
103
104#endif
105
106namespace makVrv
107{
109}
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16
double DtDynamicTerrainTimeType
Definition vrvUtil.h:108
#define DT_DLL_VRVUTIL
Definition vrvUtil.h:34