35template <
typename ImageType>
38 std::lock_guard<std::mutex> lock(m_mutex);
46 if (received !=
nullptr) {
49 m_lastHeight =
image.height();
50 m_lastWidth =
image.width();
53 ret =
image.copy(*last);
60 const std::string& remote,
61 const std::string& carrier)
63 std::lock_guard<std::mutex> lock(m_mutex);
65 if (!port.
open(local)) {
66 yCError(FRAMEGRABBER_NWC_YARP) <<
"Failed to open " << local <<
"port.";
69 if (!remote.empty()) {
70 yCInfo(FRAMEGRABBER_NWC_YARP) <<
"Connecting" << port.
getName() <<
"to" << remote;
72 yCError(FRAMEGRABBER_NWC_YARP) <<
"Failed to connect" << local <<
"to" << remote;
76 yCInfo(FRAMEGRABBER_NWC_YARP) <<
"No remote specified. Waiting for connection";
84 std::lock_guard<std::mutex> lock(m_mutex);
86 m_lastStamp = {0, 0.0};
103template bool StreamReceiver::lastImage<FlexImage>(
FlexImage&
image);
yarp::os::Stamp lastStamp() const
bool open(const std::string &local, const std::string &remote, const std::string &carrier)
bool lastImage(ImageType &image)
std::string getName() const override
Get name of port.
bool getEnvelope(PortReader &envelope) override
Get the envelope information (e.g., a timestamp) from the last message received on the port.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
int getPendingReads() override
Get the number of objects ready to be read.
void interrupt() override
Interrupt any current reads or writes attached to the port.
bool isClosed() override
Returns whether the port associated with this reader has been closed.
T * read(bool shouldWait=true) override
Read an available object from the port.
T * lastRead() override
Get the last data returned by read()
static bool connect(const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true)
Request that an output port connect to an input port.
An abstraction for a time stamp and/or sequence number.
Image class with user control of representation details.
bool copy(const Image &alt)
Copy operator.
#define yCInfo(component,...)
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.