- Main Page
- Namespaces
- Classes
- Files

- Search for |

# messaging.h

    00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
    00002
    00003 // "messaging.h"
    00004
    00005 // (c) OPAC Team, LIFL, August 2005
    00006
    00007 /* This library is free software; you can redistribute it and/or
    00008    modify it under the terms of the GNU Lesser General Public
    00009    License as published by the Free Software Foundation; either
    00010    version 2 of the License, or (at your option) any later version.
    00011
    00012    This library is distributed in the hope that it will be useful,
    00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015    Lesser General Public License for more details.
    00016
    00017    You should have received a copy of the GNU Lesser General Public
    00018    License along with this library; if not, write to the Free Software
    00019    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    00020
    00021    Contact: paradiseo-help@lists.gforge.inria.fr
    00022 */
    00023
    00024 #ifndef __mess_h
    00025 #define __mess_h
    00026
    00027 #include <utility>
    00028
    00029 /* Char */
    00030 extern void pack (const char & __c);
    00031
    00032 /* Float */
    00033 extern void pack (const float & __f, int __nitem = 1);
    00034
    00035 /* Double */
    00036 extern void pack (const double & __d, int __nitem = 1);
    00037
    00038 /* Integer */
    00039 extern void pack (const int & __i, int __nitem = 1);
    00040
    00041 /* Unsigned int. */
    00042 extern void pack (const unsigned int & __ui, int __nitem = 1);
    00043
    00044 /* Short int. */
    00045 extern void pack (const short & __sh, int __nitem = 1);
    00046
    00047 /* Unsigned short */
    00048 extern void pack (const unsigned short & __ush, int __nitem = 1);
    00049
    00050 /* Long */
    00051 extern void pack (const long & __l, int __nitem = 1);
    00052
    00053 /* Unsigned long */
    00054 extern void pack (const unsigned long & __ul, int __nitem = 1);
    00055
    00056 /* String */
    00057 extern void pack (const char * __str);
    00058
    00059 /* Pointer */
    00060 template <class T> void pack (const T * __ptr) {
    00061
    00062   pack ((unsigned long) __ptr);
    00063 }
    00064
    00065 /* Pair */
    00066 template <class U, class V> void pack (const std :: pair <U, V> & __pair) {
    00067
    00068   pack (__pair.first);
    00069   pack (__pair.second);
    00070 }
    00071
    00072 //
    00073
    00074 /* Float */
    00075 extern void unpack (char & __c);
    00076
    00077 /* Float */
    00078 extern void unpack (float & __f, int __nitem = 1);
    00079
    00080 /* Double */
    00081 extern void unpack (double & __d, int __nitem = 1);
    00082
    00083 /* Integer */
    00084 extern void unpack (int & __i, int __nitem = 1);
    00085
    00086 /* Unsigned int. */
    00087 extern void unpack (unsigned int & __ui, int __nitem = 1);
    00088
    00089 /* Short int. */
    00090 extern void unpack (short & __sh, int __nitem = 1);
    00091
    00092 /* Unsigned short */
    00093 extern void unpack (unsigned short & __ush, int __nitem = 1);
    00094
    00095 /* Long */
    00096 extern void unpack (long & __l, int __nitem = 1);
    00097
    00098 /* Unsigned long */
    00099 extern void unpack (unsigned long & __ul, int __nitem = 1);
    00100
    00101 /* String */
    00102 extern void unpack (char * __str);
    00103
    00104 /* Pointer */
    00105 template <class T> void unpack (T * & __ptr) {
    00106
    00107   unsigned long p;
    00108   unpack (p);
    00109   __ptr = (T *) p;
    00110 }
    00111
    00112 /* Pair */
    00113 template <class U, class V> void unpack (std :: pair <U, V> & __pair) {
    00114
    00115   unpack (__pair.first);
    00116   unpack (__pair.second);
    00117 }
    00118
    00119 #endif