[checkmk-commits] Mark IntColumn::getValue() call sites.

Sven Panne sp at mathias-kettner.de
Fri Nov 3 14:20:40 CET 2017


Module: check_mk
Branch: master
Commit: 79538afe157b2b983071e81e132660effa199a83
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=79538afe157b2b983071e81e132660effa199a83

Author: Sven Panne <sp at mathias-kettner.de>
Date:   Fri Nov  3 13:36:10 2017 +0100

Mark IntColumn::getValue() call sites.

This is an intermediate step to improve time zone handling.  Tiny cleanup on
the way.

Change-Id: I835d46334a5da0a7ddf2d644134b744d3a970b9b

---

 livestatus/src/AttributeListAsIntColumn.cc | 12 +++++++-----
 livestatus/src/AttributeListAsIntColumn.h  |  3 +--
 livestatus/src/AttributeListColumn.cc      |  4 ++--
 livestatus/src/IntAggregator.cc            |  1 +
 livestatus/src/IntColumn.cc                |  1 +
 livestatus/src/IntFilter.cc                |  1 +
 livestatus/src/TimeColumn.cc               |  1 +
 7 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/livestatus/src/AttributeListAsIntColumn.cc b/livestatus/src/AttributeListAsIntColumn.cc
index 583d346..7b5db62 100644
--- a/livestatus/src/AttributeListAsIntColumn.cc
+++ b/livestatus/src/AttributeListAsIntColumn.cc
@@ -88,12 +88,14 @@ int32_t AttributeListAsIntColumn::getValue(
 }
 
 std::vector<std::string> AttributeListAsIntColumn::getAttributes(
-    Row row, const contact *auth_user) const {
-    modified_atttibutes values(getValue(row, auth_user));
+    Row row) const {
     std::vector<std::string> attributes;
-    for (const auto &entry : known_attributes) {
-        if (values[entry.second]) {
-            attributes.push_back(entry.first);
+    if (auto p = columnData<unsigned long>(row)) {
+        modified_atttibutes values(*p);
+        for (const auto &entry : known_attributes) {
+            if (values[entry.second]) {
+                attributes.push_back(entry.first);
+            }
         }
     }
     return attributes;
diff --git a/livestatus/src/AttributeListAsIntColumn.h b/livestatus/src/AttributeListAsIntColumn.h
index 80be7ba..ddfd4b0 100644
--- a/livestatus/src/AttributeListAsIntColumn.h
+++ b/livestatus/src/AttributeListAsIntColumn.h
@@ -50,8 +50,7 @@ public:
 
     int32_t getValue(Row row, const contact *auth_user) const override;
 
-    std::vector<std::string> getAttributes(Row row,
-                                           const contact *auth_user) const;
+    std::vector<std::string> getAttributes(Row row) const;
 };
 
 #endif  // AttributeListAsIntColumn_h
diff --git a/livestatus/src/AttributeListColumn.cc b/livestatus/src/AttributeListColumn.cc
index 60c0d7d..0deafa9 100644
--- a/livestatus/src/AttributeListColumn.cc
+++ b/livestatus/src/AttributeListColumn.cc
@@ -34,7 +34,7 @@ std::unique_ptr<Filter> AttributeListColumn::createFilter(
 }
 
 std::vector<std::string> AttributeListColumn::getValue(
-    Row row, const contact *auth_user,
+    Row row, const contact * /*auth_user*/,
     std::chrono::seconds /*timezone_offset*/) const {
-    return _int_view_column.getAttributes(row, auth_user);
+    return _int_view_column.getAttributes(row);
 }
diff --git a/livestatus/src/IntAggregator.cc b/livestatus/src/IntAggregator.cc
index 4043f53..4cbc93b 100644
--- a/livestatus/src/IntAggregator.cc
+++ b/livestatus/src/IntAggregator.cc
@@ -32,6 +32,7 @@
 void IntAggregator::consume(Row row, const contact *auth_user,
                             std::chrono::seconds /* timezone_offset */) {
     _count++;
+    // NOTE: IntColumn::getValue() call site
     int32_t value = _column->getValue(row, auth_user);
     switch (getOperation()) {
         case StatsOperation::sum:
diff --git a/livestatus/src/IntColumn.cc b/livestatus/src/IntColumn.cc
index f7ab6a7..737e8bb 100644
--- a/livestatus/src/IntColumn.cc
+++ b/livestatus/src/IntColumn.cc
@@ -31,6 +31,7 @@
 
 void IntColumn::output(Row row, RowRenderer &r, const contact *auth_user,
                        std::chrono::seconds /*timezone_offset*/) const {
+    // NOTE: IntColumn::getValue() call site
     r.output(getValue(row, auth_user));
 }
 
diff --git a/livestatus/src/IntFilter.cc b/livestatus/src/IntFilter.cc
index 42e5100..8683f18 100644
--- a/livestatus/src/IntFilter.cc
+++ b/livestatus/src/IntFilter.cc
@@ -47,6 +47,7 @@ int32_t IntFilter::convertRefValue(std::chrono::seconds timezone_offset) const {
 
 bool IntFilter::accepts(Row row, const contact *auth_user,
                         std::chrono::seconds timezone_offset) const {
+    // NOTE: IntColumn::getValue() call site
     int32_t act_value = _column.getValue(row, auth_user);
     int32_t ref_value = convertRefValue(timezone_offset);
     switch (_relOp) {
diff --git a/livestatus/src/TimeColumn.cc b/livestatus/src/TimeColumn.cc
index 0ebca0d..cc262ce 100644
--- a/livestatus/src/TimeColumn.cc
+++ b/livestatus/src/TimeColumn.cc
@@ -32,6 +32,7 @@
 
 void TimeColumn::output(Row row, RowRenderer &r, const contact *auth_user,
                         std::chrono::seconds /*timezone_offset*/) const {
+    // NOTE: IntColumn::getValue() call site
     r.output(std::chrono::system_clock::from_time_t(getValue(row, auth_user)));
 }
 



More information about the checkmk-commits mailing list