TOBI Interface A  0.1
/home/breidi/Dropbox/libtia/include/tia-private/config/control_message_encoder.h
Go to the documentation of this file.
00001 /*
00002     This file is part of the TOBI Interface A (TiA) library.
00003 
00004     Commercial Usage
00005     Licensees holding valid Graz University of Technology Commercial
00006     licenses may use this file in accordance with the Graz University
00007     of Technology Commercial License Agreement provided with the
00008     Software or, alternatively, in accordance with the terms contained in
00009     a written agreement between you and Graz University of Technology.
00010 
00011     --------------------------------------------------
00012 
00013     GNU Lesser General Public License Usage
00014     Alternatively, this file may be used under the terms of the GNU Lesser
00015     General Public License version 3.0 as published by the Free Software
00016     Foundation and appearing in the file lgpl.txt included in the
00017     packaging of this file.  Please review the following information to
00018     ensure the GNU General Public License version 3.0 requirements will be
00019     met: http://www.gnu.org/copyleft/lgpl.html.
00020 
00021     In case of GNU Lesser General Public License Usage ,the TiA library
00022     is distributed in the hope that it will be useful,
00023     but WITHOUT ANY WARRANTY; without even the implied warranty of
00024     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00025     GNU General Public License for more details.
00026 
00027     You should have received a copy of the GNU Lesser General Public License
00028     along with the TiA library. If not, see <http://www.gnu.org/licenses/>.
00029 
00030     Copyright 2010 Graz University of Technology
00031     Contact: TiA@tobi-project.org
00032 */
00033 
00040 #ifndef CONTROLMESSAGEENCODER_H
00041 #define CONTROLMESSAGEENCODER_H
00042 
00043 // Standard
00044 #include <assert.h>
00045 #include <iostream>
00046 
00047 // boost
00048 #include <boost/cstdint.hpp>
00049 
00050 // local external
00051 #include "ticpp/tinyxml.h"
00052 
00053 // local
00054 #include "control_messages.h"
00055 
00056 namespace tia
00057 {
00058 //-----------------------------------------------------------------------------
00059 
00064 class ControlMsgEncoder
00065 {
00066 public:
00070   ControlMsgEncoder() {}
00074   virtual ~ControlMsgEncoder(){}
00075 
00077   virtual void encodeMsg(const KeepAliveMsg& msg, std::ostream& stream) = 0;
00078 
00080   virtual void encodeMsg(const GetConfigMsg& msg, std::ostream& stream) = 0;
00081 
00083   virtual void encodeMsg(const GetDataConnectionMsg& msg, std::ostream& stream) = 0;
00084 
00086   virtual void encodeMsg(const DataConnectionMsg& msg, std::ostream& stream) = 0;
00087 
00089   virtual void encodeMsg(const StartTransmissionMsg& msg, std::ostream& stream) = 0;
00090 
00092   virtual void encodeMsg(const StopTransmissionMsg& msg, std::ostream& stream) = 0;
00093 
00095   virtual void encodeMsg(const ConfigMsg& msg, std::ostream& stream) = 0;
00096 
00098   virtual void encodeMsg(const ReplyMsg& msg, std::ostream& stream) = 0;
00099 };
00100 
00101 //-----------------------------------------------------------------------------
00102 
00107 class ControlMsgEncoderXML : public ControlMsgEncoder
00108 {
00109 public:
00111   virtual void encodeMsg(const KeepAliveMsg& msg, std::ostream& stream);
00113   virtual void encodeMsg(const GetConfigMsg& msg, std::ostream& stream);
00115   virtual void encodeMsg(const GetDataConnectionMsg& msg, std::ostream& stream);
00117   virtual void encodeMsg(const DataConnectionMsg& msg, std::ostream& stream);
00119   virtual void encodeMsg(const StartTransmissionMsg& msg, std::ostream& stream);
00121   virtual void encodeMsg(const StopTransmissionMsg& msg, std::ostream& stream);
00123   virtual void encodeMsg(const ConfigMsg& msg, std::ostream& stream);
00125   virtual void encodeMsg(const ReplyMsg& msg, std::ostream& stream);
00126 
00127 protected:
00129   void encodeBaseMsg(const ControlMsg& msg, const std::string& xml_msg_type,
00130       TiXmlDocument& doc, TiXmlElement*& xml_msg);
00131 
00133   void writeXMLMsg(TiXmlDocument& doc, std::ostream& stream);
00134 };
00135 
00136 //-----------------------------------------------------------------------------
00137 
00138 } // namespace tobiss
00139 
00140 #endif //CONTROLMESSAGEENCODER_H
00141 
00142 // End Of File
 All Data Structures Files Functions Variables Typedefs Enumerations