CFx SDK Documentation  2023 SP0
BcfCommon.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2020, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Open Design Alliance software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Open Design Alliance Copyright (C) 2002-2020 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef _BFC_COMMON_H
25 #define _BFC_COMMON_H
26 
27 #include "OdPlatformSettings.h"
28 #include "IfcBuildOptions.h"
29 
30 #include "RxObject.h"
31 #include "SmartPtr.h"
32 
33 #include "BcfUnset.h"
34 
38 namespace OdBcf {
39 
40 #define MAX_ENTITY_COLLECTION_SIZE 1024
41 #define FILE_BUFFER_SIZE 1024
42 
43 #define PROJECT_FILE_NAME "project.bcfp"
44 #define VERSION_FILE_NAME "bcf.version"
45 #define MARKUP_FILE_NAME "markup.bcf"
46 #define DEFAULT_VIEWPOINT_FILE_NAME "viewpoint.bcfv"
47 #define VIEWPOINT_FILE_EXTENSION "bcfv"
48 #define DEFAULT_SNAPSHOT_FILE_NAME "snapshot.png"
49 #define SNAPSHOT_FILE_EXTENSION "png"
50 
51 #define DECLARE_SET(MethodName, VariableType, VariableName) \
52  \
53 void set##MethodName(const VariableType &VariableName##Value);
54 
55 #define DEFINE_SET(ClassName, MethodName, VariableType, VariableName) \
56  \
57 void ClassName::set##MethodName(const VariableType &VariableName##Value) \
58 { \
59  VariableName = VariableName##Value; \
60 }
61 
62 #define DECLARE_GET(MethodName, VariableType, VariableName) \
63  \
64 VariableType& get##MethodName();
65 
66 #define DEFINE_GET(ClassName, MethodName, VariableType, VariableName) \
67  \
68 VariableType& ClassName::get##MethodName() \
69 { \
70  return VariableName; \
71 }
72 
73 #define DECLARE_CONST_ACCESSORS(MethodName, VariableType, VariableName) \
74  \
75 const VariableType& get##MethodName() const; \
76  \
77 bool is##MethodName##Unset() const;
78 
79 #define DEFINE_CONST_ACCESSORS(ClassName, MethodName, VariableType, VariableName) \
80  \
81 const VariableType& ClassName::get##MethodName() const \
82 { \
83  return VariableName; \
84 } \
85  \
86 bool ClassName::is##MethodName##Unset() const \
87 { \
88  return OdBcf::Utils::isUnset(VariableName); \
89 }
90 
91 #define DECLARE_ACCESSORS(MethodName, VariableType, VariableName) \
92  \
93 DECLARE_SET( MethodName, VariableType, VariableName) \
94 DECLARE_GET( MethodName, VariableType, VariableName) \
95 DECLARE_CONST_ACCESSORS(MethodName, VariableType, VariableName)
96 
97 #define DEFINE_ACCESSORS(ClassName, MethodName, VariableType, VariableName) \
98  \
99 DEFINE_SET( ClassName, MethodName, VariableType, VariableName) \
100 DEFINE_GET( ClassName, MethodName, VariableType, VariableName) \
101 DEFINE_CONST_ACCESSORS(ClassName, MethodName, VariableType, VariableName)
102 
103 #define INIT_RESULT(VariableName) \
104  \
105 OdResult VariableName##Local; \
106 if (VariableName == NULL) \
107 { \
108  VariableName = &VariableName##Local; \
109 } \
110 *VariableName = eOk;
111 
112 } //namespace OdBcf
113 
114 #endif // _BFC_COMMON_H