YARP
Yet Another Robot Platform
BayerCarrier Class Reference

Decode bayer images and serve them as regular rgb. More...

#include <bayer_carrier/BayerCarrier.h>

+ Inheritance diagram for BayerCarrier:

Public Member Functions

 BayerCarrier ()
 
 ~BayerCarrier ()
 
Carrier * create () const override
 Factory method. More...
 
std::string getName () const override
 Get the name of this connection type ("tcp", "mcast", "shmem", ...) More...
 
std::string toString () const override
 Get name of carrier. More...
 
yarp::os::ConnectionReadermodifyIncomingData (yarp::os::ConnectionReader &reader) override
 Modify incoming payload data, if appropriate. More...
 
bool expectBlock (char *data, size_t len) override
 Read a block of data from the network connection. More...
 
std::string expectText (const char terminatingChar='\n') override
 Read some text from the network connection. More...
 
std::int8_t expectInt8 () override
 Read a 8-bit integer from the network connection. More...
 
std::int16_t expectInt16 () override
 Read a 16-bit integer from the network connection. More...
 
std::int32_t expectInt32 () override
 Read a 32-bit integer from the network connection. More...
 
std::int64_t expectInt64 () override
 Read a 64-bit integer from the network connection. More...
 
bool pushInt (int x) override
 Store an integer to return on the next call to expectInt() More...
 
yarp::conf::float32_t expectFloat32 () override
 Read a 32-bit floating point number from the network connection. More...
 
yarp::conf::float64_t expectFloat64 () override
 Read a 64-bit floating point number from the network connection. More...
 
bool isTextMode () const override
 Check if the connection is text mode. More...
 
bool isBareMode () const override
 Check if the connection is bare mode. More...
 
bool convertTextMode () override
 Reads in a standard description in text mode, and converts it to a standard description in binary. More...
 
size_t getSize () const override
 Checks how much data is available. More...
 
yarp::os::ConnectionWritergetWriter () override
 Gets a way to reply to the message, if possible. More...
 
yarp::os::Bytes readEnvelope () override
 Read a message envelope, if available. More...
 
yarp::os::PortablegetReference () const override
 Get a direct pointer to the object being sent, if possible. More...
 
yarp::os::Contact getRemoteContact () const override
 Gets information about who is supplying the data being read, if that information is available. More...
 
yarp::os::Contact getLocalContact () const override
 Gets information about who is receiving the data, if that information is available. More...
 
bool isValid () const override
 
bool isActive () const override
 
bool isError () const override
 
void requestDrop () override
 Tag the connection to be dropped after the current message. More...
 
const yarp::os::SearchablegetConnectionModifiers () const override
 Access modifiers associated with the connection, if any. More...
 
bool setSize (size_t len) override
 
yarp::conf::ssize_t read (yarp::os::Bytes &b) override
 Read a block of data from the stream. More...
 
void close () override
 Terminate the stream. More...
 
bool isOk () const override
 Check if the stream is ok or in an error state. More...
 
void setParent (yarp::os::ConnectionReader &reader)
 
virtual bool debayerFull (yarp::sig::ImageOf< yarp::sig::PixelMono > &src, yarp::sig::ImageOf< yarp::sig::PixelRgb > &dest)
 
virtual bool debayerHalf (yarp::sig::ImageOf< yarp::sig::PixelMono > &src, yarp::sig::ImageOf< yarp::sig::PixelRgb > &dest)
 
virtual bool processBuffered () const
 
virtual bool processBuffered ()
 
virtual bool processDirect (yarp::os::Bytes &bytes)
 
- Public Member Functions inherited from yarp::os::ModifyingCarrier
bool checkHeader (const yarp::os::Bytes &header) override
 Given the first 8 bytes received on a connection, decide if this is the right carrier type to use for the rest of the connection. More...
 
void getHeader (yarp::os::Bytes &header) const override
 Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to select it. More...
 
bool respondToHeader (yarp::os::ConnectionState &proto) override
 Respond to the header. More...
 
bool modifiesIncomingData () const override
 Check if this carrier modifies incoming data through the Carrier::modifyIncomingData method. More...
 
bool modifiesOutgoingData () const override
 Check if this carrier modifies outgoing data through the Carrier::modifyOutgoingData method. More...
 
bool modifiesReply () const override
 Check if this carrier modifies outgoing data through the Carrier::modifyReply method. More...
 
void setCarrierParams (const yarp::os::Property &params) override
 Configure carrier from port administrative commands. More...
 
void getCarrierParams (yarp::os::Property &params) const override
 Get carrier configuration and deliver it by port administrative commands. More...
 
bool configureFromProperty (yarp::os::Property &prop) override
 
- Public Member Functions inherited from yarp::os::AbstractCarrier
void setParameters (const yarp::os::Bytes &header) override
 Configure this carrier based on the first 8 bytes of the connection. More...
 
bool isConnectionless () const override
 Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp). More...
 
bool supportReply () const override
 This flag is used by YARP to determine whether the connection can carry RPC traffic, that is, messages with replies. More...
 
bool canAccept () const override
 Check if reading is implemented for this carrier. More...
 
bool canOffer () const override
 Check if writing is implemented for this carrier. More...
 
bool requireAck () const override
 Check if carrier has flow control, requiring sent messages to be acknowledged by recipient. More...
 
bool canEscape () const override
 Check if carrier can encode administrative messages, as opposed to just user data. More...
 
bool isLocal () const override
 Check if carrier operates within a single process. More...
 
bool prepareSend (ConnectionState &proto) override
 Perform any initialization needed before writing on a connection. More...
 
bool sendHeader (ConnectionState &proto) override
 Write a header appropriate to the carrier to the connection, followed by any carrier-specific data. More...
 
bool expectReplyToHeader (ConnectionState &proto) override
 Process reply to header, if one is expected for this carrier. More...
 
virtual bool sendIndex (ConnectionState &proto, SizedWriter &writer)
 
bool expectExtraHeader (ConnectionState &proto) override
 Receive any carrier-specific header. More...
 
bool expectIndex (ConnectionState &proto) override
 Expect a message header, if there is one for this carrier. More...
 
bool expectSenderSpecifier (ConnectionState &proto) override
 Expect the name of the sending port. More...
 
bool sendAck (ConnectionState &proto) override
 Send an acknowledgement, if needed for this carrier. More...
 
bool expectAck (ConnectionState &proto) override
 Receive an acknowledgement, if expected for this carrier. More...
 
bool defaultSendHeader (ConnectionState &proto)
 Default implementation for the sendHeader method. More...
 
bool defaultExpectIndex (ConnectionState &proto)
 Default implementation for the expectIndex method. More...
 
bool defaultSendIndex (ConnectionState &proto, SizedWriter &writer)
 Default implementation for the sendIndex method. More...
 
bool defaultExpectAck (ConnectionState &proto)
 Default implementation for the expectAck method. More...
 
bool defaultSendAck (ConnectionState &proto)
 Default implementation for the sendAck method. More...
 
int readYarpInt (ConnectionState &proto)
 Read 8 bytes and interpret them as a YARP number. More...
 
void writeYarpInt (int n, ConnectionState &proto)
 Write n as an 8 bytes yarp number. More...
 
- Public Member Functions inherited from yarp::os::Carrier
bool isBroadcast () const override
 Check if this carrier uses a broadcast mechanism. More...
 
void handleEnvelope (const std::string &envelope) override
 Carriers that do not distinguish data from administrative headers (i.e. More...
 
bool isPush () const override
 Check if carrier is "push" or "pull" style. More...
 
virtual bool reply (ConnectionState &proto, SizedWriter &writer)
 
void prepareDisconnect () override
 Do cleanup and preparation for the coming disconnect, if necessary. More...
 
virtual ~Carrier ()
 Destructor. More...
 
virtual std::string getBootstrapCarrierName () const
 Get the name of the carrier that should be used prior to handshaking, if a port is registered with this carrier as its default carrier. More...
 
virtual int connect (const Contact &src, const Contact &dest, const ContactStyle &style, int mode, bool reversed)
 Some carrier types may require special connection logic. More...
 
bool acceptIncomingData (ConnectionReader &reader) override
 Determine whether incoming data should be accepted. More...
 
const PortWritermodifyOutgoingData (const PortWriter &writer) override
 Modify outgoing payload data, if appropriate. More...
 
PortReadermodifyReply (PortReader &reader) override
 Modify reply payload data, if appropriate. More...
 
bool acceptOutgoingData (const PortWriter &writer) override
 Determine whether outgoing data should be accepted. More...
 
virtual bool configure (ConnectionState &proto)
 Give carrier a shot at looking at how the connection is set up. More...
 
virtual yarp::os::FacecreateFace () const
 Create new Face object that the carrier needs. More...
 
- Public Member Functions inherited from yarp::os::Connection
virtual ~Connection ()
 Destructor. More...
 
- Public Member Functions inherited from yarp::os::ConnectionReader
virtual ~ConnectionReader ()
 Destructor. More...
 
virtual std::string expectString ()
 Read a string from the network connection. More...
 
virtual int expectInt () final
 Read an integer from the network connection. More...
 
virtual double expectDouble ()
 Read a floating point number from the network connection. More...
 
virtual void setParentConnectionReader (ConnectionReader *parentConnectionReader)
 Set ConnectionReader to be used for reading the envelope. More...
 
- Public Member Functions inherited from yarp::os::InputStream
 InputStream ()
 Constructor. More...
 
virtual ~InputStream ()
 Destructor. More...
 
virtual void check ()
 Perform maintenance actions, if needed. More...
 
virtual int read ()
 Read and return a single byte. More...
 
virtual yarp::conf::ssize_t read (Bytes &b, size_t offset, yarp::conf::ssize_t len)
 Read a block of data from the stream. More...
 
virtual yarp::conf::ssize_t partialRead (yarp::os::Bytes &b)
 Like read, but solicit partial responses. More...
 
virtual void interrupt ()
 Interrupt the stream. More...
 
virtual bool setReadTimeout (double timeout)
 Set activity timeout. More...
 
std::string readLine (const char terminal='\n', bool *success=nullptr)
 Read a block of text terminated with a specific marker (or EOF). More...
 
yarp::conf::ssize_t readFull (Bytes &b)
 Keep reading until buffer is full. More...
 
yarp::conf::ssize_t readDiscard (size_t len)
 Read and discard a fixed number of bytes. More...
 
virtual bool setReadEnvelopeCallback (readEnvelopeCallbackType callback, void *data)
 Install a callback that the InputStream will have to call when the envelope is read from a message in carriers that cannot be escaped. More...
 

Additional Inherited Members

- Public Types inherited from yarp::os::InputStream
typedef void(* readEnvelopeCallbackType) (void *, const yarp::os::Bytes &envelope)
 Callback type for setting the envelope from a message in carriers that cannot be escaped. More...
 
- Static Public Member Functions inherited from yarp::os::ConnectionReader
static ConnectionReadercreateConnectionReader (InputStream &is)
 Create an instance of YARP's standard connection reader implementation. More...
 
static bool readFromStream (PortReader &portable, InputStream &is)
 
- Protected Member Functions inherited from yarp::os::AbstractCarrier
int getSpecifier (const Bytes &b) const
 
void createStandardHeader (int specifier, yarp::os::Bytes &header) const
 
bool write (ConnectionState &proto, SizedWriter &writer) override
 Write a message. More...
 
bool sendConnectionStateSpecifier (ConnectionState &proto)
 
bool sendSenderSpecifier (ConnectionState &proto)
 
- Static Protected Member Functions inherited from yarp::os::AbstractCarrier
static int interpretYarpNumber (const yarp::os::Bytes &b)
 
static void createYarpNumber (int x, yarp::os::Bytes &header)
 

Detailed Description

Decode bayer images and serve them as regular rgb.

Affected by carrier modifiers. Examples: tcp+recv.bayer tcp+recv.bayer+size.half tcp+recv.bayer+size.half+order.bggr

Definition at line 27 of file BayerCarrier.h.

Constructor & Destructor Documentation

◆ BayerCarrier()

BayerCarrier::BayerCarrier ( )
inline

Definition at line 63 of file BayerCarrier.h.

◆ ~BayerCarrier()

BayerCarrier::~BayerCarrier ( )
inline

Definition at line 79 of file BayerCarrier.h.

Member Function Documentation

◆ close()

void BayerCarrier::close ( )
inlineoverridevirtual

Terminate the stream.

Implements yarp::os::InputStream.

Definition at line 206 of file BayerCarrier.h.

◆ convertTextMode()

bool BayerCarrier::convertTextMode ( )
inlineoverridevirtual

Reads in a standard description in text mode, and converts it to a standard description in binary.

Useful if you only operate on the binary description usually, and just want to permit text mode for command-line interaction. If isTextMode would return false, no conversion is done.

Returns
true if the conversion was possible

Implements yarp::os::ConnectionReader.

Definition at line 145 of file BayerCarrier.h.

◆ create()

Carrier* BayerCarrier::create ( ) const
inlineoverridevirtual

Factory method.

Get a new object of the same type as this one.

Returns
a new object of the same type as this one.

Implements yarp::os::ModifyingCarrier.

Definition at line 83 of file BayerCarrier.h.

◆ debayerFull()

bool BayerCarrier::debayerFull ( yarp::sig::ImageOf< yarp::sig::PixelMono > &  src,
yarp::sig::ImageOf< yarp::sig::PixelRgb > &  dest 
)
virtual

Definition at line 204 of file BayerCarrier.cpp.

◆ debayerHalf()

bool BayerCarrier::debayerHalf ( yarp::sig::ImageOf< yarp::sig::PixelMono > &  src,
yarp::sig::ImageOf< yarp::sig::PixelRgb > &  dest 
)
virtual

Definition at line 162 of file BayerCarrier.cpp.

◆ expectBlock()

bool BayerCarrier::expectBlock ( char *  data,
size_t  len 
)
inlineoverridevirtual

Read a block of data from the network connection.

Parameters
dataStart of the block of data
lenLength of the block of data
Returns
true on success

Implements yarp::os::ConnectionReader.

Definition at line 101 of file BayerCarrier.h.

◆ expectFloat32()

yarp::conf::float32_t BayerCarrier::expectFloat32 ( )
inlineoverridevirtual

Read a 32-bit floating point number from the network connection.

Returns
the floating point number read from the connection

Implements yarp::os::ConnectionReader.

Definition at line 129 of file BayerCarrier.h.

◆ expectFloat64()

yarp::conf::float64_t BayerCarrier::expectFloat64 ( )
inlineoverridevirtual

Read a 64-bit floating point number from the network connection.

Returns
the floating point number read from the connection

Implements yarp::os::ConnectionReader.

Definition at line 133 of file BayerCarrier.h.

◆ expectInt16()

std::int16_t BayerCarrier::expectInt16 ( )
inlineoverridevirtual

Read a 16-bit integer from the network connection.

Returns
the integer read from the connection

Implements yarp::os::ConnectionReader.

Definition at line 113 of file BayerCarrier.h.

◆ expectInt32()

std::int32_t BayerCarrier::expectInt32 ( )
inlineoverridevirtual

Read a 32-bit integer from the network connection.

Returns
the integer read from the connection

Implements yarp::os::ConnectionReader.

Definition at line 117 of file BayerCarrier.h.

◆ expectInt64()

std::int64_t BayerCarrier::expectInt64 ( )
inlineoverridevirtual

Read a 64-bit integer from the network connection.

Returns
the integer read from the connection

Implements yarp::os::ConnectionReader.

Definition at line 121 of file BayerCarrier.h.

◆ expectInt8()

std::int8_t BayerCarrier::expectInt8 ( )
inlineoverridevirtual

Read a 8-bit integer from the network connection.

Returns
the integer read from the connection

Implements yarp::os::ConnectionReader.

Definition at line 109 of file BayerCarrier.h.

◆ expectText()

std::string BayerCarrier::expectText ( const char  terminatingChar = '\n')
inlineoverridevirtual

Read some text from the network connection.

Parameters
terminatingCharThe marker for the end of the text
Returns
the text read from the connection

Implements yarp::os::ConnectionReader.

Definition at line 105 of file BayerCarrier.h.

◆ getConnectionModifiers()

const yarp::os::Searchable& BayerCarrier::getConnectionModifiers ( ) const
inlineoverridevirtual

Access modifiers associated with the connection, if any.

Returns
connection configuration object

Implements yarp::os::ConnectionReader.

Definition at line 192 of file BayerCarrier.h.

◆ getLocalContact()

yarp::os::Contact BayerCarrier::getLocalContact ( ) const
inlineoverridevirtual

Gets information about who is receiving the data, if that information is available.

Returns
contact information about sender (Contact::invalid if not available)

Implements yarp::os::ConnectionReader.

Definition at line 172 of file BayerCarrier.h.

◆ getName()

std::string BayerCarrier::getName ( ) const
inlineoverridevirtual

Get the name of this connection type ("tcp", "mcast", "shmem", ...)

Returns
the name of this connection type

Implements yarp::os::ModifyingCarrier.

Definition at line 87 of file BayerCarrier.h.

◆ getReference()

yarp::os::Portable* BayerCarrier::getReference ( ) const
inlineoverridevirtual

Get a direct pointer to the object being sent, if possible.

This only makes sense in local operation, when sender and receiver are in the same process; in all other situations this returns nullptr.

Returns
The message object, or nullptr if not available

Implements yarp::os::ConnectionReader.

Definition at line 164 of file BayerCarrier.h.

◆ getRemoteContact()

yarp::os::Contact BayerCarrier::getRemoteContact ( ) const
inlineoverridevirtual

Gets information about who is supplying the data being read, if that information is available.

Returns
contact information about sender (Contact::invalid if not available)

Implements yarp::os::ConnectionReader.

Definition at line 168 of file BayerCarrier.h.

◆ getSize()

size_t BayerCarrier::getSize ( ) const
inlineoverridevirtual

Checks how much data is available.

Returns
the number of bytes left on the connection.

Implements yarp::os::ConnectionReader.

Definition at line 149 of file BayerCarrier.h.

◆ getWriter()

yarp::os::ConnectionWriter* BayerCarrier::getWriter ( )
inlineoverridevirtual

Gets a way to reply to the message, if possible.

Returns
An object that permits replies, or nullptr if this cannot be done.

Implements yarp::os::ConnectionReader.

Definition at line 156 of file BayerCarrier.h.

◆ isActive()

bool BayerCarrier::isActive ( ) const
inlineoverridevirtual
Returns
true if the reader is active. Readers become inactive if the connection they are associated with breaks.

Implements yarp::os::ConnectionReader.

Definition at line 180 of file BayerCarrier.h.

◆ isBareMode()

bool BayerCarrier::isBareMode ( ) const
inlineoverridevirtual

Check if the connection is bare mode.

If it is, you are encouraged to omit type information from your serialization.

Returns
true if the connection is bare

Implements yarp::os::ConnectionReader.

Definition at line 141 of file BayerCarrier.h.

◆ isError()

bool BayerCarrier::isError ( ) const
inlineoverridevirtual
Returns
true if the reader encountered an error. Readers can encounter an error if there is some data loss. For unreliable protocols like UDP/Multicast, where losses are not unexpected, this error flag will be reset for the next incoming message.

Implements yarp::os::ConnectionReader.

Definition at line 184 of file BayerCarrier.h.

◆ isOk()

bool BayerCarrier::isOk ( ) const
inlineoverridevirtual

Check if the stream is ok or in an error state.

Returns
true iff the stream is ok

Implements yarp::os::InputStream.

Definition at line 209 of file BayerCarrier.h.

◆ isTextMode()

bool BayerCarrier::isTextMode ( ) const
inlineoverridevirtual

Check if the connection is text mode.

If it is, you are encouraged (but by no means required) to use a human-readable representation of your data structure.

Returns
true if the connection is text mode (as opposed to binary)

Implements yarp::os::ConnectionReader.

Definition at line 137 of file BayerCarrier.h.

◆ isValid()

bool BayerCarrier::isValid ( ) const
inlineoverridevirtual
Returns
true if the reader is valid. Invalid readers may signal a shutdown.

Implements yarp::os::ConnectionReader.

Definition at line 176 of file BayerCarrier.h.

◆ modifyIncomingData()

yarp::os::ConnectionReader & BayerCarrier::modifyIncomingData ( yarp::os::ConnectionReader reader)
overridevirtual

Modify incoming payload data, if appropriate.

Doesn't need to be done immediately, it is fine to hold onto a reference to the incoming data reader and use it on demand. This can be handy in order to avoid unnecessary copies.

Parameters
readerfor incoming data.
Returns
reader for modified version of incoming data.
Note
If the ConnectionReader returned is not the same as the one in input, the setParentConnectionReader(&reader) should be called for the new one, or the envelope will not be handled correctly.

Reimplemented from yarp::os::Carrier.

Definition at line 70 of file BayerCarrier.cpp.

◆ processBuffered() [1/2]

bool BayerCarrier::processBuffered ( )
virtual

Definition at line 308 of file BayerCarrier.cpp.

◆ processBuffered() [2/2]

bool BayerCarrier::processBuffered ( ) const
virtual

Definition at line 304 of file BayerCarrier.cpp.

◆ processDirect()

bool BayerCarrier::processDirect ( yarp::os::Bytes bytes)
virtual

Definition at line 325 of file BayerCarrier.cpp.

◆ pushInt()

bool BayerCarrier::pushInt ( int  x)
inlineoverridevirtual

Store an integer to return on the next call to expectInt()

Parameters
xthe integer to store
Returns
true on success

Implements yarp::os::ConnectionReader.

Definition at line 125 of file BayerCarrier.h.

◆ read()

yarp::conf::ssize_t BayerCarrier::read ( yarp::os::Bytes b)
overridevirtual

Read a block of data from the stream.

Should block and wait for data.

Parameters
b[out]the block of data to read to
Returns
the number of bytes read, or -1 upon error

Implements yarp::os::InputStream.

Definition at line 343 of file BayerCarrier.cpp.

◆ readEnvelope()

yarp::os::Bytes BayerCarrier::readEnvelope ( )
inlineoverridevirtual

Read a message envelope, if available.

Reimplemented from yarp::os::ConnectionReader.

Definition at line 160 of file BayerCarrier.h.

◆ requestDrop()

void BayerCarrier::requestDrop ( )
inlineoverridevirtual

Tag the connection to be dropped after the current message.

Implements yarp::os::ConnectionReader.

Definition at line 188 of file BayerCarrier.h.

◆ setParent()

void BayerCarrier::setParent ( yarp::os::ConnectionReader reader)
inline

Definition at line 216 of file BayerCarrier.h.

◆ setSize()

bool BayerCarrier::setSize ( size_t  len)
inlineoverridevirtual

Implements yarp::os::ConnectionReader.

Definition at line 196 of file BayerCarrier.h.

◆ toString()

std::string BayerCarrier::toString ( ) const
inlineoverridevirtual

Get name of carrier.

Returns
name of carrier.

Reimplemented from yarp::os::AbstractCarrier.

Definition at line 91 of file BayerCarrier.h.


The documentation for this class was generated from the following files: