7 #include <Atlas/Message/DecoderBase.h> 9 #include <Atlas/Message/Element.h> 11 #include <Atlas/Debug.h> 17 static const bool debug_flag =
false;
19 namespace Atlas {
namespace Message {
21 DecoderBase::DecoderBase() : m_state(), m_maps(), m_lists(), m_names()
25 void DecoderBase::streamBegin()
27 ATLAS_DEBUG(std::cout <<
"DecoderBase::streamBegin" << std::endl)
31 void DecoderBase::streamMessage()
33 ATLAS_DEBUG(std::cout <<
"DecoderBase::streamMessage" << std::endl)
38 void DecoderBase::streamEnd()
40 ATLAS_DEBUG(std::cout <<
"DecoderBase::streamEnd" << std::endl)
45 void DecoderBase::mapMapItem(std::string name)
47 ATLAS_DEBUG(std::cout <<
"DecoderBase::mapMapItem Map" << std::endl)
53 void DecoderBase::mapListItem(std::string name)
55 ATLAS_DEBUG(std::cout <<
"DecoderBase::mapListItem List" << std::endl)
61 void DecoderBase::mapIntItem(std::string name, std::int64_t i)
63 ATLAS_DEBUG(std::cout <<
"DecoderBase::mapIntItem" << std::endl)
65 m_maps.top().emplace(std::move(name), i);
68 void DecoderBase::mapFloatItem(std::string name,
double d)
70 ATLAS_DEBUG(std::cout <<
"DecoderBase::mapFloatItem" << std::endl)
72 m_maps.top().emplace(std::move(name), d);
75 void DecoderBase::mapStringItem(std::string name, std::string s)
77 ATLAS_DEBUG(std::cout <<
"DecoderBase::mapStringItem" << std::endl)
79 m_maps.top().emplace(std::move(name), std::move(s));
82 void DecoderBase::mapNoneItem(std::string name) {
83 ATLAS_DEBUG(std::cout <<
"DecoderBase::mapNoneItem" << std::endl)
88 void DecoderBase::mapEnd()
90 ATLAS_DEBUG(std::cout <<
"DecoderBase::mapEnd" << std::endl)
97 MapType map = std::move(
m_maps.top());
101 m_maps.top().emplace(std::move(
m_names.top()), std::move(map));
127 void DecoderBase::listMapItem()
129 ATLAS_DEBUG(std::cout <<
"DecoderBase::listMapItem" << std::endl)
134 void DecoderBase::listListItem()
136 ATLAS_DEBUG(std::cout <<
"DecoderBase::listListItem" << std::endl)
141 void DecoderBase::listIntItem(std::int64_t i)
143 ATLAS_DEBUG(std::cout <<
"DecoderBase::listIntItem" << std::endl)
148 void DecoderBase::listFloatItem(
double d)
150 ATLAS_DEBUG(std::cout <<
"DecoderBase::listFloatItem" << std::endl)
154 void DecoderBase::listStringItem(std::string s)
156 ATLAS_DEBUG(std::cout <<
"DecoderBase::listStringItem" << std::endl)
158 m_lists.top().emplace_back(std::move(s));
161 void DecoderBase::listNoneItem() {
162 ATLAS_DEBUG(std::cout <<
"DecoderBase::listNoneItem" << std::endl)
167 void DecoderBase::listEnd()
169 ATLAS_DEBUG(std::cout <<
"DecoderBase::listEnd" << std::endl)
183 ListType list = std::move(
m_lists.top());
186 m_lists.top().emplace_back(std::move(list));
190 std::cerr <<
"DecoderBase::listEnd: Error" << std::endl;
std::stack< State > m_state
The state stack.
std::stack< std::string > m_names
Names for maps and lists.
std::stack< ListType > m_lists
The list stack.
std::stack< MapType > m_maps
The map stack.
void messageArrived(Atlas::Message::MapType) override
Overridden by to retrieve the message from DecoderBase.