CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Macros | Typedefs | Enumerations | Functions
IOTypes.h File Reference
#include <stdint.h>
#include <stdlib.h>

Go to the source code of this file.

Macros

#define EDM_IOFD_INVALID   -1
 

Typedefs

typedef int IOFD
 
typedef int64_t IOOffset
 
typedef size_t IOSize
 

Enumerations

enum  IOMask {
  IORead = 0x01, IOWrite = 0x02, IOUrgent = 0x04, IOAccept = 0x08,
  IOConnect = 0x10
}
 

Functions

IOSize IOSized (IOOffset n)
 

Macro Definition Documentation

#define EDM_IOFD_INVALID   -1

Typedef Documentation

typedef int IOFD

Type the system uses for channel descriptors.

Definition at line 22 of file IOTypes.h.

typedef int64_t IOOffset

Type for file offsets for I/O operations, including file sizes. This type is always compatible with large files (64-bit offsets) whether the system supports them or not. This type is signed.

Definition at line 19 of file IOTypes.h.

typedef size_t IOSize

Type for buffer sizes in I/O operations. It measures units in memory: buffer sizes, amounts to read and write, etc., and is unsigned. Never use IOSize to measure file offsets, as it is most likely smaller than the file offset type on your system!

Definition at line 14 of file IOTypes.h.

Enumeration Type Documentation

enum IOMask

I/O operation mask.

Enumerator
IORead 
IOWrite 
IOUrgent 
IOAccept 
IOConnect 

Definition at line 25 of file IOTypes.h.

25  {
26  IORead = 0x01, //< Read
27  IOWrite = 0x02, //< Write
28  IOUrgent = 0x04, //< Exceptional or urgent condition
29  IOAccept = 0x08, //< Socket accept
30  IOConnect = 0x10 //< Socket connect
31 };
Definition: IOTypes.h:26

Function Documentation

IOSize IOSized ( IOOffset  n)
inline

Safely convert IOOffset n into a IOSize quantity. If n is larger than what IOSize can hold, it is truncated to maximum value that can be held in IOSize.

Definition at line 37 of file IOTypes.h.

38 {
39  // If IOSize and IOOffset are the same size, largest positive value
40  // is half of maximum IOSize. Otherwise all bits of IOSize work.
41  IOOffset largest = (sizeof (IOOffset) == sizeof (IOSize)
42  ? ~IOSize(0)/2 : ~IOSize(0));
43  return IOSize (n > largest ? largest : n);
44 }
int64_t IOOffset
Definition: IOTypes.h:19
size_t IOSize
Definition: IOTypes.h:14