OW_Types.hpp

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

Generated on Thu Feb 9 08:48:17 2006 for openwbem by  doxygen 1.4.6