ccommbuffer.h

00001 //=========================================================================
00002 //  CCOMMBUFFER.H - part of
00003 //
00004 //                  OMNeT++/OMNEST
00005 //           Discrete System Simulation in C++
00006 //
00007 //  Author: Andras Varga, 2003
00008 //          Dept. of Electrical and Computer Systems Engineering,
00009 //          Monash University, Melbourne, Australia
00010 //
00011 //=========================================================================
00012 
00013 /*--------------------------------------------------------------*
00014   Copyright (C) 2003-2008 Andras Varga
00015   Copyright (C) 2006-2008 OpenSim Ltd.
00016 
00017   This file is distributed WITHOUT ANY WARRANTY. See the file
00018   `license' for details on this and other legal matters.
00019 *--------------------------------------------------------------*/
00020 
00021 #ifndef __CCOMMBUFFER_H
00022 #define __CCOMMBUFFER_H
00023 
00024 #include "cobject.h"
00025 #include "simtime.h"
00026 #include "platdep/intxtypes.h"
00027 
00028 NAMESPACE_BEGIN
00029 
00030 // forward declaration:
00031 class cCommBuffer;
00032 class cOwnedObject;
00033 class opp_string;
00034 
00035 
00048 class SIM_API cCommBuffer : public cObject
00049 {
00050   public:
00054     virtual ~cCommBuffer() {}
00055 
00063     virtual bool isBufferEmpty() const = 0;
00064 
00070     virtual void assertBufferEmpty() = 0;
00072 
00078     virtual void pack(char d) = 0;
00082     virtual void pack(unsigned char d) = 0;
00086     virtual void pack(bool d) = 0;
00090     virtual void pack(short d) = 0;
00094     virtual void pack(unsigned short d) = 0;
00098     virtual void pack(int d) = 0;
00102     virtual void pack(unsigned int d) = 0;
00106     virtual void pack(long d) = 0;
00110     virtual void pack(unsigned long d) = 0;
00114     virtual void pack(opp_long_long d) = 0;
00118     virtual void pack(opp_unsigned_long_long d) = 0;
00122     virtual void pack(float d) = 0;
00126     virtual void pack(double d) = 0;
00130     virtual void pack(long double d) = 0;
00134     virtual void pack(const char *d) = 0;
00138     virtual void pack(const opp_string& d) = 0;
00142     virtual void pack(SimTime d) = 0;
00144 
00150     virtual void pack(const char *d,  int size) = 0;
00154     virtual void pack(const unsigned char *d,  int size) = 0;
00158     virtual void pack(const bool *d, int size) = 0;
00162     virtual void pack(const short *d, int size) = 0;
00166     virtual void pack(const unsigned short *d, int size) = 0;
00170     virtual void pack(const int *d, int size) = 0;
00174     virtual void pack(const unsigned int *d, int size) = 0;
00178     virtual void pack(const long *d, int size) = 0;
00182     virtual void pack(const unsigned long *d, int size) = 0;
00186     virtual void pack(const opp_long_long *d, int size) = 0;
00190     virtual void pack(const opp_unsigned_long_long *d, int size) = 0;
00194     virtual void pack(const float *d, int size) = 0;
00198     virtual void pack(const double *d, int size) = 0;
00202     virtual void pack(const long double *d, int size) = 0;
00206     void pack(char **d, int size)  {pack((const char **)d,size);}
00210     virtual void pack(const char **d, int size) = 0;
00214     virtual void pack(const opp_string *d, int size) = 0;
00218     virtual void pack(const SimTime *d, int size) = 0;
00220 
00226     virtual void unpack(char& d) = 0;
00230     virtual void unpack(unsigned char& d) = 0;
00234     virtual void unpack(bool& d) = 0;
00238     virtual void unpack(short& d) = 0;
00242     virtual void unpack(unsigned short& d) = 0;
00246     virtual void unpack(int& d) = 0;
00250     virtual void unpack(unsigned int& d) = 0;
00254     virtual void unpack(long& d) = 0;
00258     virtual void unpack(unsigned long& d) = 0;
00262     virtual void unpack(opp_long_long& d) = 0;
00266     virtual void unpack(opp_unsigned_long_long& d) = 0;
00270     virtual void unpack(float& d) = 0;
00274     virtual void unpack(double& d) = 0;
00278     virtual void unpack(long double& d) = 0;
00282     void unpack(char *&d)  {unpack((const char *&)d);}
00286     virtual void unpack(const char *&d) = 0;
00290     virtual void unpack(opp_string& d) = 0;
00294     virtual void unpack(SimTime& d) = 0;
00296 
00302     virtual void unpack(char *d, int size) = 0;
00306     virtual void unpack(unsigned char *d, int size) = 0;
00310     virtual void unpack(bool *d, int size) = 0;
00314     virtual void unpack(short *d, int size) = 0;
00318     virtual void unpack(unsigned short *d, int size) = 0;
00322     virtual void unpack(int *d, int size) = 0;
00326     virtual void unpack(unsigned int *d, int size) = 0;
00330     virtual void unpack(long *d, int size) = 0;
00334     virtual void unpack(unsigned long *d, int size) = 0;
00338     virtual void unpack(opp_long_long *d, int size) = 0;
00342     virtual void unpack(opp_unsigned_long_long *d, int size) = 0;
00346     virtual void unpack(float *d, int size) = 0;
00350     virtual void unpack(double *d, int size) = 0;
00354     virtual void unpack(long double *d, int size) = 0;
00358     void unpack(char **d, int size)  {unpack((const char **)d,size);}
00362     virtual void unpack(const char **d, int size) = 0;
00366     virtual void unpack(opp_string *d, int size) = 0;
00370     virtual void unpack(SimTime *d, int size) = 0;
00372 
00378     bool packFlag(bool flag)  {pack(flag); return flag;}
00379 
00383     bool checkFlag() {bool flag; unpack(flag); return flag;}
00384 
00388     virtual void packObject(cObject *obj);
00389 
00393     virtual cObject *unpackObject();
00395 };
00396 
00397 NAMESPACE_END
00398 
00399 #endif
00400 
Generated on Tue Dec 2 11:16:27 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3