summaryrefslogtreecommitdiffstats
path: root/tester/covoar/Explanations.h
blob: c147c119081c0fcbe6b1619ad8628db9c8ff2a92 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*! @file Explanations.h
 *  @brief Explanations Specification
 *
 *  This file contains the specification of the Explanations class.
 */

#ifndef __EXPLANATIONS_H__
#define __EXPLANATIONS_H__

#include <map>
#include <stdint.h>
#include <string>
#include <vector>

namespace Coverage {

  /*! @class Explanation
   *
   *  This class defines the information that comprises an explanation
   *  of an uncovered range or branch.
   */
  class Explanation {

  public:

    /*!
     *  This member variable contains the starting line number of
     *  the uncovered range or branch.
     */
    std::string startingPoint;

    /*!
     *  This member variable contains the classification of
     *  the explanation.
     */
    std::string classification;

    /*!
     *  This member variable contains the multi-line explanation text.
     */
    std::vector<std::string> explanation;

    /*!
     *  This member variable indicates whether this explanation was
     *  used during analysis.
     */
    bool found;

    /*!
     *  This method constructs an Explanation instance.
     */
    Explanation() { found = false; }

    /*!
     *  This method destructs an Explanation instance.
     */
    ~Explanation() {}
  };

  /*! @class Explanations
   *
   *  This class defines a set of Explanation instances.
   */
  class Explanations {

  public:

    /*!
     *  This member variable contains a list of Explanation instances.
     */
    std::map<std::string, Explanation> set;

    /*!
     *  This method constructs an Explanations instance.
     */
    Explanations();

    /*!
     *  This method destructs an Explanations instance.
     */
    ~Explanations();

    /*!
     *  This methods loads the explanation information from the
     *  specified file.
     *
     *  @param[in] explanations specifies the file name containing
     *             the explanation information
     */
    void load( const std::string& explanations );

    /*!
     *  This method returns the explanation associated with the
     *  specified starting line number.
     *
     *  @param[in] start specifies the starting line number for
     *             which to search
     */
    const Explanation *lookupExplanation( const std::string& start );

    /*!
     *  This method writes a file that contains a list of any
     *  explanations that were not looked up.
     *
     *  @param[in] fileName specifies the name of the file to write
     */
    void writeNotFound( const std::string& fileName );

  };

}

#endif