diff --git a/.vscode/settings.json b/.vscode/settings.json index 3ff8f20..4531e4f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,6 +4,10 @@ "ostream": "cpp", "string": "cpp", "vector": "cpp", - "map": "cpp" + "map": "cpp", + "*.tcc": "cpp", + "deque": "cpp", + "unordered_map": "cpp", + "system_error": "cpp" } } \ No newline at end of file diff --git a/lib/metrics.hpp b/lib/metrics.hpp index c75e279..a580079 100644 --- a/lib/metrics.hpp +++ b/lib/metrics.hpp @@ -54,6 +54,17 @@ class Metrics { */ vector keys(); + /** + * Metoda vraća map svih mjerenja + */ + map get_data(); + + /** + * Metoda vraća map svih mjerenja i resetira brojače + */ + map get_data_and_clear(); + + }; diff --git a/src/metrics.cpp b/src/metrics.cpp index 4bed1d9..bdc0ce6 100644 --- a/src/metrics.cpp +++ b/src/metrics.cpp @@ -22,3 +22,14 @@ vector marcelb::Metrics::keys() { return _keys; } + +map marcelb::Metrics::get_data() { + return counters; +} + + +map marcelb::Metrics::get_data_and_clear() { + auto data = counters; + clear(); + return counters; +} \ No newline at end of file diff --git a/test/test b/test/test index e3549b3..3733600 100755 Binary files a/test/test and b/test/test differ diff --git a/test/test.cpp b/test/test.cpp index 258c48b..cc0fa24 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -17,5 +17,6 @@ int main() { cout << " access " << metrika["access"] << endl; + return 0; } \ No newline at end of file