Project

General

Profile

Useful macros » History » Version 1

jun chen, 03/10/2025 12:35 AM

1 1 jun chen
# Useful macros
2
3
4
* **CM_PROPERTY(xxx):** define setter/getter for class member, require the member ends with "_" 
5
* **NAMED_TUPLE(cls, (type, name, value))** : define a tuple like class, will automatically generate constructor/operator<</to_string/getter/setter
6
* **CM_SERIALIZE()** : declare boost serialization function
7
* **CM_BASE_SERIALIZE** : used if the serialized class was derived from another class example:
8
9
if Base class have member:
10
11
```
12
CM_SFRIALIZE() {
13
	ar&  CM_BASE_SFRIALIZF(Base)&  new—class—member;
14
15
```
16
17
if Base class do not have member:
18
19
```
20
CM_SFRIALIZE() {
21
22
```
23
* **BITSET_SOLO(flag, (bit1)(bit2))** : use one bit per one state, will automatically generate is_xxx/set_xxx/reset_xxx
24
* **ENUMCLASS** : declare an enum class, will automatically generate operator<<
25
* **DBG:** output debug messages only if you set debug level > LVL
26
27
* **cm::join(x, y, z)** : works like python "".join()
28
* **cm::format("{}xxxxx", xxx)** , works like python format string, plz do not use sprintf and cout !!