OWBI1_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 OWBI1_TYPES_HPP_INCLUDE_GUARD_
00037 #define OWBI1_TYPES_HPP_INCLUDE_GUARD_
00038 #include "OWBI1_config.h"
00039 
00040 #ifndef __cplusplus
00041 #error "OWBI1_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 OWBI1
00050 {
00051 
00052 typedef unsigned char               UInt8;
00053 typedef signed char                 Int8;
00054 #if OWBI1_SIZEOF_SHORT_INT == 2
00055 typedef unsigned short              UInt16;
00056 typedef short                 Int16;
00057 #define OWBI1_INT16_IS_SHORT 1
00058 #elif OWBI1_SIZEOF_INT == 2
00059 typedef unsigned int             UInt16;
00060 typedef int                      Int16;
00061 #define OWBI1_INT16_IS_INT 1
00062 #endif
00063 #if OWBI1_SIZEOF_INT == 4
00064 typedef unsigned int                UInt32;
00065 typedef int                   Int32;
00066 #define OWBI1_INT32_IS_INT 1
00067 #elif OWBI1_SIZEOF_LONG_INT == 4
00068 typedef unsigned long            UInt32;
00069 typedef long                     Int32;
00070 #define OWBI1_INT32_IS_LONG 1
00071 #endif
00072 #if OWBI1_SIZEOF_LONG_INT == 8
00073 typedef unsigned long   UInt64;
00074 typedef long    Int64;
00075 #define OWBI1_INT64_IS_LONG 1
00076 #elif OWBI1_SIZEOF_LONG_LONG_INT == 8
00077 typedef unsigned long long          UInt64;
00078 typedef long long             Int64;
00079 #define OWBI1_INT64_IS_LONG_LONG 1
00080 #else
00081 #error "Compiler must support 64 bit long"
00082 #endif
00083 #if OWBI1_SIZEOF_DOUBLE == 8
00084 typedef double                Real64;
00085 #define OWBI1_REAL64_IS_DOUBLE 1
00086 #elif OWBI1_SIZEOF_LONG_DOUBLE == 8
00087 typedef long double              Real64;
00088 #define OWBI1_REAL64_IS_LONG_DOUBLE 1
00089 #endif
00090 #if OWBI1_SIZEOF_FLOAT == 4
00091 typedef float                 Real32;
00092 #define OWBI1_REAL32_IS_FLOAT 1
00093 #elif OWBI1_SIZEOF_DOUBLE == 4
00094 typedef double                Real32;
00095 #define OWBI1_REAL32_IS_DOUBLE 1
00096 #endif
00097 typedef off_t  off_t;
00098 
00099 #ifdef OWBI1_WIN32
00100 
00101 #define OWBI1_SHAREDLIB_EXTENSION ".dll"
00102 #define OWBI1_FILENAME_SEPARATOR "\\"
00103 #define OWBI1_FILENAME_SEPARATOR_C '\\'
00104 #define OWBI1_PATHNAME_SEPARATOR ";"
00105 // OWBI1_Select_t is the type of object that can be used in
00106 // synchronous I/O multiplexing (i.e. select).
00107 struct Select_t
00108 {
00109    Select_t() 
00110       : event(NULL)
00111       , sockfd(INVALID_SOCKET)
00112       , networkevents(0)
00113       , doreset(false)
00114    {
00115    }
00116 
00117    Select_t(const Select_t& arg)
00118       : event(arg.event)
00119       , sockfd(arg.sockfd)
00120       , networkevents(arg.networkevents)
00121       , doreset(arg.doreset)
00122    {
00123    }
00124    
00125    HANDLE event;
00126    SOCKET sockfd;
00127    long networkevents;
00128    bool doreset;
00129 };
00130 
00131 //typedef HANDLE Select_t;
00132 #else
00133 // Select_t is the type of object that can be used in
00134 // synchronous I/O multiplexing (i.e. select). There is a
00135 // possibility this can be something other than an int on
00136 // a platform we don't yet support.
00137 typedef int Select_t;
00138 
00139 #if defined OWBI1_DARWIN
00140 #define OWBI1_SHAREDLIB_EXTENSION ".dylib"
00141 #elif defined OWBI1_HPUX
00142 #define OWBI1_SHAREDLIB_EXTENSION ".sl"
00143 #elif defined OWBI1_NETWARE
00144 #define OWBI1_SHAREDLIB_EXTENSION ".nlm"
00145 #else
00146 #define OWBI1_SHAREDLIB_EXTENSION ".so"
00147 #endif
00148 #define OWBI1_FILENAME_SEPARATOR "/"
00149 #define OWBI1_FILENAME_SEPARATOR_C '/'
00150 #define OWBI1_PATHNAME_SEPARATOR ":"
00151 #endif
00152 
00153 #ifdef OWBI1_WIN32
00154 typedef HANDLE FileHandle;
00155 #define OWBI1_INVALID_FILEHANDLE INVALID_HANDLE_VALUE
00156 typedef int UserId;
00157 typedef int uid_t;
00158 typedef DWORD ProcId;
00159 #else
00160 typedef int FileHandle;
00161 #define OWBI1_INVALID_FILEHANDLE -1
00162 typedef uid_t UserId;
00163 typedef pid_t ProcId;
00164 #endif
00165 
00166 } // end namespace OWBI1
00167 
00168 #endif

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