本文整理汇总了C++中Subscription::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Subscription::size方法的具体用法?C++ Subscription::size怎么用?C++ Subscription::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscription
的用法示例。
在下文中一共展示了Subscription::size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pushBackVal
std::vector<unsigned char> aggregator_solver::makeSubscribeReqMsg(Subscription& rules) {
//The total length starts out at one for the message type field.
//Each rule will add additional length.
uint32_t total_length = 1;
std::vector<unsigned char> buff;
buff.push_back(0);
buff.push_back(0);
buff.push_back(0);
buff.push_back(0);
buff.push_back((unsigned char)subscription_request);
//Push back the rules
{
//First push the number of rules onto the buffer
uint32_t num_rules = rules.size();
total_length += pushBackVal(num_rules, buff);
//For each rule push back the physical layer, the number of
//tx rules and the tx rules, the number of boxes and the boxes,
//and the number of FSM/TR rules and the FSM/TR rules.
for (auto rule = rules.begin(); rule != rules.end(); ++rule) {
//Push the physical layer
total_length += pushBackVal(rule->physical_layer, buff);
//Push the transmitter information
uint32_t num_txers = rule->txers.size();
total_length += pushBackVal(num_txers, buff);
//Each transmitter is made of an ID and a MASK
for (auto txer = rule->txers.begin(); txer != rule->txers.end(); ++txer) {
total_length += pushBackVal(txer->base_id, buff);
total_length += pushBackVal(txer->mask, buff);
}
//Finish the rule with the update interval
total_length += pushBackVal(rule->update_interval, buff);
}
}
//Store the message length in the first four bytes
pushBackVal<uint32_t>(total_length, buff, 0);
return buff;
}