# IODefinitions.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/core/IODefinitions.hpp"

# [unknown]

Namespace: oatpp

Represents I/O handle (ex.: file descriptor).

#if defined(WIN32) || defined(_WIN32)
	#if defined(_WIN64)
	  typedef unsigned long long v_io_handle

# isValidIOHandle

Namespace: oatpp

Check if IO handle is valid.

  • @param handle - IO handle.
  • @return - true if valid.

bool isValidIOHandle(v_io_handle handle)

# v_io_size

Namespace: oatpp

All I/O buffer operations (like read/write(buffer, size)) should return v_io_size.
Possible return values:

  • On Success - [1..max_int64].
  • On Error - IOError values.
All other values are considered to be a fatal error. application should be terminated.

typedef v_int64 v_io_size

# IOError

Final set of possible I/O operation error values. I/O operation should not return any other error values.

namespace oatpp { 
  enum IOError : v_io_size;


In oatpp 0 is considered to be an Error as for I/O operation size.
As for argument value 0 should be handled separately of the main flow.
As for return value 0 should not be returned.
I/O method should return an error describing a reason why I/O is empty instead of a zero itself.
if zero is returned, client should treat it like a bad api implementation and as an error in the flow.



I/O operation is not possible any more. Client should give up trying and free all related resources.



I/O operation was interrupted because of some reason. Client may retry read immediately.

RETRY_READ = -1002


I/O operation was interrupted because of some reason. Client may retry immediately.


# AsyncIOError

Asynchronous I/O error.
Extends oatpp::async::Error.

namespace oatpp { 
  class AsyncIOError : public oatpp::async::Error {}

# Methods

Return Type Name Summary
[none] AsyncIOError Multiple implementations:
  1. Constructor.
  2. Constructor.
v_io_size getCode Get I/O opersation error code.

# AsyncIOError::AsyncIOError

  1. Constructor.
    • @param what - description of error type.
    • @param code - I/O opersation error code. IOError.
    AsyncIOError(const char* what, v_io_size code)
      : oatpp::async::Error(what)
      , m_code(code)
  2. Constructor.
    • @param code - I/O opersation error code. IOError.
    AsyncIOError(v_io_size code)
      : oatpp::async::Error("AsyncIOError")
      , m_code(code)

# AsyncIOError::getCode

Get I/O opersation error code.

  • @return - I/O opersation error code. IOError.

v_io_size getCode() const