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