本文整理汇总了C++中base_stream类的典型用法代码示例。如果您正苦于以下问题:C++ base_stream类的具体用法?C++ base_stream怎么用?C++ base_stream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了base_stream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dump_internal_tree_graphviz
void base_ptree::dump_internal_tree_graphviz(base_stream &os) const {
os.writeline("graph ptree {");
os.inc_level();
dump_internal_tree_graphviz(os, head, "black");
dump_internal_tree_graphviz(os, head, 0);
os.dec_level();
os.writeline("}");
}
开发者ID:Distrotech,项目名称:mrd6,代码行数:8,代码来源:ptree.cpp
示例2: dump_cache
void aggr_source_discovery::dump_cache(base_stream &out) const {
out.writeline("Source cache");
out.inc_level();
dump_cache(out, m_cache);
out.dec_level();
}
开发者ID:NeoRaider,项目名称:mrd6,代码行数:9,代码来源:group.cpp
示例3: output
static void output(base_stream &out, const std::vector<interface *> &ifs) {
out.write("{ ");
for (std::vector<interface *>::const_iterator i = ifs.begin();
i != ifs.end(); ++i) {
if (i != ifs.begin())
out.write(", ");
out.write((*i)->name());
}
out.write(" }");
}
开发者ID:Distrotech,项目名称:mrd6,代码行数:10,代码来源:us_mfa.cpp
示例4: output_info
bool group::output_info(base_stream &_out, bool detailed) const {
_out.xprintf("Group %{Addr}\n", id());
_out.inc_level();
node::output_info(_out, std::vector<std::string>());
_out.dec_level();
return true;
}
开发者ID:NeoRaider,项目名称:mrd6,代码行数:11,代码来源:group.cpp
示例5: output_info
bool mld_interface::output_info(base_stream &ctx, const std::vector<std::string> &) const {
ctx.xprintf("MLD, version %i", (int)mif_mld_version);
if (owner()->linklocals().empty()) {
ctx.writeline(", not running");
return true;
}
ctx.newl();
ctx.inc_level();
if (!mif_isquerier) {
if (mif_querier_addr.is_any()) {
ctx.writeline("Querier: None");
} else {
ctx.xprintf("Querier: %{Addr} for %{duration}\n",
mif_querier_addr,
mif_other_querier_present_timer_id.time_left_d());
}
} else {
ctx.writeline("Querier: self");
}
ctx.dec_level();
return true;
}
开发者ID:Distrotech,项目名称:mrd6,代码行数:28,代码来源:mld_router.cpp
示例6: flap_neighbour
bool pim_interface::flap_neighbour(base_stream &out,
const std::vector<std::string> &args,
bool remove) {
if (args.empty())
return false;
inet6_addr addr;
if (!addr.set(args[0]))
return false;
pim_neighbour *neigh = 0;
neighbours_def::iterator i;
for (i = neighbours.begin(); i != neighbours.end(); i++) {
if ((*i)->has_address(addr)) {
neigh = *i;
break;
}
}
if (!neigh) {
out.writeline("No such neighbour.");
} else {
if (remove) {
neighbour_timed_out(neigh);
} else {
neighbours.erase(i);
pim->lost_neighbour(neigh);
neighbours.push_back(neigh);
pim->found_new_neighbour(neigh);
}
}
return true;
}
开发者ID:Distrotech,项目名称:mrd6,代码行数:35,代码来源:pim_interface.cpp
示例7: output_info
bool pim_router::output_info(base_stream &ctx, const std::vector<std::string> &args) const {
if (!args.empty())
return false;
ctx.writeline("PIM");
ctx.inc_level();
#ifndef PIM_NO_BSR
m_bsr.output_info(ctx);
#endif
ctx.dec_level();
return true;
}
开发者ID:Distrotech,项目名称:mrd6,代码行数:16,代码来源:pim_router.cpp
示例8: output_value
void propval_enum::output_value(base_stream &os) const {
for (entry *i = entries; i->name; i++) {
if (value == i->value) {
os.write(i->name);
return;
}
}
}
开发者ID:NeoRaider,项目名称:mrd6,代码行数:8,代码来源:node.cpp
示例9: _draw_sep
static void _draw_sep(base_stream &ctx, int n) {
char buf[64];
buf[0] = '+';
memset(buf + 1, '-', n+2);
buf[n+3] = 0;
ctx.xprintf("%s+--------------+------------+----------+\n", buf);
}
开发者ID:NeoRaider,项目名称:mrd6,代码行数:9,代码来源:timers.cpp
示例10: show_filter_routes
bool linux_unicast_router::show_filter_routes(base_stream &out,
const std::vector<std::string> &args) {
if (!args.empty()) {
out.writeline("This method accepts no arguments.");
return true;
}
const std::map<int, std::string> pmap = parse_rt_protos();
for (std::set<int>::const_iterator i = filter_protos.begin();
i != filter_protos.end(); ++i) {
std::map<int, std::string>::const_iterator j = pmap.find(*i);
if (j == pmap.end())
out.xprintf("? (%i)\n", *i);
else
out.xprintf("%s (%i)\n", j->second.c_str(), *i);
}
return true;
}
开发者ID:hugosantos,项目名称:mrd6,代码行数:21,代码来源:linux_unicast_route.cpp
示例11: output_info
bool timermgr::output_info(base_stream &ctx, bool extended) const {
size_t namelen = 20;
for (tq_def::const_iterator i = tq.begin();
namelen < 50 && i != tq.end(); ++i) {
timer_base *h = *i;
if (h->name.size() > namelen)
namelen = h->name.size();
}
if (namelen > 50)
namelen = 50;
char fmt[64];
snprintf(fmt, sizeof(fmt), "| %%%is | %%12s | %%10s | %%8s |", (int)namelen);
_draw_sep(ctx, namelen);
ctx.printf(fmt, "timer name", "time left", "interval", "repeat").newl();
_draw_sep(ctx, namelen);
char buf1[64], buf2[64];
for (tq_def::const_iterator i = tq.begin(); i != tq.end(); ++i) {
timer_base *h = *i;
_prettyprint(buf1, sizeof(buf1), h->time_left());
_prettyprint(buf2, sizeof(buf2), h->_interval);
ctx.printf(fmt, h->name.c_str(), buf1, buf2,
h->_repeat ? "true" : "false").newl();
}
_draw_sep(ctx, namelen);
return true;
}
开发者ID:NeoRaider,项目名称:mrd6,代码行数:36,代码来源:timers.cpp
示例12: call_method
bool node::call_method(int id, base_stream &out,
const std::vector<std::string> &args) {
switch (id) {
case node_method_enable:
case node_method_disable:
return enable_several(args, id == node_method_enable);
case node_method_no:
return exec_negate(out, args);
case node_method_show_properties:
{
std::string fname = m_parent ? full_name() : std::string();
for (properties::const_iterator i = m_properties.begin();
i != m_properties.end(); ++i) {
if (!fname.empty())
out.write(fname.c_str()).write(".");
out.write(i->first.c_str()).write(" = ");
if (i->second.is_property()) {
i->second.output_value(out);
if (i->second.is_readonly())
out.write(" [readonly]");
} else if (i->second.is_child()) {
out.xprintf("<node %s>", i->second.get_node()->name());
} else if (i->second.is_method()) {
if (i->second.is_readonly())
out.write("<info-method ");
else
out.write("<method ");
out.xprintf("%s>", i->second.get_method_info()->name);
}
out.newl();
}
return true;
}
}
return false;
}
开发者ID:NeoRaider,项目名称:mrd6,代码行数:39,代码来源:node.cpp
示例13: filter_routes
bool linux_unicast_router::filter_routes(base_stream &out,
const std::vector<std::string> &args) {
std::map<int, std::string> pmap = parse_rt_protos();
std::map<std::string, int> proto_map;
for (std::map<int, std::string>::const_iterator i = pmap.begin();
i != pmap.end(); ++i)
proto_map[i->second] = i->first;
std::set<int> new_filter;
for (std::vector<std::string>::const_iterator i = args.begin();
i != args.end(); ++i) {
int value = -1;
if (isdigit(*i->c_str())) {
char *endp;
value = strtol(i->c_str(), &endp, 10);
if (*endp)
value = -1;
} else {
std::map<std::string, int>::const_iterator j = proto_map.find(*i);
if (j != proto_map.end())
value = j->second;
}
if (value < 0) {
out.xprintf("Invalid argument `%s`.\n", i->c_str());
return true;
}
new_filter.insert(value);
}
filter_protos = new_filter;
return true;
}
开发者ID:hugosantos,项目名称:mrd6,代码行数:38,代码来源:linux_unicast_route.cpp
示例14: dump_internal_tree
void base_ptree::dump_internal_tree(base_stream &os, const ptree_node *node,
const char *desc) const {
if (!node)
return;
os.xprintf("%s ", desc);
if (node->_t_color == ptree_node::BLACK)
write_prefix(os, node);
else
os.write("white");
os.xprintf(" at %i", (int)node->_t_bit);
os.newl();
os.inc_level();
dump_internal_tree(os, node->_t_left, "left");
dump_internal_tree(os, node->_t_right, "right");
os.dec_level();
}
开发者ID:Distrotech,项目名称:mrd6,代码行数:19,代码来源:ptree.cpp
示例15: dump_history
void telnet_console_connection::dump_history(base_stream &out) const {
for (std::vector<std::string>::const_iterator i = history.begin();
i != history.end(); ++i) {
out.writeline(i->c_str());
}
}
开发者ID:Distrotech,项目名称:mrd6,代码行数:6,代码来源:telnet_console.cpp
示例16: output_info
void us_mfa_group::output_info(base_stream &out, bool counters, bool noempty) const {
if (counters) {
out.writeline("Aggregate activity statistics:");
out.inc_level();
if (stat_packet_count60s) {
const char *format = "%.2f %s";
double rate = 8 * stat_octet_count60s / 60000.;
const char *unit = "Kb/s";
if (rate > 1000) {
rate /= 1000.;
unit = "Mb/s";
}
out.write("Current rate: ");
out.printf(format, rate, unit);
out.printf(" (%.2f pkt/s)", stat_packet_count60s / 60.f);
out.newl();
out.printf("Last 60 secs: %llu bytes (%llu packets, %.2lf bytes/packet)",
stat_octet_count60s, stat_packet_count60s,
stat_octet_count60s / (double)stat_packet_count60s);
out.newl();
} else {
out.writeline("No available statistics");
}
out.dec_level();
}
/* no active sources */
if (counters && noempty && !stat_packet_count60s)
return;
out.writeline("Sources:");
out.inc_level();
if (m_sources.empty()) {
out.writeline("(None)");
} else {
for (sources::const_iterator i = m_sources.begin();
i != m_sources.end(); ++i) {
i->second->output_info(out, counters, noempty);
}
}
out.dec_level();
}
开发者ID:Distrotech,项目名称:mrd6,代码行数:49,代码来源:us_mfa.cpp
示例17: call_method
bool pim_router::call_method(int id, base_stream &out,
const std::vector<std::string> &args) {
if (id == pim_router_method_rpf) {
if (args.size() != 1)
return false;
inet6_addr addr;
if (!addr.set(args[0].c_str()))
return false;
pim_neighbour *neigh = get_rpf_neighbour(addr);
if (neigh) {
neigh->output_info(out, false);
} else {
out.writeline("No RPF neighbor.");
}
return true;
} else if (id == pim_router_method_group_rp) {
if (args.size() != 1)
return false;
inet6_addr addr;
if (!addr.set(args[0].c_str()))
return false;
pim_groupconf_node *pconf = 0;
groupconf *conf = g_mrd->match_group_configuration(addr);
while (conf && !pconf) {
pconf = (pim_groupconf_node *)conf->get_child("pim");
conf = g_mrd->get_similar_groupconf_node(conf);
}
if (!pconf) {
out.writeline("No available configuration.");
return true;
}
in6_addr rpaddr;
rp_source src;
if (pconf->rp_for_group(addr, rpaddr, src)) {
out.xprintf("RP: %{addr} [", rpaddr);
if (src == rps_static)
out.write("static");
else if (src == rps_embedded)
out.write("embedded");
else if (src == rps_rp_set)
out.write("rp_set");
else
out.write("unknown");
out.writeline("]");
} else {
out.writeline("No available RP");
}
return true;
} else if (id == pim_router_method_group_summary) {
if (args.size() > 1)
return false;
inet6_addr mask;
if (!args.empty()) {
if (!mask.set(args[0].c_str()))
return false;
}
mrd::group_list::const_iterator i = g_mrd->group_table().begin();
for (; i != g_mrd->group_table().end(); ++i) {
if (!mask.matches(i->first))
continue;
pim_group_node *grp =
(pim_group_node *)i->second->node_owned_by(this);
if (!grp)
continue;
out.xprintf("%{Addr}\n", i->first);
out.inc_level();
if (grp->wildcard()) {
out.xprintf("Wildcard present, RP is at %{addr}\n", grp->rpaddr());
}
int count = grp->source_state_set().size();
out.xprintf("Has %i state%s.\n", count, count > 1 ? "s" : "");
int local = grp->local_source_state_set().size();
if (local > 0) {
out.xprintf("Of which %i %s local.\n", local, local > 1 ? "are" : "is");
}
out.dec_level();
}
return true;
}
//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:mrd6,代码行数:101,代码来源:pim_router.cpp
示例18: output_info
bool pim_interface::output_info(base_stream &ctx, bool extended) const {
if (get_state() == NOT_READY)
return false;
ctx.writeline("PIM");
ctx.inc_level();
ctx.xprintf("DR Priority: %u\n", conf()->dr_priority());
ctx.xprintf("LAN Propagation Delay: %ums Override Interval: %ums\n",
conf()->propagation_delay(), conf()->override_interval());
if (elected_dr)
ctx.xprintf("DR: %{Addr}\n", elected_dr->localaddr());
else
ctx.writeline("DR: self");
ctx.writeline("Neighbours:");
ctx.inc_level();
if (neighbours.empty()) {
ctx.writeline("(None)");
} else {
for (neighbours_def::const_iterator j = neighbours.begin();
j != neighbours.end(); j++) {
(*j)->output_info(ctx, extended);
}
}
ctx.dec_level();
ctx.dec_level();
return true;
}
开发者ID:Distrotech,项目名称:mrd6,代码行数:36,代码来源:pim_interface.cpp
示例19: dump_filter
void group_interface::dump_filter(base_stream &os) const {
os.xprintf("%s %{addrset}",
(filter_mode() == include ? "Include" : "Exclude"),
(filter_mode() == include ? include_set() : exclude_set()));
}
开发者ID:NeoRaider,项目名称:mrd6,代码行数:5,代码来源:group.cpp
示例20: stream_push_formated_type
void stream_push_formated_type(base_stream &os, const time_duration &d) {
char *p = os.req_buffer(64);
_prettyprint(p, 64, d.value);
os.commit_change(strlen(p));
}
开发者ID:NeoRaider,项目名称:mrd6,代码行数:5,代码来源:timers.cpp
注:本文中的base_stream类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论