Atlas-C++
tests/Objects/DebugBridge.h
1 #include <Atlas/Bridge.h>
2 
3 #include <iostream>
4 #include <string>
5 
6 class DebugBridge : public Atlas::Bridge
7 {
8 public:
9 
10  DebugBridge()
11  {
12  padding = "";
13  }
14 
15  ~DebugBridge() override = default;
16 
17  void streamBegin() override {
18  std::cout << padding << "streamBegin" << std::endl;
19  addPadding();
20  }
21 
22  void streamMessage() override {
23  std::cout << padding << "New Map" << std::endl;
24  addPadding();
25  }
26 
27  void streamEnd() override {
28  removePadding();
29  std::cout << padding << "streamEnd" << std::endl;
30  }
31 
32  void mapMapItem(std::string name) override
33  {
34  std::cout << padding << name << " -> New Map" << std::endl;
35  addPadding();
36  }
37  void mapListItem(std::string name) override
38  {
39  std::cout << padding << name << " -> New List" << std::endl;
40  addPadding();
41  }
42  void mapIntItem(std::string name, long i) override
43  {
44  std::cout << padding << name << " -> Int: " << i << std::endl;
45  }
46  void mapFloatItem(std::string name, double d) override
47  {
48  std::cout << padding << name << " -> Float: " << d << std::endl;
49  }
50  void mapStringItem(std::string name, std::string s) override
51  {
52  std::cout << padding << name << " -> String: " << s << std::endl;
53  }
54  void mapEnd() override
55  {
56  removePadding();
57  std::cout << padding << "mapEnd" << std::endl;
58  }
59 
60  void listMapItem() override
61  {
62  std::cout << padding << "New Map" << std::endl;
63  addPadding();
64  }
65  void listListItem() override
66  {
67  std::cout << padding << "New List" << std::endl;
68  addPadding();
69  }
70  void listIntItem(long i) override
71  {
72  std::cout << padding << "Int: " << i << std::endl;
73  }
74  void listFloatItem(double d) override
75  {
76  std::cout << padding << "Float: " << d << std::endl;
77  }
78  void listStringItem(std::string s) override
79  {
80  std::cout << padding << "String: " << s << std::endl;
81  }
82  void listEnd() override
83  {
84  removePadding();
85  std::cout << padding << "listEnd" << std::endl;
86  }
87 
88 protected:
89  void addPadding()
90  {
91  padding += " ";
92  }
93 
94  void removePadding()
95  {
96  padding.erase(padding.end() - 2, padding.end());
97  }
98 
99  std::string padding;
100 };
void mapEnd() override
Ends the currently streamed map.
Definition: tests/Objects/DebugBridge.h:54
void mapStringItem(std::string name, std::string s) override
Adds a string to the currently streamed map.
Definition: tests/Objects/DebugBridge.h:50
Atlas stream bridge.
Definition: Bridge.h:35
void listListItem() override
Starts a list object in the currently streamed list.
Definition: tests/Objects/DebugBridge.h:65
void listFloatItem(double d) override
Adds a float to the currently streamed list.
Definition: tests/Objects/DebugBridge.h:74
void streamEnd() override
Ends the Atlas stream.
Definition: tests/Objects/DebugBridge.h:27
void listEnd() override
Ends the currently streamed list.
Definition: tests/Objects/DebugBridge.h:82
void streamMessage() override
Start a message in an Atlas stream.
Definition: tests/Objects/DebugBridge.h:22
void mapMapItem(std::string name) override
Starts a map object to the currently streamed map.
Definition: tests/Objects/DebugBridge.h:32
void streamBegin() override
Begin an Atlas stream.
Definition: tests/Objects/DebugBridge.h:17
void mapIntItem(std::string name, long i) override
Adds an integer to the currently streames map.
Definition: tests/Objects/DebugBridge.h:42
Definition: tests/Objects/DebugBridge.h:6
void listMapItem() override
Starts a map object in the currently streamed list.
Definition: tests/Objects/DebugBridge.h:60
void listIntItem(long i) override
Adds an integer to the currently streames list.
Definition: tests/Objects/DebugBridge.h:70
void mapListItem(std::string name) override
Starts a list object to the currently streamed map.
Definition: tests/Objects/DebugBridge.h:37
void mapFloatItem(std::string name, double d) override
Adds a float to the currently streamed map.
Definition: tests/Objects/DebugBridge.h:46
void listStringItem(std::string s) override
Adds a string to the currently streamed list.
Definition: tests/Objects/DebugBridge.h:78

Copyright 2000-2004 the respective authors.

This document can be licensed under the terms of the GNU Free Documentation License or the GNU General Public License and may be freely distributed under the terms given by one of these licenses.