Overview Tutorial API reference Examples Build Download | ZmqMessage 0.1 - 21 Oct 2011 |
#include <ZmqMessage.hpp>
Inheritance diagram for ZmqMessage::Incoming< RoutingPolicy >:
Public Types | |
typedef RoutingPolicy | RoutingPolicyType |
Public Member Functions | |
Incoming (zmq::socket_t &sock) | |
zmq::socket_t & | src () |
bool | is_terminal () const |
void | check_is_terminal () const throw (MessageFormatError) |
void | validate (const char *part_names[], size_t part_names_length, bool strict) throw (MessageFormatError) |
Incoming< RoutingPolicy > & | receive (size_t parts, const char *part_names[], size_t part_names_length, bool check_terminal) throw (MessageFormatError, ZmqErrorType) |
template<size_t N> | |
Incoming< RoutingPolicy > & | receive (std::tr1::array< const char *, N > part_names, bool check_terminal) throw (MessageFormatError) |
Incoming< RoutingPolicy > & | receive (size_t parts, bool check_terminal) throw (MessageFormatError, ZmqErrorType) |
Incoming< RoutingPolicy > & | receive (size_t parts, const char *part_names[], bool check_terminal) throw (MessageFormatError, ZmqErrorType) |
Incoming< RoutingPolicy > & | receive_all (const size_t min_parts, const char *part_names[], size_t part_names_length) throw (MessageFormatError, ZmqErrorType) |
Incoming< RoutingPolicy > & | receive_all (const size_t min_parts, const char *part_names[]) throw (MessageFormatError, ZmqErrorType) |
Incoming< RoutingPolicy > & | receive_all () throw (MessageFormatError, ZmqErrorType) |
Incoming< RoutingPolicy > & | receive_all (const size_t min_parts) throw (MessageFormatError, ZmqErrorType) |
Incoming< RoutingPolicy > & | receive_up_to (size_t min_parts, const char *part_names[], size_t max_parts) throw (MessageFormatError, ZmqErrorType) |
int | fetch_tail (std::vector< char > &area, const char *delimiter=0) throw (ZmqErrorType) |
int | drop_tail () throw (ZmqErrorType) |
template<typename T> | |
Incoming< RoutingPolicy > & | operator>> (T &t) throw (NoSuchPartError) |
Incoming< RoutingPolicy > & | operator>> (zmq::message_t &msg) throw (NoSuchPartError) |
Incoming< RoutingPolicy > & | operator>> (Incoming< RoutingPolicy > &(*f)(Incoming< RoutingPolicy > &)) |
void | set_binary () |
void | set_text () |
Friends | |
class | Outgoing |
Incoming< RoutingPolicy > & | Skip (Incoming< RoutingPolicy > &) |
Skip current message part in incoming message. |
RoutingPolicy either SimpleRouting or XRouting - rules for receiving routing info.
zasync.cpp, zbisort.cpp, zqueue.cpp, zserialize.cpp, and zsort.cpp.
typedef RoutingPolicy ZmqMessage::Incoming< RoutingPolicy >::RoutingPolicyType |
ZmqMessage::Incoming< RoutingPolicy >::Incoming | ( | zmq::socket_t & | sock | ) | [inline, explicit] |
void ZmqMessage::Incoming< RoutingPolicy >::check_is_terminal | ( | ) | const throw (MessageFormatError) |
If received message is not already terminal (has no pending parts), throws MessageFormatError exception.
int ZmqMessage::Incoming< RoutingPolicy >::drop_tail | ( | ) | throw (ZmqErrorType) |
Fetch all messages starting from tail message and drop them until there will be no more parts on socket.
int ZmqMessage::Incoming< RoutingPolicy >::fetch_tail | ( | std::vector< char > & | area, | |
const char * | delimiter = 0 | |||
) | throw (ZmqErrorType) |
Fetch all messages starting from tail message until there will be no more parts on socket. So the resulting data will be: { parts_[N-1] | message, ... }
area | - result stored here | |
delimiter | - null terminated string, inserted between parts |
bool ZmqMessage::Incoming< RoutingPolicy >::is_terminal | ( | ) | const [inline] |
Incoming<RoutingPolicy>& ZmqMessage::Incoming< RoutingPolicy >::operator>> | ( | Incoming< RoutingPolicy > &(*)(Incoming< RoutingPolicy > &) | f | ) | [inline] |
Handle a manipulator
Incoming< RoutingPolicy > & ZmqMessage::Incoming< RoutingPolicy >::operator>> | ( | zmq::message_t & | msg | ) | throw (NoSuchPartError) |
Extract following message part's content by copying it into given message
Incoming< RoutingPolicy > & ZmqMessage::Incoming< RoutingPolicy >::operator>> | ( | T & | t | ) | throw (NoSuchPartError) |
After we have received message parts, we can extract message parts content into variables, one by one. Message content is copied for types that actually hold data, not just wrap it.
Incoming<RoutingPolicy>& ZmqMessage::Incoming< RoutingPolicy >::receive | ( | size_t | parts, | |
const char * | part_names[], | |||
bool | check_terminal | |||
) | throw (MessageFormatError, ZmqErrorType) [inline] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. assume size of part_names == parts
Incoming<RoutingPolicy>& ZmqMessage::Incoming< RoutingPolicy >::receive | ( | size_t | parts, | |
bool | check_terminal | |||
) | throw (MessageFormatError, ZmqErrorType) [inline] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Part names are omitted
Incoming<RoutingPolicy>& ZmqMessage::Incoming< RoutingPolicy >::receive | ( | std::tr1::array< const char *, N > | part_names, | |
bool | check_terminal | |||
) | throw (MessageFormatError) [inline] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Incoming< RoutingPolicy > & ZmqMessage::Incoming< RoutingPolicy >::receive | ( | size_t | parts, | |
const char * | part_names[], | |||
size_t | part_names_length, | |||
bool | check_terminal | |||
) | throw (MessageFormatError, ZmqErrorType) |
Receive definite number of message parts.
parts | number of parts to receive | |
part_names | array of parts names for error reporting and debug purposes | |
part_names_length | length of part_names array | |
check_terminal | if true, message may contain not more then parts number of parts. |
Incoming<RoutingPolicy>& ZmqMessage::Incoming< RoutingPolicy >::receive_all | ( | const size_t | min_parts | ) | throw (MessageFormatError, ZmqErrorType) [inline] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Part names are unknown.
Incoming<RoutingPolicy>& ZmqMessage::Incoming< RoutingPolicy >::receive_all | ( | ) | throw (MessageFormatError, ZmqErrorType) [inline] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. No minimum parts limit (may be 0)
Incoming<RoutingPolicy>& ZmqMessage::Incoming< RoutingPolicy >::receive_all | ( | const size_t | min_parts, | |
const char * | part_names[] | |||
) | throw (MessageFormatError, ZmqErrorType) [inline] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. assume size of part_names == min_parts
Incoming< RoutingPolicy > & ZmqMessage::Incoming< RoutingPolicy >::receive_all | ( | const size_t | min_parts, | |
const char * | part_names[], | |||
size_t | part_names_length | |||
) | throw (MessageFormatError, ZmqErrorType) |
Receives ALL messages available on socket. (min min_parts
, max unbounded). Multipart message will be considered terminal.
Incoming< RoutingPolicy > & ZmqMessage::Incoming< RoutingPolicy >::receive_up_to | ( | size_t | min_parts, | |
const char * | part_names[], | |||
size_t | max_parts | |||
) | throw (MessageFormatError, ZmqErrorType) |
Receives up to max_parts messages available on socket (but not less than min_parts). Assume that length of part_names == min_parts
void ZmqMessage::Incoming< RoutingPolicy >::set_binary | ( | ) | [inline] |
Set stream mode to Binary: all subsequent non-string data is extracted from ZMQ message as binary data See modes
void ZmqMessage::Incoming< RoutingPolicy >::set_text | ( | ) | [inline] |
Set stream mode to Text (default): all subsequent non-string data is converted to string (by writing to stream) after being extracted from ZMQ message. See modes
zmq::socket_t& ZmqMessage::Incoming< RoutingPolicy >::src | ( | ) | [inline] |
void ZmqMessage::Incoming< RoutingPolicy >::validate | ( | const char * | part_names[], | |
size_t | part_names_length, | |||
bool | strict | |||
) | throw (MessageFormatError) |
Validate that message contains definite number of message parts.
part_names | array of parts names for error reporting and debug purposes | |
part_names_length | length of part_names array | |
strict | if true, message MUST contain exactly part_names_length parts. Otherwise it MUST contain at least part_names_length parts. |
friend class Outgoing [friend] |
Incoming<RoutingPolicy>& Skip | ( | Incoming< RoutingPolicy > & | in | ) | [friend] |
Skip current message part in incoming message.
When passed to Incoming
(operator >>) just skips current message and moves receive pointer to next one. Also, usual checking that current part exists is performed.