MCPcopy Create free account
hub / github.com/arun11299/cpp-subprocess / Communication

Class Communication

cpp-subprocess/subprocess.hpp:1189–1217  ·  view source on GitHub ↗

! * A helper class to Streams. * This takes care of management of communicating * with the child process with the means of the correct * file descriptor. */

Source from the content-addressed store, hash-verified

1187 * file descriptor.
1188 */
1189class Communication
1190{
1191public:
1192 Communication(Streams* stream): stream_(stream)
1193 {}
1194 Communication(const Communication&) = delete;
1195 Communication& operator=(const Communication&) = delete;
1196 Communication(Communication&&) = default;
1197 Communication& operator=(Communication&&) = default;
1198public:
1199 int send(const char* msg, size_t length);
1200 int send(const std::vector<char>& msg);
1201
1202 std::pair<OutBuffer, ErrBuffer> communicate(const char* msg, size_t length);
1203 std::pair<OutBuffer, ErrBuffer> communicate(const std::vector<char>& msg)
1204 { return communicate(msg.data(), msg.size()); }
1205
1206 void set_out_buf_cap(size_t cap) { out_buf_cap_ = cap; }
1207 void set_err_buf_cap(size_t cap) { err_buf_cap_ = cap; }
1208
1209private:
1210 std::pair<OutBuffer, ErrBuffer> communicate_threaded(
1211 const char* msg, size_t length);
1212
1213private:
1214 Streams* stream_;
1215 size_t out_buf_cap_ = DEFAULT_BUF_CAP_BYTES;
1216 size_t err_buf_cap_ = DEFAULT_BUF_CAP_BYTES;
1217};
1218
1219
1220

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected