![]() |
|
|||
File indexing completed on 2023-03-17 11:26:54
0001 #ifndef STORAGE_FACTORY_IO_TYPES_H 0002 #define STORAGE_FACTORY_IO_TYPES_H 0003 0004 #include <cstdint> 0005 #include <cstdlib> 0006 0007 namespace edm::storage { 0008 /** Invalid channel descriptor constant. */ 0009 constexpr int EDM_IOFD_INVALID = -1; 0010 0011 /** Type for buffer sizes in I/O operations. It measures units in 0012 memory: buffer sizes, amounts to read and write, etc., and is 0013 unsigned. Never use IOSize to measure file offsets, as it is 0014 most likely smaller than the file offset type on your system! */ 0015 typedef size_t IOSize; 0016 0017 /** Type for file offsets for I/O operations, including file sizes. 0018 This type is always compatible with large files (64-bit offsets) 0019 whether the system supports them or not. This type is signed. */ 0020 typedef int64_t IOOffset; 0021 0022 /** Type the system uses for channel descriptors. */ 0023 typedef int IOFD; 0024 0025 /** I/O operation mask. */ 0026 enum IOMask { 0027 IORead = 0x01, //< Read 0028 IOWrite = 0x02, //< Write 0029 IOUrgent = 0x04, //< Exceptional or urgent condition 0030 IOAccept = 0x08, //< Socket accept 0031 IOConnect = 0x10 //< Socket connect 0032 }; 0033 0034 /** Safely convert IOOffset @a n into a #IOSize quantity. If @a n is 0035 larger than what #IOSize can hold, it is truncated to maximum 0036 value that can be held in #IOSize. */ 0037 inline IOSize IOSized(IOOffset n) { 0038 // If IOSize and IOOffset are the same size, largest positive value 0039 // is half of maximum IOSize. Otherwise all bits of IOSize work. 0040 IOOffset largest = (sizeof(IOOffset) == sizeof(IOSize) ? ~IOSize(0) / 2 : ~IOSize(0)); 0041 return IOSize(n > largest ? largest : n); 0042 } 0043 } // namespace edm::storage 0044 #endif // STORAGE_FACTORY_IO_TYPES_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |
![]() ![]() |