CodeSonar C++ API
[For improved navigation, enable JavaScript.]
Static Public Member Functions | List of all members
cs::project_metricclass_manager Class Reference

Manages the project granularity metric classes (project_metricclass) associated with an analysis. More...

Static Public Member Functions

static project_metricclass  create (metric_function<project > *metricclass_func_ptr, const std::string &tag, const std::string &desc, metricclass_flags flags=metricclass_flags::AUTO)
 Create and return a new project_metricclass, specifying a computation function. More...
 
static project_metricclass  create (const std::string &tag, const std::string &desc, metricclass_flags flags=metricclass_flags::NONE)
 Create and return a new project_metricclass, without specifying a computation function. More...
 
static project_metricclass  lookup (const std::string &tag)
 Get the project_metricclass that has the specified tag. More...
 
static project_metricclass_iterator  metricclasses ()
 Get an iterator over the metric classes (project_metricclass) in a project_metricclass_manager. More...
 

Detailed Description

Manages the project granularity metric classes (project_metricclass) associated with an analysis.

Use a project_metricclass_iterator to iterate over a the project-granularity metric classes associated with an analysis. For example:

std::cout << "project_metricclass: " << *it;
}

Member Function Documentation

◆ create() [1/2]

project_metricclass cs::project_metricclass_manager::create ( metric_function<project > *  metricclass_func_ptr,
const std::string &  tag,
const std::string &  desc,
metricclass_flags  flags = metricclass_flags::AUTO 
)
inlinestaticinherited

Create and return a new project_metricclass, specifying a computation function.

Parameters
[in]metricclass_func_ptrThe calculation function that computes the metric's value. You can use the form without this argument if your plug-in will explicitly compute all values for this project_metricclass and report them with project_metricclass::report().
[in]tagA short name (tag) that will, in combination with the granularity, uniquely identify this metric class. The tag must:
  • Start with characters matching [a-zA-Z]
  • Only contain characters matching [a-zA-Z][0-9] _-
  • Have length <= 15 characters
[in]descA human-readable description of the metric. When a metric shows up in a user interface, this is what is displayed. The description must:
  • Only contain characters matching [a-zA-Z][0-9] _-
  • Have length <= 35 characters
[in]flagsmetricclass_flags characterizing the new metric class.
Returns
The newly-created project_metricclass.
Exceptions
result::ELEMENT_ALREADY_PRESENTif there is already a project_metricclass whose tag is tag.
result::ERROR_INVALID_ARGUMENTif tag or desc does not conform to the requirements described above.
result::ERROR_INVALID_PHASE_FOR_OPERATIONif called outside cs_plug_main() or the top level scope of the plug-in. This method is only suitable for use in your plug-in's top-level scope or cs_plug_main() function. Do not call it inside visitors.

If your plug-in will manually compute and report all values for this metric class, you can use cs::project_metricclass_manager::create(const std::string &, const std::string &, metricclass_flags) instead.

◆ create() [2/2]

project_metricclass cs::project_metricclass_manager::create ( const std::string &  tag,
const std::string &  desc,
metricclass_flags  flags = metricclass_flags::NONE 
)
inlinestaticinherited

Create and return a new project_metricclass, without specifying a computation function.

Parameters
[in]tagA short name (tag) that will, in combination with the granularity, uniquely identify this metric class. The tag must:
  • Start with characters matching [a-zA-Z]
  • Only contain characters matching [a-zA-Z][0-9] _-
  • Have length <= 15 characters
[in]descA human-readable description of the metric. When a metric shows up in a user interface, this is what is displayed.
[in]flagsmetricclass_flags characterizing the new metric class.
Returns
The newly-created project_metricclass.
Exceptions
result::ELEMENT_ALREADY_PRESENTif there is already a project_metricclass whose tag is tag.
result::ERROR_INVALID_ARGUMENTif tag or desc does not conform to the requirements described above.
result::ERROR_INVALID_PHASE_FOR_OPERATIONif called outside cs_plug_main() or the top level scope of the plug-in.

This method is only suitable for use in your plug-in's top-level scope or cs_plug_main() function. Do not call it inside visitors.

Use this form if your plug-in will be explicitly computing all values for the new metric class and reporting them with project_metricclass::report().

If you want to create a metric class whose values will be computed and reported automatically by CodeSonar, use cs::project_metricclass_manager::create(metric_function<T> *, const std::string &, const std::string &, metricclass_flags).

◆ lookup()

project_metricclass cs::project_metricclass_manager::lookup ( const std::string &  tag)
inlinestaticinherited

Get the project_metricclass that has the specified tag.

Parameters
[in]tagThe metric class tag.
Returns
The project_metricclass with the specified tag.
Exceptions
result::ELEMENT_NOT_PRESENT

◆ metricclasses()

project_metricclass_iterator cs::project_metricclass_manager::metricclasses ( )
inlinestaticinherited

Get an iterator over the metric classes (project_metricclass) in a project_metricclass_manager.

Returns
The initialized iterator.

The documentation for this class was generated from the following file: