22 bool all_data_sent =
false;
27 bool connected =
false;
31 std::deque<std::pair<char*, size_t> >
blocks;
46 bool has_connection()
const;
48 bool send_block(
const char* data,
size_t count);
50 size_t get_nr_blocks()
const;
52 size_t get_nr_bytes()
const;
67 bool connect_to_child_process();
69 void write_block_to_pipe(
const char* data,
size_t count);
76 std::string get_pipe_path()
const;
92 bool connect_to_child_process();
94 void write_block_to_pipe(
const char* data,
size_t count);
99 pipe_output_thread(
const std::string& _cmd,
bool is_binary =
true,
unsigned _ms_to_wait = 20);
101 int get_result()
const;
113 bool all_data_received =
false;
138 virtual void move_packages_to_data_blocks();
145 size_t _packeges_per_block,
unsigned _ms_to_wait);
152 bool pop_data_block(
char* buffer);
154 size_t get_nr_blocks()
const;
162 std::string pipe_name;
164 bool connect_to_source()
override;
165 size_t read_package_from_pipe(
char* buffer,
size_t package_size)
override;
166 void close()
override;
170 size_t _packeges_per_block,
unsigned _ms_to_wait);
171 std::string get_pipe_path()
const;
182 bool connect_to_source()
override;
183 size_t read_package_from_pipe(
char* buffer,
size_t package_size)
override;
184 void close()
override;
187 pipe_input_thread(
const std::string& _cmd,
bool is_binary,
size_t _package_size,
size_t _packages_per_block,
188 unsigned _ms_to_wait);
189 int get_result()
const;
194#include <cgv/config/lib_end.h>
queued thread class that manages a named pipe
std::string pipe_name
based name of the
queued thread class that manages a child process connecting to its input pipe
std::string cmd
system command to be executed
base class for system command input pipe or named pipe threads including a queue of data blocks and a...
virtual void close()=0
to be implemented in derived classes
unsigned ms_to_wait
time in miliseconds to wait while queue is empty
virtual void write_block_to_pipe(const char *data, size_t count)=0
to be implemented in derived classes
std::deque< std::pair< char *, size_t > > blocks
deque used to queue the data blocks that should be written to the pipe by the thread
bool is_binary
whether binary mode should be used
virtual bool connect_to_child_process()=0
to be implemented in derived classes
cgv::os::mutex m
mutex used to protect access to blocks
Thread class implementation that uses pthreads internally.
A simple mutex (mutual exclusion) for solving thread synchronisation problems.