strusAnalyzer  0.17
patternMatcherStatistics.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
10 #ifndef _STRUS_ANALYZER_PATTERN_MATCHER_STATISTICS_HPP_INCLUDED
11 #define _STRUS_ANALYZER_PATTERN_MATCHER_STATISTICS_HPP_INCLUDED
12 #include <vector>
13 
14 namespace strus {
15 namespace analyzer {
16 
19 {
20 public:
22  class Item
23  {
24  public:
26  const char* name() const {return m_name;}
28  double value() const {return m_value;}
29 
31  Item( const char* name_, double value_)
32  :m_name(name_),m_value(value_){}
34  Item( const Item& o)
35  :m_name(o.m_name),m_value(o.m_value){}
36 
38  void setValue( double value_) {m_value = value_;}
39  private:
40  const char* m_name;
41  double m_value;
42  };
46 #if __cplusplus >= 201103L
49  PatternMatcherStatistics& operator= ( PatternMatcherStatistics&& ) = default;
50  PatternMatcherStatistics& operator= ( const PatternMatcherStatistics& ) = default;
51 #else
53  :m_items(o.m_items){}
54 #endif
55 
59  void define( const char* name, double value)
60  {
61  m_items.push_back( Item( name, value));
62  }
63 
66  const std::vector<Item>& items() const {return m_items;}
67 
68 private:
69  std::vector<Item> m_items;
70 };
71 
72 }} //namespace
73 #endif
74 
Item(const char *name_, double value_)
Constructor.
Definition: patternMatcherStatistics.hpp:31
Object descriping the statistics of a token pattern match run for runtime analysis.
Definition: patternMatcherStatistics.hpp:18
PatternMatcherStatistics(const PatternMatcherStatistics &o)
Copy constructor.
Definition: patternMatcherStatistics.hpp:52
Item(const Item &o)
Copy constructor.
Definition: patternMatcherStatistics.hpp:34
const std::vector< Item > & items() const
Get all statistics items defined.
Definition: patternMatcherStatistics.hpp:66
const char * name() const
Name of the item.
Definition: patternMatcherStatistics.hpp:26
double value() const
Value of the item.
Definition: patternMatcherStatistics.hpp:28
Statistics item.
Definition: patternMatcherStatistics.hpp:22
PatternMatcherStatistics()
Constructor.
Definition: patternMatcherStatistics.hpp:44
void define(const char *name, double value)
Define statistics item.
Definition: patternMatcherStatistics.hpp:59
void setValue(double value_)
Update the statistics value.
Definition: patternMatcherStatistics.hpp:38