Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Types.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * Copyright (C) 2004 Vintela, Inc. All rights reserved.
00003 * Copyright (C) 2005 Novell, Inc. All rights reserved.
00004 *
00005 * Redistribution and use in source and binary forms, with or without
00006 * modification, are permitted provided that the following conditions are met:
00007 *
00008 *  - Redistributions of source code must retain the above copyright notice,
00009 *    this list of conditions and the following disclaimer.
00010 *
00011 *  - Redistributions in binary form must reproduce the above copyright notice,
00012 *    this list of conditions and the following disclaimer in the documentation
00013 *    and/or other materials provided with the distribution.
00014 *
00015 *  - Neither the name of Vintela, Inc., Novell, Inc., nor the names of its
00016 *    contributors may be used to endorse or promote products derived from this
00017 *    software without specific prior written permission.
00018 *
00019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022 * ARE DISCLAIMED. IN NO EVENT SHALL Vintela, Inc., Novell, Inc., OR THE 
00023 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
00024 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
00025 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
00026 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
00027 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
00028 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
00029 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030 *******************************************************************************/
00031 
00032 
00038 #ifndef BLOCXX_TYPES_HPP_INCLUDE_GUARD_
00039 #define BLOCXX_TYPES_HPP_INCLUDE_GUARD_
00040 #include "blocxx/BLOCXX_config.h"
00041 
00042 #ifndef __cplusplus
00043 #error "BLOCXX_Types.hpp can only be included by c++ files"
00044 #endif
00045 
00046 extern "C"
00047 {
00048 #include <sys/types.h>
00049 }
00050 
00051 namespace BLOCXX_NAMESPACE
00052 {
00053 
00054 typedef unsigned char               UInt8;
00055 typedef signed char                 Int8;
00056 #if BLOCXX_SIZEOF_SHORT_INT == 2
00057 typedef unsigned short              UInt16;
00058 typedef short                 Int16;
00059 #define BLOCXX_INT16_IS_SHORT 1
00060 #elif BLOCXX_SIZEOF_INT == 2
00061 typedef unsigned int             UInt16;
00062 typedef int                      Int16;
00063 #define BLOCXX_INT16_IS_INT 1
00064 #endif
00065 #if BLOCXX_SIZEOF_INT == 4
00066 typedef unsigned int                UInt32;
00067 typedef int                   Int32;
00068 #define BLOCXX_INT32_IS_INT 1
00069 #elif BLOCXX_SIZEOF_LONG_INT == 4
00070 typedef unsigned long            UInt32;
00071 typedef long                     Int32;
00072 #define BLOCXX_INT32_IS_LONG 1
00073 #endif
00074 #if BLOCXX_SIZEOF_LONG_INT == 8
00075 typedef unsigned long   UInt64;
00076 typedef long    Int64;
00077 #define BLOCXX_INT64_IS_LONG 1
00078 #elif BLOCXX_SIZEOF_LONG_LONG_INT == 8
00079 typedef unsigned long long          UInt64;
00080 typedef long long             Int64;
00081 #define BLOCXX_INT64_IS_LONG_LONG 1
00082 #else
00083 #error "Compiler must support 64 bit long"
00084 #endif
00085 #if BLOCXX_SIZEOF_DOUBLE == 8
00086 typedef double                Real64;
00087 #define BLOCXX_REAL64_IS_DOUBLE 1
00088 #elif BLOCXX_SIZEOF_LONG_DOUBLE == 8
00089 typedef long double              Real64;
00090 #define BLOCXX_REAL64_IS_LONG_DOUBLE 1
00091 #endif
00092 #if BLOCXX_SIZEOF_FLOAT == 4
00093 typedef float                 Real32;
00094 #define BLOCXX_REAL32_IS_FLOAT 1
00095 #elif BLOCXX_SIZEOF_DOUBLE == 4
00096 typedef double                Real32;
00097 #define BLOCXX_REAL32_IS_DOUBLE 1
00098 #endif
00099 typedef off_t  off_t;
00100 
00101 #ifdef BLOCXX_WIN32
00102 
00103 #define BLOCXX_SHAREDLIB_EXTENSION ".dll"
00104 #define BLOCXX_FILENAME_SEPARATOR "\\"
00105 #define BLOCXX_FILENAME_SEPARATOR_C '\\'
00106 #define BLOCXX_PATHNAME_SEPARATOR ";"
00107 
00108 #if __MINGW32__
00109 //
00110 // FIXME: I can't believe that this is MinGW specific,
00111 //        but this is the place where HANDLE and SOCKET
00112 //        types are defined...
00113 //
00114 #include <windef.h>
00115 #include <winsock2.h>
00116 #endif
00117 
00118 // BLOCXX_Select_t is the type of object that can be used in
00119 // synchronous I/O multiplexing (i.e. select).
00120 struct Select_t
00121 {
00122    Select_t() 
00123       : event(NULL)
00124       , sockfd(INVALID_SOCKET)
00125       , networkevents(0)
00126       , doreset(false)
00127    {
00128    }
00129 
00130    Select_t(const Select_t& arg)
00131       : event(arg.event)
00132       , sockfd(arg.sockfd)
00133       , networkevents(arg.networkevents)
00134       , doreset(arg.doreset)
00135    {
00136    }
00137    
00138    HANDLE event;
00139    SOCKET sockfd;
00140    long networkevents;
00141    bool doreset;
00142 };
00143 
00144 //typedef HANDLE Select_t;
00145 #else
00146 // Select_t is the type of object that can be used in
00147 // synchronous I/O multiplexing (i.e. select). There is a
00148 // possibility this can be something other than an int on
00149 // a platform we don't yet support.
00150 typedef int Select_t;
00151 
00152 #if defined BLOCXX_DARWIN
00153 #define BLOCXX_SHAREDLIB_EXTENSION ".dylib"
00154 #elif defined BLOCXX_HPUX
00155 #define BLOCXX_SHAREDLIB_EXTENSION ".sl"
00156 #elif defined BLOCXX_NETWARE
00157 #define BLOCXX_SHAREDLIB_EXTENSION ".nlm"
00158 #else
00159 #define BLOCXX_SHAREDLIB_EXTENSION ".so"
00160 #endif
00161 #define BLOCXX_FILENAME_SEPARATOR "/"
00162 #define BLOCXX_FILENAME_SEPARATOR_C '/'
00163 #define BLOCXX_PATHNAME_SEPARATOR ":"
00164 #endif
00165 
00166 #ifdef BLOCXX_WIN32
00167 typedef HANDLE FileHandle;
00168 #define BLOCXX_INVALID_FILEHANDLE INVALID_HANDLE_VALUE
00169 typedef int UserId;
00170 typedef int uid_t;
00171 typedef DWORD pid_t;
00172 typedef DWORD ProcId;
00173 typedef struct {} siginfo_t;
00174 #else
00175 typedef int FileHandle;
00176 #define BLOCXX_INVALID_FILEHANDLE -1
00177 typedef uid_t UserId;
00178 typedef pid_t ProcId;
00179 #endif
00180 
00181 } // end namespace BLOCXX_NAMESPACE
00182 
00183 #endif

Generated on Mon Sep 12 23:56:37 2005 for blocxx by  doxygen 1.4.4