A sfile granularity metric class.
More...
A sfile granularity metric class.
The sfile granularity metric classes are managed by sfile_metricclass_manager.
You can retrieve metric values with value(), and examine metric properties with description(), tag(), and flags().
For more information about metrics in CodeSonar, see the Metrics manual page.
◆ allowed()
| bool cs::sfile_metricclass::allowed |
( |
| ) |
const |
|
inlineinherited |
Check: are METRIC_FILTER settings such that reported instances of this metric class will be submitted to the hub?
- Returns
true if reported instances of the class will be submitted to the hub, false otherwise.
If you have defined a custom metric class C in a plug-in, you can use a test based on C.allowed() to avoid unnecessary work in the case where C is ignored.
This is the complement of sfile_metricclass::always_discarded().
◆ always_discarded()
| bool cs::sfile_metricclass::always_discarded |
( |
| ) |
const |
|
inlineinherited |
Check: are METRIC_FILTER settings such that instances of this metric class will always be ignored?
- Returns
true if all instances of the class are being discarded, false otherwise.
If you have defined a custom metric class C in a plug-in, you can use a test based on C.always_discarded() to avoid unnecessary work in the case where C is ignored.
This is the complement of sfile_metricclass::allowed.
◆ as_repr()
| std::string cs::sfile_metricclass::as_repr |
( |
| ) |
const |
|
inlineinherited |
Get a representation of a sfile_metricclass object that includes information useful for debugging.
- Returns
- The string representation.
◆ as_string()
| std::string cs::sfile_metricclass::as_string |
( |
| ) |
const |
|
inlineinherited |
Get a simple string representation of a sfile_metricclass object.
- Returns
- The string representation.
◆ cmp()
Comparison function for sfile_metricclass, with respect to a stable overall ordering.
this and other will only compare equal if they are the same sfile_metricclass object.
- Parameters
-
- Returns
- An integer N such that:
-
N<0 if
this < other
-
N==0 if
this == other
-
N>0 if
this > other
◆ description()
| std::string cs::sfile_metricclass::description |
( |
| ) |
const |
|
inlineinherited |
Get the description (longer, human readable identifier) for a metric class (sfile_metricclass).
- Returns
- The description, as a std::string.
For example, CodeSonar ships with built-in project granularity metric class Include file instances.
- its tag is "InclF"
- its description is "Include file instances"
◆ flags()
◆ hash()
| cs_hash_t cs::sfile_metricclass::hash |
( |
| ) |
const |
|
inlineinherited |
◆ report()
| void cs::sfile_metricclass::report |
( |
sfile |
elt, |
|
|
double |
val |
|
) |
| const |
Report a metric value to the hub.
- Parameters
-
| [in] | elt | The element that the metric value is associated with. |
| [in] | val | The value to report. |
- Returns
- void
You do not need to call this method if the metric class was created with metricclass_flags::AUTO. In that case, CodeSonar will automatically report the values calculated using the operator() method of the metric_function<T> argument provided to sfile_metricclass_manager::create() when the class was created.
- Exceptions
-
◆ retract()
| void cs::sfile_metricclass::retract |
( |
sfile |
elt | ) |
const |
|
inlineinherited |
Retract a metric value.
- Parameters
-
| [in] | elt | The element for which the value will be retracted. |
- Returns
- void
- Exceptions
-
In typical usage, retract() is called during the drop traversal (that is, by a visitor added with one of the analysis add_*_drop_visitor() methods).
◆ tag()
| std::string cs::sfile_metricclass::tag |
( |
| ) |
const |
|
inlineinherited |
Get the tag (short string identifier) for a metric class (sfile_metricclass).
- Returns
- The short tag, as a std::string.
The tag will usually be only a few characters long. Retrieve the metric class description with description() for a longer string that is generally more human-readable.
For example, CodeSonar ships with built-in project granularity metric class Include file instances.
- its tag is "InclF"
- its description is "Include file instances"
◆ value()
| double cs::sfile_metricclass::value |
( |
sfile |
elt | ) |
const |
Get the value of a metric.
- Parameters
-
| [in] | elt | The element for which the metric value is required.
|
- Returns
- The metric value for
elt.
You do not need to call this method if the metric class was created with metricclass_flags::AUTO. In that case, CodeSonar will automatically report the values calculated using the metric_function<T> argument provided to sfile_metricclass_manager::create() when the metric class was created.
- Exceptions
-
◆ operator!=()
◆ operator<()
◆ operator<<()
Print a representation of a sfile_metricclass object to the specified stream.
- Parameters
-
- Returns
- void
◆ operator<=()
◆ operator==()
◆ operator>()
◆ operator>=()
The documentation for this class was generated from the following file: