29 #ifndef ROSCPP_MESSAGE_EVENT_H 30 #define ROSCPP_MESSAGE_EVENT_H 53 return std::make_shared<M>();
79 : nonconst_need_copy_(true)
95 nonconst_need_copy_ = nonconst_need_copy;
101 nonconst_need_copy_ = nonconst_need_copy;
129 init(message, connection_header, receipt_time, nonconst_need_copy, create);
132 void init(
const ConstMessagePtr&
message,
const std::shared_ptr<M_string>& connection_header,
rs2rosinternal::Time receipt_time,
bool nonconst_need_copy,
const CreateFunction& create)
135 connection_header_ = connection_header;
136 receipt_time_ = receipt_time;
137 nonconst_need_copy_ = nonconst_need_copy;
144 message_copy_.reset();
150 message_copy_.reset();
160 return copyMessageIfNecessary<M>();
186 bool operator<(const MessageEvent<M>& rhs)
188 if (message_ != rhs.message_)
190 return message_ < rhs.message_;
193 if (receipt_time_ != rhs.receipt_time_)
195 return receipt_time_ < rhs.receipt_time_;
198 return nonconst_need_copy_ < rhs.nonconst_need_copy_;
208 return !(*
this == rhs);
214 template<
typename M2>
219 return std::const_pointer_cast<Message>(message_);
224 return message_copy_;
228 message_copy_ = create_();
229 *message_copy_ = *message_;
231 return message_copy_;
234 template<
typename M2>
237 return std::const_pointer_cast<Message>(message_);
256 #endif // ROSCPP_MESSAGE_EVENT_H MessageEvent(const MessageEvent< Message > &rhs, bool nonconst_need_copy)
GLenum GLuint GLenum GLsizei const GLchar * message
MessageEvent(const ConstMessagePtr &message, rs2rosinternal::Time receipt_time)
MessageEvent(const MessageEvent< void const > &rhs, const CreateFunction &create)
rs2rosinternal::Time getReceiptTime() const
Returns the time at which this message was received.
std::remove_const< M >::type Message
boost::add_const< M >::type ConstMessage
GLsizei const GLchar *const * string
MessageEvent(const ConstMessagePtr &message)
Event type for subscriptions, const rs2rosinternal::MessageEvent<M const>& can be used in your callba...
ROS_DEPRECATED std::shared_ptr< M > defaultMessageCreateFunction()
bool nonConstWillCopy() const
void operator=(const MessageEvent< ConstMessage > &rhs)
boost::function< MessagePtr()> CreateFunction
boost::enable_if< boost::is_void< M2 >, std::shared_ptr< M > >::type copyMessageIfNecessary() const
std::shared_ptr< Message > MessagePtr
const std::string & getPublisherName() const
Returns the name of the node which published this message.
MessageEvent(const MessageEvent< Message > &rhs)
M_string & getConnectionHeader() const
Retrieve the connection header.
MessageEvent(const MessageEvent< ConstMessage > &rhs)
std::map< std::string, std::string > M_string
Time representation. May either represent wall clock time or ROS clock time.
const std::shared_ptr< ConstMessage > & getConstMessage() const
Retrieve a const version of the message.
std::shared_ptr< M > getMessage() const
Retrieve the message. If M is const, this returns a reference to it. If M is non const and this event...
std::shared_ptr< ConstMessage > ConstMessagePtr
MessageEvent(const ConstMessagePtr &message, const std::shared_ptr< M_string > &connection_header, rs2rosinternal::Time receipt_time, bool nonconst_need_copy, const CreateFunction &create)
bool operator==(const MessageEvent< M > &rhs)
void init(const ConstMessagePtr &message, const std::shared_ptr< M_string > &connection_header, rs2rosinternal::Time receipt_time, bool nonconst_need_copy, const CreateFunction &create)
const CreateFunction & getMessageFactory() const
MessageEvent(const MessageEvent< ConstMessage > &rhs, bool nonconst_need_copy)
static const std::string s_unknown_publisher_string_
bool getMessageWillCopy() const
boost::disable_if< boost::is_void< M2 >, std::shared_ptr< M > >::type copyMessageIfNecessary() const
void operator=(const MessageEvent< Message > &rhs)
rs2rosinternal::Time receipt_time_
bool operator!=(const MessageEvent< M > &rhs)
static Time now()
Retrieve the current time. If ROS clock time is in use, this returns the time according to the ROS cl...
MessageEvent(const ConstMessagePtr &message, const std::shared_ptr< M_string > &connection_header, rs2rosinternal::Time receipt_time)
const std::shared_ptr< M_string > & getConnectionHeaderPtr() const
std::shared_ptr< M_string > connection_header_
std::shared_ptr< M > operator()()