Go to the documentation of this file.
25 std::cout <<
"[thread_reader ID:" << std::this_thread::get_id()
26 <<
"] Started." << std::endl;
31 read_pipe.
Read(&len,
sizeof(len));
32 read_pipe.
Read(buf, len);
35 cout <<
"RX: " << buf << endl;
41 auto obj = arch.ReadObject();
44 CPose3D::Ptr ptrPose = std::dynamic_pointer_cast<CPose3D>(obj);
45 cout <<
"RX pose: " << *ptrPose << endl;
48 printf(
"[thread_reader] Finished.\n");
50 catch (
const std::exception& e)
52 cerr << e.what() << endl;
60 std::cout <<
"[thread_writer ID:" << std::this_thread::get_id()
61 <<
"] Started." << std::endl;
64 const char* str =
"Hello world!";
65 size_t len = strlen(str);
66 write_pipe.
Write(&len,
sizeof(len));
67 write_pipe.
Write(str, len);
72 arch.WriteObject(&pose);
74 printf(
"[thread_writer] Finished.\n");
76 catch (
const std::exception& e)
78 cerr << e.what() << endl;
88 std::unique_ptr<CPipeReadEndPoint> read_pipe;
89 std::unique_ptr<CPipeWriteEndPoint> write_pipe;
91 CPipe::createPipe(read_pipe, write_pipe);
113 catch (
const std::exception& e)
120 printf(
"Untyped exception!!");
void thread_reader(CPipeReadEndPoint &read_pipe)
The read end-point in a pipe created with mrpt::synch::CPipe.
#define IS_CLASS(obj, class_name)
True if the given reference to object (derived from mrpt::rtti::CObject) is of the given class.
std::shared_ptr< mrpt::poses ::CPose3D > Ptr
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
The write end-point in a pipe created with mrpt::synch::CPipe.
CArchiveStreamBase< STREAM > archiveFrom(STREAM &s)
Helper function to create a templatized wrapper CArchive object for a: MRPT's CStream,...
std::string exception_to_str(const std::exception &e)
Builds a nice textual representation of a nested exception, which if generated using MRPT macros (THR...
size_t Read(void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for reading from the stream.
void thread_writer(CPipeWriteEndPoint &write_pipe)
size_t Write(const void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for writing to the stream.
Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 29 13:06:46 UTC 2020 | |