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