mirror of
				https://github.com/zeromq/libzmq.git
				synced 2025-10-27 19:10:22 +01:00 
			
		
		
		
	Make it explicit that the probe function doesn't modify passed message
This commit is contained in:
		| @@ -111,7 +111,7 @@ namespace zmq | |||||||
|             return has_msg; |             return has_msg; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         inline bool probe (bool (*fn)(msg_t &)) |         inline bool probe (bool (*fn)(const msg_t &)) | ||||||
|         { |         { | ||||||
|             scoped_lock_t lock (sync); |             scoped_lock_t lock (sync); | ||||||
|             return (*fn) (*front); |             return (*fn) (*front); | ||||||
|   | |||||||
| @@ -267,7 +267,7 @@ bool zmq::msg_t::is_identity () const | |||||||
|     return (u.base.flags & identity) == identity; |     return (u.base.flags & identity) == identity; | ||||||
| } | } | ||||||
|  |  | ||||||
| bool zmq::msg_t::is_delimiter () | bool zmq::msg_t::is_delimiter () const | ||||||
| { | { | ||||||
|     return u.base.type == type_delimiter; |     return u.base.type == type_delimiter; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -70,7 +70,7 @@ namespace zmq | |||||||
|         int64_t fd (); |         int64_t fd (); | ||||||
|         void set_fd (int64_t fd_); |         void set_fd (int64_t fd_); | ||||||
|         bool is_identity () const; |         bool is_identity () const; | ||||||
|         bool is_delimiter (); |         bool is_delimiter () const; | ||||||
|         bool is_vsm (); |         bool is_vsm (); | ||||||
|         bool is_cmsg (); |         bool is_cmsg (); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -406,7 +406,7 @@ void zmq::pipe_t::terminate (bool delay_) | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| bool zmq::pipe_t::is_delimiter (msg_t &msg_) | bool zmq::pipe_t::is_delimiter (const msg_t &msg_) | ||||||
| { | { | ||||||
|     return msg_.is_delimiter (); |     return msg_.is_delimiter (); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -199,7 +199,7 @@ namespace zmq | |||||||
|         blob_t identity; |         blob_t identity; | ||||||
|  |  | ||||||
|         //  Returns true if the message is delimiter; false otherwise. |         //  Returns true if the message is delimiter; false otherwise. | ||||||
|         static bool is_delimiter (msg_t &msg_); |         static bool is_delimiter (const msg_t &msg_); | ||||||
|  |  | ||||||
|         //  Computes appropriate low watermark from the given high watermark. |         //  Computes appropriate low watermark from the given high watermark. | ||||||
|         static int compute_lwm (int hwm_); |         static int compute_lwm (int hwm_); | ||||||
|   | |||||||
| @@ -166,7 +166,7 @@ namespace zmq | |||||||
|         //  Applies the function fn to the first elemenent in the pipe |         //  Applies the function fn to the first elemenent in the pipe | ||||||
|         //  and returns the value returned by the fn. |         //  and returns the value returned by the fn. | ||||||
|         //  The pipe mustn't be empty or the function crashes. |         //  The pipe mustn't be empty or the function crashes. | ||||||
|         inline bool probe (bool (*fn)(T &)) |         inline bool probe (bool (*fn)(const T &)) | ||||||
|         { |         { | ||||||
|                 bool rc = check_read (); |                 bool rc = check_read (); | ||||||
|                 zmq_assert (rc); |                 zmq_assert (rc); | ||||||
|   | |||||||
| @@ -37,7 +37,7 @@ namespace zmq | |||||||
|         virtual bool flush () = 0; |         virtual bool flush () = 0; | ||||||
|         virtual bool check_read () = 0; |         virtual bool check_read () = 0; | ||||||
|         virtual bool read (T *value_) = 0; |         virtual bool read (T *value_) = 0; | ||||||
|         virtual bool probe (bool (*fn)(T &)) = 0; |         virtual bool probe (bool (*fn)(const T &)) = 0; | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -107,7 +107,7 @@ namespace zmq | |||||||
|         //  Applies the function fn to the first elemenent in the pipe |         //  Applies the function fn to the first elemenent in the pipe | ||||||
|         //  and returns the value returned by the fn. |         //  and returns the value returned by the fn. | ||||||
|         //  The pipe mustn't be empty or the function crashes. |         //  The pipe mustn't be empty or the function crashes. | ||||||
|         inline bool probe (bool (*fn)(T &)) |         inline bool probe (bool (*fn)(const T &)) | ||||||
|         { |         { | ||||||
|             return dbuffer.probe (fn); |             return dbuffer.probe (fn); | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Martin Hurton
					Martin Hurton