21 #ifndef __SSRC_SPREAD_SCATTER_MESSAGE_H
22 #define __SSRC_SPREAD_SCATTER_MESSAGE_H
62 typedef std::pair<Message *, int> value_type;
64 Spread::scatter _scatter;
65 std::vector<value_type> _messages;
68 const Spread::scatter *scatter()
const {
72 Spread::scatter *scatter() {
80 Message * message(
const unsigned int index) {
81 return _messages[index].first;
84 void resize_message(
const unsigned int message_index,
85 const unsigned int size)
87 value_type & v = _messages[message_index];
93 _scatter.elements[v.second].buf = &((*m)[0]);
94 _scatter.elements[v.second].len = m->
size();
99 #ifdef LIBSSRCSPREAD_ENABLE_MEMBERSHIP_INFO
101 virtual int sp_get_membership_info(Spread::membership_info *info)
const {
102 return Spread::SP_scat_get_memb_info(&_scatter,
service(), info);
105 virtual int sp_get_vs_set_members(
const Spread::vs_set_info *vs_set,
107 unsigned int member_names_count)
111 Spread::SP_scat_get_vs_set_members(&_scatter, vs_set, member_names,
115 virtual int sp_get_vs_sets_info(Spread::vs_set_info *vs_sets,
116 unsigned int num_vs_sets,
121 Spread::SP_scat_get_vs_sets_info(&_scatter, vs_sets, num_vs_sets, index);
134 _scatter.num_elements = 0;
142 virtual unsigned int size()
const {
151 _scatter.num_elements = 0;
161 return _scatter.num_elements;
173 return _messages.size();
176 bool add(
const void *data,
const unsigned int size);
198 if(
add(&message[0], message.
size())) {
200 _messages.push_back(value_type(const_cast<Message*>(&message),
201 _scatter.num_elements - 1));