Skip to content

Commit 05fdd4b

Browse files
committed
wrap more server related files with NO_SERVER macro
1 parent 111b698 commit 05fdd4b

24 files changed

+83
-9
lines changed

vpr/src/server/bytearray.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef BYTEARRAY_H
22
#define BYTEARRAY_H
33

4+
#ifndef NO_SERVER
5+
46
#include <cstdint>
57
#include <vector>
68
#include <string>
@@ -79,4 +81,6 @@ class ByteArray : public std::vector<uint8_t> {
7981

8082
} // namespace comm
8183

84+
#endif /* NO_SERVER */
85+
8286
#endif /* BYTEARRAY_H */

vpr/src/server/commconstants.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifndef NO_SERVER
2+
13
#include "commconstants.h"
24

35
namespace comm {
@@ -22,3 +24,4 @@ const std::string KEY_HOLD_PATH_LIST{"hold"};
2224

2325
} // namespace comm
2426

27+
#endif /* NO_SERVER */

vpr/src/server/commconstants.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef COMMCONSTS_H
22
#define COMMCONSTS_H
33

4+
#ifndef NO_SERVER
5+
46
#include <string>
57

68
namespace comm {
@@ -33,4 +35,6 @@ enum CMD {
3335

3436
} // namespace comm
3537

38+
#endif /* NO_SERVER */
39+
3640
#endif /* COMMCONSTS_H */

vpr/src/server/convertutils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifndef NO_SERVER
2+
13
#include "convertutils.h"
24
#include <sstream>
35
#include <iomanip>
@@ -64,3 +66,5 @@ std::string get_truncated_middle_str(const std::string& src, std::size_t num) {
6466

6567
return result;
6668
}
69+
70+
#endif /* NO_SERVER */

vpr/src/server/convertutils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef CONVERTUTILS_H
22
#define CONVERTUTILS_H
33

4+
#ifndef NO_SERVER
5+
46
#include <cstdint>
57
#include <optional>
68
#include <string>
@@ -12,4 +14,6 @@ std::string get_pretty_duration_str_from_ms(int64_t durationMs);
1214
std::string get_pretty_size_str_from_bytes_num(int64_t bytesNum);
1315
std::string get_truncated_middle_str(const std::string& src, std::size_t num = DEFAULT_PRINT_STRING_MAX_NUM);
1416

17+
#endif /* NO_SERVER */
18+
1519
#endif /* CONVERTUTILS_H */

vpr/src/server/gateio.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#include "gateio.h"
2-
31
#ifndef NO_SERVER
42

3+
#include "gateio.h"
4+
55
#include "telegramparser.h"
66
#include "commconstants.h"
77
#include "convertutils.h"

vpr/src/server/gateio.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include <chrono>
1212
#include <sstream>
13-
#include <iostream>
1413
#include <thread>
1514
#include <atomic>
1615
#include <mutex>

vpr/src/server/pathhelper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifndef NO_SERVER
2+
13
#include "pathhelper.h"
24
#include "commconstants.h"
35

@@ -65,3 +67,5 @@ CritPathsResult calc_critical_path(const std::string& report_type, int crit_path
6567
}
6668

6769
} // namespace server
70+
71+
#endif /* NO_SERVER */

vpr/src/server/pathhelper.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef PATHHELPER_H
22
#define PATHHELPER_H
33

4+
#ifndef NO_SERVER
5+
46
#include <vector>
57
#include <string>
68

@@ -27,4 +29,6 @@ CritPathsResult calc_critical_path(const std::string& type, int crit_path_num, e
2729

2830
} // namespace server
2931

32+
#endif /* NO_SERVER */
33+
3034
#endif /* PATHHELPER_H */

vpr/src/server/serverupdate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ gboolean update(gpointer);
2121
#endif /* NO_SERVER */
2222

2323
#endif /* SERVERUPDATE_H */
24+

vpr/src/server/task.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifndef NO_SERVER
2+
13
#include "task.h"
24

35
#include <sstream>
@@ -101,6 +103,6 @@ void Task::bake_response() {
101103
m_orig_reponse_bytes_num = m_response_buffer.size();
102104
}
103105

104-
105106
} // namespace server
106107

108+
#endif /* NO_SERVER */

vpr/src/server/task.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef TASK_H
22
#define TASK_H
33

4+
#ifndef NO_SERVER
5+
46
#include <string>
57
#include <memory>
68
#include <chrono>
@@ -70,4 +72,6 @@ using TaskPtr = std::unique_ptr<Task>;
7072

7173
} // namespace server
7274

75+
#endif /* NO_SERVER */
76+
7377
#endif /* TASK_H */

vpr/src/server/taskresolver.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#ifndef NO_SERVER
2-
31
#ifndef TASKRESOLVER_H
42
#define TASKRESOLVER_H
53

4+
#ifndef NO_SERVER
5+
66
#include "task.h"
77
#include "vpr_types.h"
88

@@ -50,6 +50,7 @@ class TaskResolver {
5050

5151
} // namespace server
5252

53+
#endif /* NO_SERVER */
54+
5355
#endif /* TASKRESOLVER_H */
5456

55-
#endif /* NO_SERVER */

vpr/src/server/telegrambuffer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifndef NO_SERVER
2+
13
#include "telegrambuffer.h"
24

35
namespace comm {
@@ -73,3 +75,5 @@ void TelegramBuffer::take_errors(std::vector<std::string>& errors) {
7375
}
7476

7577
} // namespace comm
78+
79+
#endif /* NO_SERVER */

vpr/src/server/telegrambuffer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef TELEGRAMBUFFER_H
22
#define TELEGRAMBUFFER_H
33

4+
#ifndef NO_SERVER
5+
46
#include "bytearray.h"
57
#include "telegramframe.h"
68

@@ -87,4 +89,6 @@ class TelegramBuffer
8789

8890
} // namespace comm
8991

92+
#endif /* NO_SERVER */
93+
9094
#endif /* TELEGRAMBUFFER_H */

vpr/src/server/telegramframe.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef TELEGRAMFRAME_H
22
#define TELEGRAMFRAME_H
33

4+
#ifndef NO_SERVER
5+
46
#include "telegramheader.h"
57
#include "bytearray.h"
68

@@ -25,4 +27,6 @@ using TelegramFramePtr = std::shared_ptr<TelegramFrame>;
2527

2628
} // namespace comm
2729

30+
#endif /* NO_SERVER */
31+
2832
#endif /* TELEGRAMFRAME_H */

vpr/src/server/telegramheader.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifndef NO_SERVER
2+
13
#include "telegramheader.h"
24
#include "convertutils.h"
35

@@ -72,3 +74,5 @@ std::string TelegramHeader::info() const {
7274
}
7375

7476
} // namespace comm
77+
78+
#endif /* NO_SERVER */

vpr/src/server/telegramheader.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef TELEGRAMHEADER_H
22
#define TELEGRAMHEADER_H
33

4+
#ifndef NO_SERVER
5+
46
#include "bytearray.h"
57

68
#include <string>
@@ -73,4 +75,6 @@ class TelegramHeader {
7375

7476
} // namespace comm
7577

78+
#endif /* NO_SERVER */
79+
7680
#endif /* TELEGRAMHEADER_H */

vpr/src/server/telegramoptions.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifndef NO_SERVER
2+
13
#include "telegramoptions.h"
24
#include "convertutils.h"
35

@@ -113,3 +115,4 @@ bool TelegramOptions::check_keys_presence(const std::vector<std::string>& keys)
113115

114116
} // namespace server
115117

118+
#endif /* NO_SERVER */

vpr/src/server/telegramoptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef TELEGRAMOPTIONS_H
22
#define TELEGRAMOPTIONS_H
33

4+
#ifndef NO_SERVER
5+
46
#include <set>
57
#include <vector>
68
#include <unordered_map>
@@ -57,4 +59,6 @@ class TelegramOptions {
5759

5860
} // namespace server
5961

62+
#endif /* NO_SERVER */
63+
6064
#endif /* TELEGRAMOPTIONS_H */

vpr/src/server/telegramparser.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
#ifndef NO_SERVER
2+
13
#include "telegramparser.h"
24
#include "convertutils.h"
35
#include "commconstants.h"
46

5-
67
namespace comm {
78

89
std::optional<std::string> TelegramParser::try_extract_json_value_str(const std::string& json_string, const std::string& key) {
@@ -66,3 +67,5 @@ std::optional<int> TelegramParser::try_extract_field_status(const std::string& m
6667
}
6768

6869
} // namespace comm
70+
71+
#endif /* NO_SERVER */

vpr/src/server/telegramparser.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef TELEGRAMPARSER_H
22
#define TELEGRAMPARSER_H
33

4+
#ifndef NO_SERVER
5+
46
#include <string>
57
#include <optional>
68

@@ -26,4 +28,6 @@ class TelegramParser {
2628

2729
} // namespace comm
2830

31+
#endif /* NO_SERVER */
32+
2933
#endif /* TELEGRAMPARSER_H */

vpr/src/server/zlibutils.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifndef NO_SERVER
2+
13
#include "zlibutils.h"
24

35
#include <cstring> // Include cstring for memset
@@ -78,4 +80,4 @@ std::optional<std::string> try_decompress(const std::string& compressed) {
7880
return result;
7981
}
8082

81-
83+
#endif /* NO_SERVER */

vpr/src/server/zlibutils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef ZLIBUTILS_H
22
#define ZLIBUTILS_H
33

4+
#ifndef NO_SERVER
5+
46
#include <string>
57
#include <optional>
68

@@ -32,4 +34,6 @@ std::optional<std::string> try_compress(const std::string& decompressed);
3234
*/
3335
std::optional<std::string> try_decompress(const std::string& compressed);
3436

37+
#endif /* NO_SERVER */
38+
3539
#endif /* ZLIBUTILS_H */

0 commit comments

Comments
 (0)