|
|
|
|
|
|
|
|
template<typename T> |
|
|
template<typename T> |
|
|
size_t read(T &data, size_t nBytes = 0) { |
|
|
size_t read(T &data, size_t nBytes = 0) { |
|
|
|
|
|
|
|
|
if (!isRunning()) { |
|
|
|
|
|
throw std::logic_error("No child process is running."); |
|
|
|
|
|
|
|
|
if (!childStarted) { |
|
|
|
|
|
throw std::logic_error("Child process was not started."); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
data.clear(); |
|
|
data.clear(); |
|
|
|
|
|
|
|
|
template<typename T, typename U> |
|
|
template<typename T, typename U> |
|
|
bool readDelimited(T &data, U const &delimiter) { |
|
|
bool readDelimited(T &data, U const &delimiter) { |
|
|
|
|
|
|
|
|
if (!isRunning()) { |
|
|
|
|
|
throw std::logic_error("No child process is running."); |
|
|
|
|
|
|
|
|
if (!childStarted) { |
|
|
|
|
|
throw std::logic_error("Child process was not started."); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
data.clear(); |
|
|
data.clear(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Non-blocking request to get data up to a delimiter read from |
|
|
/** Non-blocking request to get data up to a delimiter read from |
|
|
the child. |
|
|
the child. |
|
|
|
|
|
|