Commit a1107af9 authored by Yoshitaka Aharen's avatar Yoshitaka Aharen
Browse files

[2157] renamed CounterTypeTree to CounterSpec

parent a0f35ebd
...@@ -263,7 +263,7 @@ def generate_cxx(itemsfile, ccfile, utfile, def_mtime): ...@@ -263,7 +263,7 @@ def generate_cxx(itemsfile, ccfile, utfile, def_mtime):
'", NULL, ' + item['index'] + ' },\n' '", NULL, ' + item['index'] + ' },\n'
) )
else: else:
item_names_current_ = ['const struct CounterTypeTree ' + item_names_current_ = ['const struct CounterSpec ' +
item['index'] + '[] = {\n'] item['index'] + '[] = {\n']
msg_counter_types, item_names_current_, item_names = \ msg_counter_types, item_names_current_, item_names = \
convert_list(item['child'], msg_counter_types, convert_list(item['child'], msg_counter_types,
...@@ -277,7 +277,7 @@ def generate_cxx(itemsfile, ccfile, utfile, def_mtime): ...@@ -277,7 +277,7 @@ def generate_cxx(itemsfile, ccfile, utfile, def_mtime):
msg_counter_types, item_names_current, item_names = \ msg_counter_types, item_names_current, item_names = \
convert_list(item_list, msg_counter_types, [], item_names) convert_list(item_list, msg_counter_types, [], item_names)
item_names.append('const struct CounterTypeTree msg_counter_tree[] = {\n') item_names.append('const struct CounterSpec msg_counter_tree[] = {\n')
item_names.extend(item_names_current) item_names.extend(item_names_current)
item_names.append(' { NULL, NULL, NOT_ITEM }\n' + item_names.append(' { NULL, NULL, NOT_ITEM }\n' +
'};\n') '};\n')
......
...@@ -44,17 +44,17 @@ namespace { ...@@ -44,17 +44,17 @@ namespace {
void void
fillNodes(const Counter& counter, fillNodes(const Counter& counter,
const struct isc::auth::statistics::CounterTypeTree type_tree[], const struct isc::auth::statistics::CounterSpec type_tree[],
isc::auth::statistics::Counters::ItemTreePtr& trees) isc::auth::statistics::Counters::ItemTreePtr& trees)
{ {
using namespace isc::data; using namespace isc::data;
for (int i = 0; type_tree[i].name != NULL; ++i) { for (int i = 0; type_tree[i].name != NULL; ++i) {
if (type_tree[i].sub_tree != NULL) { if (type_tree[i].sub_counters != NULL) {
isc::auth::statistics::Counters::ItemTreePtr sub_tree = isc::auth::statistics::Counters::ItemTreePtr sub_counters =
Element::createMap(); Element::createMap();
trees->set(type_tree[i].name, sub_tree); trees->set(type_tree[i].name, sub_counters);
fillNodes(counter, type_tree[i].sub_tree, sub_tree); fillNodes(counter, type_tree[i].sub_counters, sub_counters);
} else { } else {
trees->set(type_tree[i].name, trees->set(type_tree[i].name,
Element::create(static_cast<long int>( Element::create(static_cast<long int>(
......
...@@ -22,9 +22,9 @@ namespace isc { ...@@ -22,9 +22,9 @@ namespace isc {
namespace auth { namespace auth {
namespace statistics { namespace statistics {
struct CounterTypeTree { struct CounterSpec {
const char* const name; const char* const name;
const struct CounterTypeTree* const sub_tree; const struct CounterSpec* const sub_counters;
const int counter_id; const int counter_id;
}; };
......
...@@ -135,13 +135,13 @@ TEST_F(CountersTest, incrementNormalQuery) { ...@@ -135,13 +135,13 @@ TEST_F(CountersTest, incrementNormalQuery) {
} }
int int
countTreeElements(const struct CounterTypeTree* tree) { countTreeElements(const struct CounterSpec* tree) {
int count = 0; int count = 0;
for (int i = 0; tree[i].name != NULL; ++i) { for (int i = 0; tree[i].name != NULL; ++i) {
if (tree[i].sub_tree == NULL) { if (tree[i].sub_counters == NULL) {
++count; ++count;
} else { } else {
count += countTreeElements(tree[i].sub_tree); count += countTreeElements(tree[i].sub_counters);
} }
} }
return (count); return (count);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment