NANDRAD Data Model Library
Version 2.0
NANDRAD
NANDRAD_CodeGenMacros.h
1
/* The NANDRAD data model library.
2
3
Copyright (c) 2012-today, Institut für Bauklimatik, TU Dresden, Germany
4
5
Primary authors:
6
Andreas Nicolai <andreas.nicolai -[at]- tu-dresden.de>
7
Anne Paepcke <anne.paepcke -[at]- tu-dresden.de>
8
9
This library is part of SIM-VICUS (https://github.com/ghorwin/SIM-VICUS)
10
11
This library is free software: you can redistribute it and/or modify
12
it under the terms of the GNU General Public License as published by
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
16
This library is distributed in the hope that it will be useful,
17
but WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
GNU General Public License for more details.
20
*/
21
22
#ifndef NANDRAD_CodeGenMacrosH
23
#define NANDRAD_CodeGenMacrosH
24
25
class
TiXmlElement;
26
27
// IDType is used instead of unsigned int for special serialization feature
28
typedef
unsigned
int
IDType;
29
30
#define NANDRAD_READWRITE \
31
void readXML(const TiXmlElement * element); \
32
TiXmlElement * writeXML(TiXmlElement * parent) const;
33
34
#define NANDRAD_READWRITE_IFNOTEMPTY(X) \
35
void readXML(const TiXmlElement * element) { readXMLPrivate(element); } \
36
TiXmlElement * writeXML(TiXmlElement * parent) const { if (*this != X()) return writeXMLPrivate(parent); else return nullptr; }
37
38
#define NANDRAD_READWRITE_IFNOT_INVALID_ID \
39
void readXML(const TiXmlElement * element) { readXMLPrivate(element); } \
40
TiXmlElement * writeXML(TiXmlElement * parent) const { if (m_id != INVALID_ID) return writeXMLPrivate(parent); else return nullptr; }
41
42
#define NANDRAD_READWRITE_PRIVATE \
43
void readXMLPrivate(const TiXmlElement * element); \
44
TiXmlElement * writeXMLPrivate(TiXmlElement * parent) const;
45
46
#define NANDRAD_COMP(X) \
47
bool operator!=(const X & other) const; \
48
bool operator==(const X & other) const { return !operator!=(other); }
49
50
#define NANDRAD_COMPARE_WITH_ID \
51
bool operator==(unsigned int x) const { return m_id == x; }
52
53
#define NANDRAD_COMPARE_WITH_NAME \
54
bool operator==(const std::string & name) const { return m_name == name; }
55
56
#endif // NANDRAD_CodeGenMacrosH
src
NANDRAD_CodeGenMacros.h
Generated on Fri Sep 3 2021 07:22:31 for NANDRAD Data Model Library by
1.8.13