Main Page   Class Hierarchy   Compound List   File List   Compound Members  

integer_t.hpp

00001 /*
00002  *  This program is free software; you can redistribute it and/or modify
00003  *  it under the terms of the GNU General Public License as published by
00004  *  the Free Software Foundation; either version 2 of the License, or
00005  *  (at your option) any later version.
00006  *
00007  *  This program is distributed in the hope that it will be useful,
00008  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  *  GNU General Public License for more details.
00011  *
00012  *  You should have received a copy of the GNU General Public License
00013  *  along with this program; if not, write to the Free Software
00014  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00015  *
00016  * (c)Copyright 2006 Hewlett-Packard Development Company, LP.
00017  *
00018  */
00019 
00020 #ifndef _INTEGER_T_HPP
00021 #define _INTEGER_T_HPP
00022 
00023 // For strtoul and strtol define
00024 #include <stdlib.h>
00025 
00026 // For byte order resolution
00027 #include <sys/param.h>
00028 
00029 // Special HP-UX resolution
00030 #if defined (__hpux)
00031 #if defined (__hppa)
00032 #ifndef BYTE_ORDER
00033 #define BYTE_ORDER BIG_ENDIAN
00034 #endif
00035 #elif defined(__ia64)
00036 #ifndef BYTE_ORDER
00037 #define BYTE_ORDER LITTLE_ENDIAN
00038 #endif
00039 #endif
00040 #endif
00041 
00042 
00043 // For max long size definition
00044 #include <limits.h>
00045 
00046 // For ntohl and htonl definition
00047 #if defined(__hpux)
00048 #include <arpa/inet.h>
00049 #else
00050 #include <netinet/in.h>
00051 #endif
00052 
00053 // Define the Integer 64 bits and Unsigned Integer 64 bits types 
00054 // depending on platform capability
00055 #if LONG_LONG_MAX<9223372036854775807LL
00056 #error "long long type definition is not 64 bits"
00057 #else
00058 
00059 // long long is coded on 8 bytes use it for Integer64 types
00060 typedef unsigned long long T_UnsignedInteger64, *T_pUnsignedInteger64;
00061 typedef long long          T_Integer64, *T_pInteger64;
00062 
00063 #define strtoull_f strtoull
00064 #define strtoll_f  strtoll
00065 
00066 #define ntohll_f ntohll
00067 #define htonll_f htonll
00068 
00069 #endif // LONG_LONG_MAX
00070 
00071 // Define the Integer 32bits and Unsigned Integer 32bits  types
00072 typedef unsigned long T_UnsignedInteger32, *T_pUnsignedInteger32;
00073 typedef long          T_Integer32, *T_pInteger32;
00074 
00075 // Check the size of long type
00076 #if LONG_MAX==9223372036854775807L
00077 // long is coded on 8 bytes 
00078 #define strtoul_f strtoull
00079 #define strtol_f  strtoll
00080 
00081 #define ntohl_f ntohll
00082 #define htonl_f htonll
00083 
00084 #else
00085 // long is coded on 4 bytes 
00086 #define strtoul_f strtoul
00087 #define strtol_f  strtol
00088 
00089 #define ntohl_f ntohl
00090 #define htonl_f htonl
00091 
00092 #endif // LONG_MAX
00093 
00094 // Define the ntoh and hton function for long long type
00095 T_UnsignedInteger64 ntohll(T_UnsignedInteger64 P_val);
00096 T_UnsignedInteger64 htonll(T_UnsignedInteger64 P_val);
00097 
00098 #if defined(__hpux)
00099 #include "iostream_t.hpp"
00100 
00101 // Check the strtoll and strtoull implemenation
00102 #ifndef strtoull
00103 unsigned long long int strtoull(const char *P_nPtr, char **P_endPtr, int P_base);
00104 
00105 iostream_output& operator<<(iostream_output&    P_ostream,
00106                             unsigned long long& P_value);
00107 #endif
00108 
00109 #ifndef strtoll
00110 long long int strtoll(const char *P_nPtr, char **P_endPtr, int P_base);
00111 
00112 iostream_output& operator<<(iostream_output&    P_ostream,
00113                             long long&          P_value);
00114 #endif
00115 
00116 #endif // defined(__hpux)
00117 
00118 
00119 #endif // _INTEGER_T_HPP

Generated on Wed Mar 7 14:44:59 2007 for Seagull by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002