ESyS-Particle  4.0.1
packed_message_interface.h
00001 
00002 //                                                         //
00003 // Copyright (c) 2003-2011 by The University of Queensland //
00004 // Earth Systems Science Computational Centre (ESSCC)      //
00005 // http://www.uq.edu.au/esscc                              //
00006 //                                                         //
00007 // Primary Business: Brisbane, Queensland, Australia       //
00008 // Licensed under the Open Software License version 3.0    //
00009 // http://www.opensource.org/licenses/osl-3.0.php          //
00010 //                                                         //
00012 
00013 #ifndef __PACKED_MESSAGE_INTERFACE_H
00014 #define __PACKED_MESSAGE_INTERFACE_H
00015 
00016 //--- project includes ---
00017 #include "Foundation/vec3.h" // for append(Vec3), pop_vec3()
00018 
00019 //--- STL includes ---
00020 #include <string>
00021 using std::string;
00022 
00028 class TML_PackedMessageInterface
00029 {
00030  public:
00031   virtual void begin_pack()=0;
00032   virtual void begin_unpack()=0;
00033   virtual void append(int)=0; 
00034   virtual void append(double)=0; 
00035   virtual void append(const string&)=0;
00036   virtual void append(const Vec3&)=0;
00037   virtual void append(bool)=0;
00038 
00039   virtual int pop_int()=0;
00040   virtual double pop_double()=0;
00041   virtual void pop_doubles(double*,int)=0;
00042   virtual string pop_string()=0;
00043   virtual Vec3 pop_vec3()=0;
00044   virtual bool pop_bool()=0;
00045 
00046   template<typename T> void pack(const T&);
00047   template<typename T> void unpack(T&);
00048 };
00049 
00050 #endif //__PACKED_MESSAGE_INTERFACE_H