/home/andreas/src/svn/mapnik/include/mapnik/global.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * 
00003  * This file is part of Mapnik (c++ mapping toolkit)
00004  *
00005  * Copyright (C) 2006 Artem Pavlenko
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.1 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020  *
00021  *****************************************************************************/
00022 
00023 //$Id$
00024 
00025 #ifndef GLOBAL_HPP
00026 #define GLOBAL_HPP
00027 
00028 #include <boost/cstdint.hpp>
00029 
00030 namespace mapnik
00031 {
00032   using boost::int32_t;
00033   using boost::uint8_t;
00034   
00035 #define int2net(A)  (int32_t) (((uint32_t) ((uint8_t) (A)[1]))      |   \
00036                                (((uint32_t) ((uint8_t) (A)[0])) << 8))
00037 
00038 #define int4net(A)  (int32_t) (((uint32_t) ((uint8_t) (A)[3]))      |   \
00039                                (((uint32_t) ((uint8_t) (A)[2])) << 8)  | \
00040                                (((uint32_t) ((uint8_t) (A)[1])) << 16) | \
00041                                (((uint32_t) ((uint8_t) (A)[0])) << 24))
00042 
00043 
00044     typedef char byte;
00045 #define float8net(V,M)   do { double def_temp;  \
00046         ((byte*) &def_temp)[0]=(M)[7];          \
00047         ((byte*) &def_temp)[1]=(M)[6];          \
00048         ((byte*) &def_temp)[2]=(M)[5];          \
00049         ((byte*) &def_temp)[3]=(M)[4];          \
00050         ((byte*) &def_temp)[4]=(M)[3];          \
00051         ((byte*) &def_temp)[5]=(M)[2];          \
00052         ((byte*) &def_temp)[6]=(M)[1];          \
00053         ((byte*) &def_temp)[7]=(M)[0];          \
00054         (V) = def_temp; } while(0)
00055 #define float4net(V,M)   do { float def_temp;   \
00056         ((byte*) &def_temp)[0]=(M)[3];          \
00057         ((byte*) &def_temp)[1]=(M)[2];          \
00058         ((byte*) &def_temp)[2]=(M)[1];          \
00059         ((byte*) &def_temp)[3]=(M)[0];          \
00060         (V)=def_temp; } while(0)
00061 }
00062 
00063 #endif //GLOBAL_HPP

Generated on Thu Jul 19 17:59:26 2007 for Mapnik by  doxygen 1.4.7