libMVRgdtf e5d999f
A library for GDTF and MVR
Loading...
Searching...
No Matches
StdAfx.h
Go to the documentation of this file.
1// StdAfx.h : include file for standard system include files,
2// or project specific include files that are used frequently, but
3// are changed infrequently
4//
5// Copyright � Nemetschek North America, Inc 2005.
6// All Rights Reserved.
7
8#pragma once
9
10#if _WINDOWS
11
12#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
13#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
14#define __FP__
15
16#pragma warning(disable:4786)
17#pragma warning( disable : 4800)
18#endif // _WINDOWS
19
20#include "GSTypes.h"
21#include "CommonPrefix.h"
23#include <iostream>
24using namespace VectorworksMVR;
25
26#define VCOM_SUCCEEDED(x) (x==0)
27#define VCOM_FAILED(x) (x != kVCOMError_NoError)
28
29//---------------------------------------------------------------------------------
30// Add defines
31
32#define __PrintDebugValue__(x, y) std::cout << #x << " " << #y <<" Failed!" << std::endl
33#define __PrintDebugValue2__(x) std::cout << #x << " Failed!" << std::endl
34
35#define ASSERTN(x,y) if(!(y)) { __PrintDebugValue__(x, y); }
36#define DSTOP(params) { __PrintDebugValue2__(params); }
37#define VERIFYN(x,y) (!(y))
38#define VWFC_ASSERT(x) if(!(x)) { __PrintDebugValue2__(x); }
39#define THROW_VWFC_EXCEPTION(x,y,z ) { __PrintDebugValue__(x, z); }
40
41#define kEveryone 1
42#define kMCCoordTypes "2"
43
44#define GS_API
45
46// Check windows
47#if _WIN32 || _WIN64
48#if _WIN64
49#define IS64BIT
50#else
51#define IS32BIT
52#endif
53#else
54#if (INTPTR_MAX == INT32_MAX)
55# define IS32BIT
56#else
57# define IS64BIT
58#endif
59#endif
60
61
62
63//---------------------------------------------------------------------------------
64// Add includes from VWSDK
65#include "MCCoordTypes.h"
66#include "FolderSpecifiers.h"
67#include "GSString.h"
68#include "VWPoint2D.h"
69#include "VWPoint3D.h"
70#include "VWLine2D.h"
71#include "VWLine3D.h"
72#include "VWMathUtils.h"
73#include "VWTransformMatrix.h"
74#include "UUID.h"
75#include "RGBColor.h"
76
77using namespace VWFC::Math;
78using namespace VWFC::Tools;
79
80// Interfaces
84#include "Interface/IZIPFile.h"
85#include "Interface/IStdFile.h"
86#include "Interface/IXMLFile.h"
87
88#ifdef DONT_USE_XERCES_AS_XMLLIB
90#endif
91
92// Needed typedefs
93typedef std::vector<double> TDoubleArray;
94typedef std::vector<Sint32> TSint32Array;
95typedef std::vector<Uint16> TUint16Array;
96typedef std::vector<VectorworksMVR::GdtfDefines::DMXAddress> TDMXAddressArray;
97
98
99//
100// Copyright Nemetschek Vectorworks, Inc.
101// Use of this file is governed by the Nemetschek Vectorworks SDK License Agreement
102// http://developer.vectorworks.net/index.php?title=Vectorworks_SDK_License
103//
104//
105// This file contains the type definitions for the Graphsoft core.
106//
107
108#pragma once
109#if GS_WIN
110
111#ifdef EXPORT_STATIC
112 #define GS_HIDDEN_VISIBILITY
113#else
114 #ifdef EXPORT_SYMBOLS
115 #define GS_HIDDEN_VISIBILITY __declspec(dllexport)
116 #else
117 #define GS_HIDDEN_VISIBILITY __declspec(dllimport)
118 #endif // EXPORT_SYMBOLS
119#endif
120
121#define WIN32_LEAN_AND_MEAN // Selten verwendete Komponenten aus Windows-Headern ausschließen
122// Windows-Headerdateien
123#include <windows.h>
124
125#elif GS_LIN
126#define GS_HIDDEN_VISIBILITY
127
128#elif GS_MAC
129#define GS_HIDDEN_VISIBILITY __attribute__((visibility("default")))
130
131#endif
132
133#define VW_EXPORT GS_HIDDEN_VISIBILITY
134
135
136typedef uint32_t RefNumType;
137
138
139
140// VCOM interface implementation with immediate destruction
141template<class Interface> class VCOMImmediateImpl : public Interface
142{
143public:
144 VCOMImmediateImpl() { fRefCnt = 0; fParent = NULL; }
145 VCOMImmediateImpl(IVWUnknown* parent) { fRefCnt = 0; fParent = parent; if ( fParent ) { fParent->AddRef(); } }
146 virtual ~VCOMImmediateImpl() { }
147
148// IVWUnknown
149public:
150 virtual uint32_t VCOM_CALLTYPE AddRef() { fRefCnt++; return fRefCnt; }
151 virtual uint32_t VCOM_CALLTYPE Release()
152 {
153 ASSERTN( kEveryone, fRefCnt > 0 );
154 if ( fRefCnt > 0 ) {
155 fRefCnt --;
156
157 // mechanizm for immediate delete of the interface instance
158 if ( fRefCnt == 0 ) {
159 this->OnRefCountZero();
160 delete this;
161 //::GS_VWNotifyDeleteInterface( this );
162 // EXIT IMMEDIATELY! 'this' no longer exist!!!
163 return 0;
164 }
165 }
166 return fRefCnt;
167 }
168
169protected:
170 // notification when this instance ref count goes down to zero
171 virtual void OnRefCountZero()
172 {
173 if ( fParent )
174 { fParent->Release(); }
175 fParent = NULL;
176 }
177
178protected:
179 RefNumType fRefCnt;
180 IVWUnknown* fParent;
181};
182
183// Local VCOM interface implementation with late destruction
184template<class Interface> class VCOMImpl : public Interface
185{
186public:
187 VCOMImpl() { fRefCnt = 0; fParent = NULL; }
188 VCOMImpl(IVWUnknown* parent) { fRefCnt = 0; fParent = parent; if ( fParent ) { fParent->AddRef(); } }
189 virtual ~VCOMImpl() { }
190
191// IVWUnknown
192public:
193 virtual uint32_t VCOM_CALLTYPE AddRef() { fRefCnt++; return fRefCnt; }
194 virtual uint32_t VCOM_CALLTYPE Release()
195 {
196 ASSERTN( kEveryone, fRefCnt > 0 );
197 if ( fRefCnt > 0 ) {
198 fRefCnt --;
199 }
200 if ( fRefCnt == 0 ) {
201 delete this;
202 // exit immediatelly. 'this' may no longer be valid
203 return 0;
204 }
205 return fRefCnt;
206 }
207
208protected:
209 // notification when this instance ref count goes down to zero
210 virtual void OnRefCountZero()
211 {
212 if ( fParent )
213 { fParent->Release(); }
214 fParent = NULL;
215 }
216
217protected:
218 RefNumType fRefCnt;
219 IVWUnknown* fParent;
220};
221
222
std::vector< VectorworksMVR::GdtfDefines::DMXAddress > TDMXAddressArray
Definition StdAfx.h:96
std::vector< Sint32 > TSint32Array
Definition StdAfx.h:94
std::vector< double > TDoubleArray
Definition StdAfx.h:93
#define ASSERTN(x, y)
Definition StdAfx.h:35
#define kEveryone
Definition StdAfx.h:41
std::vector< Uint16 > TUint16Array
Definition StdAfx.h:95
#define VCOM_CALLTYPE
Definition VectorworksMVR.h:93
Definition VectorworksMVR.h:109
Definition VWLine2D.h:17
Definition UUID.h:14
Definition CieColor.h:9