1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134 | #ifndef DAMSEL_UTIL_HPP
#define DAMSEL_UTIL_HPP
#include "moab/Forward.hpp"
#include "moab/ErrorHandler.hpp"
#include "DebugOutput.hpp"
#include "damsel.h"
#include "damsel-internal.h"
// Some macros to handle error checking (cribbed from WriteHDF5).
// All macros contain a "return" statement. These macros are coded with a do if while
// to allow statements calling them to be terminated with a ;
#define CHK_DMSL_ERR( A, B ) \
do \
{ \
if( DMSL_OK.id != ( A ).id ) \
{ \
MB_SET_ERR_CONT( B ); \
return error( MB_FAILURE ); \
} \
} while( false )
#define CHK_DMSL_ERR_NM( A ) \
do \
{ \
if( DMSL_OK.id != ( A ).id ) \
{ \
MB_CHK_ERR_CONT( MB_FAILURE ); \
return error( MB_FAILURE ); \
} \
} while( false )
namespace moab
{
class DamselUtil
{
public:
friend class WriteDamsel;
friend class ReadDamsel;
//! Needs to be a constructor to initialize dtom_data_type
DamselUtil();
static damsel_data_type mtod_data_type[MB_MAX_DATA_TYPE + 1];
static enum DataType dtom_data_type[DAMSEL_DATA_TYPE_PREDEFINED_WATERMARK + 1];
static enum damsel_entity_type mtod_entity_type[MBMAXTYPE + 1];
static enum EntityType dtom_entity_type[DAMSEL_ENTITY_TYPE_ALL_TYPES + 1];
//! Convert handles in a container to a range; assumes EntityHandle and Damsel
//! entity handles are the same size
static ErrorCode container_to_range( damsel_model m, damsel_container& cont, Range& range );
//! struct to hold information on damsel/moab tags
class tinfo
{
public:
tinfo( Tag mt, damsel_handle dt, TagType tt ) : mTagh( mt ), dTagh( dt ), tagType( tt ) {}
tinfo() : mTagh( 0 ), dTagh( 0 ), tagType( MB_TAG_ANY ) {}
Tag mTagh;
damsel_handle dTagh;
TagType tagType;
};
template < class T >
struct MtagP
{
// deprecation of unary_function
typedef T argument_type;
typedef bool result_type;
public:
MtagP( const Tag& th )<--- Struct 'MtagP < DamselUtil :: tinfo >' has a constructor with 1 argument that is not explicit. [+]Struct 'MtagP < DamselUtil :: tinfo >' has a constructor with 1 argument that is not explicit. Such constructors should in general be explicit for type safety reasons. Using the explicit keyword in the constructor means some mistakes when using the class can be avoided.
{
tH = th;<--- Variable 'tH' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'tH' a value by passing the value to the constructor in the initialization list.
}
bool operator()( const T& tclass )
{
return tclass.mTagh == tH;
}
Tag tH;
};
template < class T >
struct DtagP
{
// deprecation of unary_function
typedef T argument_type;
typedef bool result_type;
public:
DtagP( const damsel_handle& th )<--- Struct 'DtagP < DamselUtil :: tinfo >' has a constructor with 1 argument that is not explicit. [+]Struct 'DtagP < DamselUtil :: tinfo >' has a constructor with 1 argument that is not explicit. Such constructors should in general be explicit for type safety reasons. Using the explicit keyword in the constructor means some mistakes when using the class can be avoided.
{
tH = th;<--- Variable 'tH' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'tH' a value by passing the value to the constructor in the initialization list.
}
bool operator()( const T& tclass )
{
return tclass.dTagh == tH;
}
damsel_handle tH;
};
private:
//! Damsel library id
damsel_library dmslLib;
//! Damsel model id
damsel_model dmslModel;
//! Other conventional tags
tinfo xcoordsTag, ycoordsTag, zcoordsTag, collFlagsTag, parentsTag, childrenTag;
//! MOAB/damsel handles for dense [0], sparse [1], and conventional [2] tags
std::vector< tinfo > tagMap;
//! Damsel handle type used in (this build of) MOAB
damsel_handle_type moabHandleType;
};
// This function doesn't do anything useful. It's just a nice
// place to set a break point to determine why the reader fails.
static inline ErrorCode error( ErrorCode rval )
{
return rval;
}
} // namespace moab
#endif
|