Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

DecoderBase.h

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 #ifndef ATLAS_MESSAGE_DECODERBASE_H
00006 #define ATLAS_MESSAGE_DECODERBASE_H
00007 
00008 #include <stack>
00009 #include <Atlas/Bridge.h>
00010 #include <Atlas/Message/Object.h>
00011 
00012 namespace Atlas { namespace Message {
00013 
00029 class DecoderBase : public Bridge
00030 {
00031 public:
00032     DecoderBase();
00033 
00034     virtual ~DecoderBase() {}
00035 
00036     // Callback functions from Bridge
00037     virtual void StreamBegin();
00038     virtual void StreamMessage(const Map&);
00039     virtual void StreamEnd();
00040 
00041     virtual void MapItem(const std::string& name, const Map&);
00042     virtual void MapItem(const std::string& name, const List&);
00043     virtual void MapItem(const std::string& name, long);
00044     virtual void MapItem(const std::string& name, double);
00045     virtual void MapItem(const std::string& name, const std::string&);
00046     virtual void MapEnd();
00047     
00048     virtual void ListItem(const Map&);
00049     virtual void ListItem(const List&);
00050     virtual void ListItem(long);
00051     virtual void ListItem(double);
00052     virtual void ListItem(const std::string&);
00053     virtual void ListEnd();
00054     
00055 protected:
00056 
00058     enum State {
00059         STATE_STREAM,
00060         STATE_MAP,
00061         STATE_LIST
00062     };
00063 
00065     std::stack<State> state;
00067     std::stack<Object::MapType> maps;
00069     std::stack<Object::ListType> lists;
00071     std::stack<std::string> names;
00072 
00074     virtual void ObjectArrived(const Object& obj) = 0;
00075 };
00076 
00077 } } // namespace Atlas::Message
00078 
00079 #endif

Copyright 2000 the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.