Atlas-C++
|
00001 // This file may be redistributed and modified only under the terms of 00002 // the GNU Lesser General Public License (See COPYING for details). 00003 // Copyright (C) 2000 Stefanus Du Toit 00004 00005 // $Id$ 00006 00007 #ifndef ATLAS_MESSAGE_DECODERBASE_H 00008 #define ATLAS_MESSAGE_DECODERBASE_H 00009 00010 #include <Atlas/Bridge.h> 00011 00012 #include <map> 00013 #include <string> 00014 #include <vector> 00015 #include <stack> 00016 00017 namespace Atlas { namespace Message { 00018 00019 class Element; 00020 00021 typedef std::map<std::string, Element> MapType; 00022 typedef std::vector<Element> ListType; 00023 00024 00040 class DecoderBase : public Bridge 00041 { 00042 public: 00043 DecoderBase(); 00044 00045 virtual ~DecoderBase(); 00046 00047 // Callback functions from Bridge 00048 virtual void streamBegin(); 00049 virtual void streamMessage(); 00050 virtual void streamEnd(); 00051 00052 virtual void mapMapItem(const std::string& name); 00053 virtual void mapListItem(const std::string& name); 00054 virtual void mapIntItem(const std::string& name, long); 00055 virtual void mapFloatItem(const std::string& name, double); 00056 virtual void mapStringItem(const std::string& name, const std::string&); 00057 virtual void mapEnd(); 00058 00059 virtual void listMapItem(); 00060 virtual void listListItem(); 00061 virtual void listIntItem(long); 00062 virtual void listFloatItem(double); 00063 virtual void listStringItem(const std::string&); 00064 virtual void listEnd(); 00065 00066 protected: 00067 00069 enum State { 00070 STATE_STREAM, 00071 STATE_MAP, 00072 STATE_LIST 00073 }; 00074 00076 std::stack<State> m_state; 00078 std::stack<MapType> m_maps; 00080 std::stack<ListType> m_lists; 00082 std::stack<std::string> m_names; 00083 00085 virtual void messageArrived(const MapType& obj) = 0; 00086 }; 00087 00088 } } // namespace Atlas::Message 00089 00090 #endif
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.