FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
OMEioObjects.h
Go to the documentation of this file.
1 #ifndef _OME_IO_OBJECTS_H
2 #define _OME_IO_OBJECTS_H "$Id: OMEioObjects.h 357 2020-06-18 23:13:25Z geoff $"
4 
6 #ifdef _WIN32
7 #include <winsock2.h>
8 #endif
9 
10 #include <OMEioEvents.h>
11 
18 struct OMEioVector {
19  unsigned char *data;
20  size_t length;
21 };
22 
23 
27 public:
33 
34 static OMEioDescriptor *openIOscheme(const char *name, uint32_t openMode);
35 
36  uint64_t ioHandle;
38 
39  OMEioDescriptor(uint64_t handle, OMEioEvent::OMEfileType type);
40 
41  virtual ~OMEioDescriptor();
42 
43 #ifdef _WIN32
44  /* this only needs to be virtual on Windows to deal with
45  * WSAEVENT being the actual selectable object, rather than
46  * the file descriptor.
47  */
48  virtual uint64_t getSelectHandle() const
49 #else
51 #endif
52  {
53  return (ioHandle);
54  }
55 
56  virtual int readBytes(unsigned char *bfr, size_t bytes, size_t *actualBytes,
57  int *errRet) = 0;
58 
59  virtual int writeBytes(const unsigned char *bfr, size_t bytes, size_t *actualBytes,
60  int *errRet) = 0;
61 
62  // implemented as a sequence of writeBytes for subclass that can't
63  // support the writeVectorOfBytes functionality..
64  virtual int writeVectorOfBytes(const OMEioVector *v,
65  uint_fast16_t elementCount,
66  size_t *actualBytes, int *errRet, size_t skipBytes = 0);
67 
69  OMEthread *t = nullptr) = 0;
70 
72  OMEthread *t = nullptr) = 0;
73 
74  virtual int close(int mask = 3) = 0;
75 
76  virtual OMEioDescriptor *acceptConnection(int *errRet);
77 
78  virtual int receiveDatagram(unsigned char *bfr, size_t bytes,
79  size_t *actualBytes, OMEstring *fromInfo, int *errRet);
80 
81  virtual int sendDatagram(const unsigned char *bfr, size_t bytes,
82  size_t *actualBytes, const char *toInfo, int *errRet);
83 
84  virtual int seekToOffset(size_t offset);
85 
86 
87  virtual OMEstring *getLocalAddress() const;
88 
89  virtual OMEstring *getPeerAddress() const;
90 
91  virtual int getErrorStatus() const;
92 
93  virtual bool isOpen() const = 0;
94 
95  uint_fast16_t adjustVector(OMEioVector *result, uint_fast16_t count,
96  const OMEioVector *v, size_t skipCount);
97 }; // end class OMEioDescriptor
98 
99 typedef OMEioDescriptor *(*OMEopenSchemeFP)(const OMEstring &url, int *errRet);
100 
101 int OMEregisterIOscheme(const OMEstring &schemePrefix, OMEopenSchemeFP func);
102 
103 int OMEregisterIOscheme(const char *schemePrefix, OMEopenSchemeFP func);
104 
105 OMEioDescriptor *OMEopenURL(const OMEstring &url, int *errRet = nullptr);
106 
109 #endif
110 /* vim: set expandtab shiftwidth=4 tabstop=4: */
OMEeventCallbackFP
bool(* OMEeventCallbackFP)(class OMEevent *, OMEthread *)
Definition: OMEevent.h:16
OMEioDescriptor::listen
@ listen
Definition: OMEioObjects.h:28
OME_IO_MULTICAST
#define OME_IO_MULTICAST
Definition: OMEmanifests.h:133
OME_IO_NONBLOCKING
#define OME_IO_NONBLOCKING
Definition: OMEmanifests.h:130
OME_IO_CREATE
#define OME_IO_CREATE
Definition: OMEmanifests.h:126
OME_IO_WRITE
#define OME_IO_WRITE
Definition: OMEmanifests.h:122
OMEprofileCounter< uint32_t >
OMEioObjects.h
OMEioDescriptor::getPeerAddress
virtual OMEstring * getPeerAddress() const
Definition: OMEioObjects.cpp:96
OMEstartCriticalSection
void OMEstartCriticalSection(eOMEcriticalSectionLabel regionID)
Definition: OMEmutex.cpp:217
OMEioVector::data
unsigned char * data
Definition: OMEioObjects.h:19
OMEioDescriptor::nonblocking
@ nonblocking
Definition: OMEioObjects.h:31
OMEioDescriptor::mustExist
@ mustExist
Definition: OMEioObjects.h:30
OMEioVector::length
size_t length
Definition: OMEioObjects.h:20
OMEioEvents.h
OMEioDescriptor::write
@ write
Definition: OMEioObjects.h:28
OMEioDescriptor::isOpen
virtual bool isOpen() const =0
OMEioDescriptor::read
@ read
Definition: OMEioObjects.h:28
OMEioDescriptor::raw
@ raw
Definition: OMEioObjects.h:32
OMEioDescriptor::~OMEioDescriptor
virtual ~OMEioDescriptor()
Definition: OMEioObjects.cpp:46
OMEioDescriptor::truncate
@ truncate
Definition: OMEioObjects.h:30
OMEstring
Implements text and binary string storage.
Definition: OMEstring.h:305
OMEioDescriptor::multicast
@ multicast
Definition: OMEioObjects.h:32
OMEcore.h
OMEioDescriptor::OMEioDescriptor
OMEioDescriptor(uint64_t handle, OMEioEvent::OMEfileType type)
Definition: OMEioObjects.cpp:37
OME_IO_RAW
#define OME_IO_RAW
Definition: OMEmanifests.h:132
OMEioDescriptor::datagram
@ datagram
Definition: OMEioObjects.h:32
OMEioDescriptor::sendDatagram
virtual int sendDatagram(const unsigned char *bfr, size_t bytes, size_t *actualBytes, const char *toInfo, int *errRet)
Definition: OMEioObjects.cpp:72
OMEioDescriptor::seekToOffset
virtual int seekToOffset(size_t offset)
Definition: OMEioObjects.cpp:85
OMEioDescriptor::getLocalAddress
virtual OMEstring * getLocalAddress() const
Definition: OMEioObjects.cpp:90
OMEopenURL
OMEioDescriptor * OMEopenURL(const OMEstring &url, int *errCode)
Open an I/O descriptor based on an URL.
Definition: OMEioObjects.cpp:257
srcID
const char srcID[]
Definition: catSym.c:17
OME_IO_APPEND
#define OME_IO_APPEND
Definition: OMEmanifests.h:129
OMEioDescriptor::selectForRead
virtual OMEevent * selectForRead(OMEeventCallbackFP func, OMEthread *t=nullptr)=0
OMEioDescriptor::writeBytes
virtual int writeBytes(const unsigned char *bfr, size_t bytes, size_t *actualBytes, int *errRet)=0
OME_IO_TRUNCATE
#define OME_IO_TRUNCATE
Definition: OMEmanifests.h:128
OMEioEvent::OMEfileType
OMEfileType
Definition: OMEioEvents.h:20
OMEioDescriptor::getSelectHandle
uint64_t getSelectHandle() const OME_ALWAYS_INLINE
Definition: OMEioObjects.h:50
OMEioDescriptor::getErrorStatus
virtual int getErrorStatus() const
Definition: OMEioObjects.cpp:111
OMEioDescriptor::close
virtual int close(int mask=3)=0
OMEioDescriptor::selectForWrite
virtual OMEevent * selectForWrite(OMEeventCallbackFP func, OMEthread *t=nullptr)=0
OMEioDescriptor::receiveDatagram
virtual int receiveDatagram(unsigned char *bfr, size_t bytes, size_t *actualBytes, OMEstring *fromInfo, int *errRet)
Definition: OMEioObjects.cpp:62
OMEioDescriptor::create
@ create
Definition: OMEioObjects.h:29
OMEioDescriptor::adjustVector
uint_fast16_t adjustVector(OMEioVector *result, uint_fast16_t count, const OMEioVector *v, size_t skipCount)
Definition: OMEioObjects.cpp:121
OMEioVector
Equivalent of iov structure.
Definition: OMEioObjects.h:18
OMEioDescriptor::OMEopenMode
OMEopenMode
Definition: OMEioObjects.h:28
OMEstring::length
size_t length() const
Definition: OMEstring.h:401
MAX_IO_VECTORS
#define MAX_IO_VECTORS
Definition: OMEioObjects.cpp:15
OME_USED
const char srcID[] OME_USED
Definition: tick_time.cpp:24
OMEioDescriptor::descriptorType
OMEioEvent::OMEfileType descriptorType
Definition: OMEioObjects.h:37
OMEioDescriptor::acceptConnection
virtual OMEioDescriptor * acceptConnection(int *errRet)
Definition: OMEioObjects.cpp:53
OMEioDescriptor::append
@ append
Definition: OMEioObjects.h:31
OMEioDescriptor::ioHandle
uint64_t ioHandle
Definition: OMEioObjects.h:36
OMEendCriticalSection
void OMEendCriticalSection(eOMEcriticalSectionLabel regionID)
Definition: OMEmutex.cpp:236
OME_ALWAYS_INLINE
#define OME_ALWAYS_INLINE
Tell the compiler to alway inline a function, regardless of optimization level.
Definition: compiler_hints.h:364
OMEioDescriptor::connect
@ connect
Definition: OMEioObjects.h:29
OMEioDescriptor::writeVectorOfBytes
virtual int writeVectorOfBytes(const OMEioVector *v, uint_fast16_t elementCount, size_t *actualBytes, int *errRet, size_t skipBytes=0)
Definition: OMEioObjects.cpp:154
OME_IO_MUST_EXIST
#define OME_IO_MUST_EXIST
Definition: OMEmanifests.h:127
OME_IO_READ
#define OME_IO_READ
Definition: OMEmanifests.h:121
OMEevent
Base class for events within the FARGOS/VISTA Object Management Environment.
Definition: OMEevent.h:22
elementCount
int elementCount(OMEthread *thread, OMEtype &result, const OMEtype &arg)
Definition: OILtypeFuncs.cpp:168
OMEioDescriptor::openIOscheme
static OMEioDescriptor * openIOscheme(const char *name, uint32_t openMode)
Definition: OMEioObjects.cpp:102
OME_CRITICAL_SECTION_MISCELLANEOUS
@ OME_CRITICAL_SECTION_MISCELLANEOUS
Definition: OMEmutex.h:47
OMEdebugInfo.h
OME debug and profiling interfaces.
OMEthread
Public interface to an OME thread.
Definition: OMEthread.h:60
OME_IO_DATAGRAM
#define OME_IO_DATAGRAM
Definition: OMEmanifests.h:131
LOG_ENDLINE
#define LOG_ENDLINE
Closing clause for text line output using << operators.
Definition: logging_api.hpp:2956
OME_IO_CONNECT
#define OME_IO_CONNECT
Definition: OMEmanifests.h:125
OME_IO_LISTEN
#define OME_IO_LISTEN
Definition: OMEmanifests.h:124
OMEregisterIOscheme
int OMEregisterIOscheme(const OMEstring &prefix, OMEopenSchemeFP func)
Register support for new I/O transport scheme.
Definition: OMEioObjects.cpp:219
OMEopenSchemeFP
OMEioDescriptor *(* OMEopenSchemeFP)(const OMEstring &url, int *errRet)
Definition: OMEioObjects.h:99
length
int length(OMEthread *thread, OMEtype &result, const OMEtype &arg)
Definition: OILtypeFuncs.cpp:19
OMEioDescriptor
Base class for open files and sockets.
Definition: OMEioObjects.h:26
OMEioDescriptor::readBytes
virtual int readBytes(unsigned char *bfr, size_t bytes, size_t *actualBytes, int *errRet)=0
LOG_CERR
#define LOG_CERR(lvl)
Convenience macro that uses LOG_INTO() to conditionally log a message to standard error.
Definition: logging_api.hpp:3014
logging_api.hpp
FARGOS Logging API.
Generated: Fri Jul 31 2020 18:19:14
Support Information