MRPT  1.9.9
List of all members | Public Types | Public Member Functions | Public Attributes | Protected Attributes | Friends
mrpt::io::CPipeBaseEndPoint Class Reference

Detailed Description

Common interface of read & write pipe end-points.

Definition at line 61 of file CPipe.h.

#include <mrpt/io/CPipe.h>

Inheritance diagram for mrpt::io::CPipeBaseEndPoint:

Public Types

enum  TSeekOrigin { sFromBeginning = 0, sFromCurrent = 1, sFromEnd = 2 }
 Used in CStream::Seek. More...
 

Public Member Functions

 CPipeBaseEndPoint ()
 
 CPipeBaseEndPoint (const CPipeBaseEndPoint &)=delete
 
CPipeBaseEndPointoperator= (const CPipeBaseEndPoint &)=delete
 
 ~CPipeBaseEndPoint () override
 
 CPipeBaseEndPoint (const std::string &serialized)
 De-serializes one end-point description, for example, from a parent process. More...
 
std::string serialize ()
 Converts the end-point into a string suitable for reconstruction at a child process. More...
 
bool isOpen () const
 Returns false if the pipe was closed due to some error. More...
 
void close ()
 Closes the pipe (normally not needed to be called by users, automatically done at destructor) More...
 
size_t Read (void *Buffer, size_t Count) override
 Introduces a pure virtual method responsible for reading from the stream. More...
 
size_t Write (const void *Buffer, size_t Count) override
 Introduces a pure virtual method responsible for writing to the stream. More...
 
uint64_t Seek (int64_t of, CStream::TSeekOrigin o=sFromBeginning) override
 Without effect in this class. More...
 
uint64_t getTotalBytesCount () const override
 Without effect in this class. More...
 
uint64_t getPosition () const override
 Without effect in this class. More...
 
virtual size_t ReadBufferImmediate (void *Buffer, size_t Count)
 Reads a block of bytes from the stream into Buffer, and returns the amound of bytes actually read, without waiting for more extra bytes to arrive (just those already enqued in the stream). More...
 
virtual int printf (const char *fmt,...) MRPT_printf_format_check(2
 Writes a string to the stream in a textual form. More...
 
template<typename CONTAINER_TYPE >
virtual int void printf_vector (const char *fmt, const CONTAINER_TYPE &V, char separator=',')
 Prints a vector in the format [A,B,C,...] using CStream::printf, and the fmt string for each vector element T. More...
 
bool getline (std::string &out_str)
 Reads from the stream until a '
' character is found ('' characters are ignored). More...
 

Public Attributes

unsigned int timeout_read_start_us {0}
 (Default=0) Timeout for read operations: microseconds (us) to wait for the first byte. More...
 
unsigned int timeout_read_between_us {0}
 (Default=0) Timeout between burst reads operations: microseconds (us) to wait between two partial reads inside one large read. More...
 

Protected Attributes

void * m_pipe_file
 

Friends

class CPipe
 

Member Enumeration Documentation

◆ TSeekOrigin

Used in CStream::Seek.

Enumerator
sFromBeginning 
sFromCurrent 
sFromEnd 

Definition at line 32 of file io/CStream.h.

Constructor & Destructor Documentation

◆ CPipeBaseEndPoint() [1/3]

CPipeBaseEndPoint::CPipeBaseEndPoint ( )
default

◆ CPipeBaseEndPoint() [2/3]

mrpt::io::CPipeBaseEndPoint::CPipeBaseEndPoint ( const CPipeBaseEndPoint )
delete

◆ ~CPipeBaseEndPoint()

CPipeBaseEndPoint::~CPipeBaseEndPoint ( )
override

Definition at line 54 of file CPipe.cpp.

References close().

Here is the call graph for this function:

◆ CPipeBaseEndPoint() [3/3]

CPipeBaseEndPoint::CPipeBaseEndPoint ( const std::string &  serialized)
explicit

De-serializes one end-point description, for example, from a parent process.

Definition at line 80 of file CPipe.cpp.

References m_pipe_file, THROW_EXCEPTION, and val.

Member Function Documentation

◆ close()

void CPipeBaseEndPoint::close ( )

Closes the pipe (normally not needed to be called by users, automatically done at destructor)

Definition at line 56 of file CPipe.cpp.

References m_pipe_file.

Referenced by Read(), and ~CPipeBaseEndPoint().

Here is the caller graph for this function:

◆ getline()

bool CStream::getline ( std::string &  out_str)
inherited

Reads from the stream until a '
' character is found ('' characters are ignored).

Returns
false on EOF or any other read error.

Definition at line 69 of file CStream.cpp.

◆ getPosition()

uint64_t CPipeBaseEndPoint::getPosition ( ) const
overridevirtual

Without effect in this class.

Implements mrpt::io::CStream.

Definition at line 115 of file CPipe.cpp.

◆ getTotalBytesCount()

uint64_t CPipeBaseEndPoint::getTotalBytesCount ( ) const
overridevirtual

Without effect in this class.

Implements mrpt::io::CStream.

Definition at line 114 of file CPipe.cpp.

◆ isOpen()

bool mrpt::io::CPipeBaseEndPoint::isOpen ( ) const
inline

Returns false if the pipe was closed due to some error.

Definition at line 93 of file CPipe.h.

References m_pipe_file.

◆ operator=()

CPipeBaseEndPoint& mrpt::io::CPipeBaseEndPoint::operator= ( const CPipeBaseEndPoint )
delete

◆ printf()

int CStream::printf ( const char *  fmt,
  ... 
)
virtualinherited

Writes a string to the stream in a textual form.

See also
CStdOutStream

Definition at line 30 of file CStream.cpp.

References MRPT_END, MRPT_START, and mrpt::system::os::vsnprintf().

Referenced by mrpt::hmtslam::CTopLCDetector_GridMatching::computeTopologicalObservationModel(), mrpt::apps::MonteCarloLocalization_Base::do_pf_localization(), mrpt::io::CStream::printf_vector(), mrpt::apps::CGridMapAlignerApp::run(), mrpt::apps::RBPF_SLAM_App_Base::run(), and mrpt::apps::ICP_SLAM_App_Base::run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printf_vector()

template<typename CONTAINER_TYPE >
virtual int void mrpt::io::CStream::printf_vector ( const char *  fmt,
const CONTAINER_TYPE &  V,
char  separator = ',' 
)
inlineinherited

Prints a vector in the format [A,B,C,...] using CStream::printf, and the fmt string for each vector element T.

Template Parameters
CONTAINER_TYPEcan be any vector<T>, deque<T> or alike.

Definition at line 102 of file io/CStream.h.

References mrpt::io::CStream::printf().

Referenced by mrpt::hmtslam::CTopLCDetector_GridMatching::computeTopologicalObservationModel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Read()

size_t CPipeBaseEndPoint::Read ( void *  Buffer,
size_t  Count 
)
overridevirtual

Introduces a pure virtual method responsible for reading from the stream.

Implements mrpt::io::CStream.

Reimplemented in mrpt::io::CPipeWriteEndPoint.

Definition at line 117 of file CPipe.cpp.

References ASSERTMSG_, close(), m_pipe_file, timeout_read_between_us, and timeout_read_start_us.

Here is the call graph for this function:

◆ ReadBufferImmediate()

virtual size_t mrpt::io::CStream::ReadBufferImmediate ( void *  Buffer,
size_t  Count 
)
inlinevirtualinherited

Reads a block of bytes from the stream into Buffer, and returns the amound of bytes actually read, without waiting for more extra bytes to arrive (just those already enqued in the stream).

Note that this method will fallback to ReadBuffer() in most CStream classes but in some hardware-related classes.

Exceptions
std::exceptionOn any error, or if ZERO bytes are read.

Reimplemented in mrpt::comms::CInterfaceFTDI.

Definition at line 62 of file io/CStream.h.

References mrpt::io::CStream::Read().

Here is the call graph for this function:

◆ Seek()

uint64_t CPipeBaseEndPoint::Seek ( int64_t  of,
CStream::TSeekOrigin  o = sFromBeginning 
)
overridevirtual

Without effect in this class.

Implements mrpt::io::CStream.

Definition at line 113 of file CPipe.cpp.

◆ serialize()

std::string CPipeBaseEndPoint::serialize ( )

Converts the end-point into a string suitable for reconstruction at a child process.

This invalidates this object, since only one real end-point can exist at once.

Definition at line 102 of file CPipe.cpp.

References ASSERTMSG_, m_pipe_file, and mrpt::to_string().

Here is the call graph for this function:

◆ Write()

size_t CPipeBaseEndPoint::Write ( const void *  Buffer,
size_t  Count 
)
overridevirtual

Introduces a pure virtual method responsible for writing to the stream.

Write attempts to write up to Count bytes to Buffer, and returns the number of bytes actually written.

Implements mrpt::io::CStream.

Reimplemented in mrpt::io::CPipeReadEndPoint.

Definition at line 218 of file CPipe.cpp.

References ASSERTMSG_, and m_pipe_file.

Friends And Related Function Documentation

◆ CPipe

friend class CPipe
friend

Definition at line 63 of file CPipe.h.

Member Data Documentation

◆ m_pipe_file

void* mrpt::io::CPipeBaseEndPoint::m_pipe_file
protected

◆ timeout_read_between_us

unsigned int mrpt::io::CPipeBaseEndPoint::timeout_read_between_us {0}

(Default=0) Timeout between burst reads operations: microseconds (us) to wait between two partial reads inside one large read.

0 means infinite timeout.

Definition at line 90 of file CPipe.h.

Referenced by Read().

◆ timeout_read_start_us

unsigned int mrpt::io::CPipeBaseEndPoint::timeout_read_start_us {0}

(Default=0) Timeout for read operations: microseconds (us) to wait for the first byte.

0 means infinite timeout.

Definition at line 86 of file CPipe.h.

Referenced by Read().




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 24b95e159 Thu Jan 23 01:15:46 2020 +0100 at jue ene 23 01:30:10 CET 2020