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

Flag class: characterizes a metric class (procedure_metricclass, sfile_metricclass, compunit_metricclass, project_metricclass). More...

Public Member Functions

csint64 as_integer () const
 Get an integer representation of this. More...
 
std::string as_repr () const
 Get a representation of a metricclass_flags object that includes information useful for debugging. More...
 
std::string as_string () const
 Get a simple string representation of a metricclass_flags object. More...
 
int cmp (const metricclass_flags &other) const
 Comparison function for metricclass_flags, with respect to a stable overall ordering. More...
 
cs_hash_t hash () const
 Hash function for metricclass_flags. More...
 
std::string name () const
 Get the name of a metricclass_flags object. More...
 
metricclass_flagsoperator &= (const metricclass_flags &other)
 AND-assign operator. More...
 
metricclass_flagsoperator|= (const metricclass_flags &other)
 OR-assign operator. More...
 
metricclass_flags operator~ () const
 Complementation operator. More...
 

Static Public Member Functions

static metricclass_flags from_integer (csint64 _inner)
 Construct an instance from an integer representation. More...
 

Static Public Attributes

static const metricclass_flags AUTO
 Singleton set containing the "auto" flag: automatically compute values for this metric. More...
 
static const metricclass_flags NONE
 Empty set: contains no flags. More...
 
static const metricclass_flags POST_ANALYSIS
 Singleton set containing the "post-analysis" flag: this metric relies on data from the analysis and should not be computed until after the analysis has completed; its value will therefore not be available until after the analysis has completed. More...
 

Friends

metricclass_flags operator & (const metricclass_flags &a, const metricclass_flags &b)
 
metricclass_flags operator| (const metricclass_flags &a, const metricclass_flags &b)
 

Related Functions

(Note that these are not member functions.)

bool operator!= (const metricclass_flags &a, const metricclass_flags &b)
 Inequality operator for metricclass_flags. More...
 
metricclass_flags operator& (const metricclass_flags &a, const metricclass_flags &b)
 AND operator for metricclass_flags. More...
 
bool operator< (const metricclass_flags &a, const metricclass_flags &b)
 Less-than operator for metricclass_flags. More...
 
std::ostream & operator<< (std::ostream &out, const metricclass_flags &a)
 Print a representation of a metricclass_flags object to the specified stream. More...
 
bool operator<= (const metricclass_flags &a, const metricclass_flags &b)
 Less-than-or-equal operator for metricclass_flags. More...
 
bool operator== (const metricclass_flags &a, const metricclass_flags &b)
 Equality operator for metricclass_flags. More...
 
bool operator> (const metricclass_flags &a, const metricclass_flags &b)
 Greater-than operator for metricclass_flags. More...
 
bool operator>= (const metricclass_flags &a, const metricclass_flags &b)
 Greater-than-or-equal operator for metricclass_flags. More...
 
metricclass_flags operator| (const metricclass_flags &a, const metricclass_flags &b)
 OR operator for metricclass_flags. More...
 

Detailed Description

Flag class: characterizes a metric class (procedure_metricclass, sfile_metricclass, compunit_metricclass, project_metricclass).

Member Function Documentation

◆ as_integer()

csint64 cs::metricclass_flags::as_integer ( ) const
inline

Get an integer representation of this.

Returns
An integer suitable for use with from_integer(). Invariant: For metricclass_flags x, metricclass_flags.from_integer(x.as_integer()) == x

◆ as_repr()

std::string cs::metricclass_flags::as_repr ( ) const
inline

Get a representation of a metricclass_flags object that includes information useful for debugging.

Returns
The string representation.

◆ as_string()

std::string cs::metricclass_flags::as_string ( ) const
inline

Get a simple string representation of a metricclass_flags object.

Returns
The string representation.

◆ cmp()

int cs::metricclass_flags::cmp ( const metricclass_flags other) const
inline

Comparison function for metricclass_flags, with respect to a stable overall ordering.

Parameters
otherThe metricclass_flags object to compare against.
Returns
An integer N such that:
  • N==0 if the two objects compare equal
  • N<0 if this < other
  • N>0 if this > other

◆ from_integer()

static metricclass_flags cs::metricclass_flags::from_integer ( csint64  _inner)
inlinestatic

Construct an instance from an integer representation.

Parameters
[in]_innerThe integer representation, as returned by as_integer(). Invariant: For metricclass_flags x, metricclass_flags.from_integer(x.as_integer()) == x
Exceptions
cs::result::ERROR_INVALID_ARGUMENTif _inner is not a valid integer representation for a metricclass_flags instance.

◆ hash()

cs_hash_t cs::metricclass_flags::hash ( ) const
inline

Hash function for metricclass_flags.

◆ name()

std::string cs::metricclass_flags::name ( ) const
inline

Get the name of a metricclass_flags object.

◆ operator &=()

metricclass_flags& cs::metricclass_flags::operator&= ( const metricclass_flags other)
inline

AND-assign operator.

Returns
A metricclass_flags object containing the flags that are contained in both this and other.

◆ operator|=()

metricclass_flags& cs::metricclass_flags::operator|= ( const metricclass_flags other)
inline

OR-assign operator.

Returns
A metricclass_flags object containing the flags that are contained in this, other, or both.

◆ operator~()

metricclass_flags cs::metricclass_flags::operator~ ( ) const
inline

Complementation operator.

Returns
A metricclass_flags object containing the flags that are NOT contained in this.

Friends And Related Function Documentation

◆ operator!=()

bool operator!= ( const metricclass_flags a,
const metricclass_flags b 
)
related

Inequality operator for metricclass_flags.

Parameters
[in]aThe metricclass_flags object to compare.
[in]bThe metricclass_flags object to compare against.
Returns
false if a and b are equal according to metricclass_flags::cmp(), true otherwise.

◆ operator&()

metricclass_flags operator & ( const metricclass_flags a,
const metricclass_flags b 
)
related

AND operator for metricclass_flags.

Parameters
[in]aAND operand.
[in]bAND operand.
Returns
A metricclass_flags object containing all flags that are in both a and b.

◆ operator<()

bool operator< ( const metricclass_flags a,
const metricclass_flags b 
)
related

Less-than operator for metricclass_flags.

Parameters
[in]aThe metricclass_flags object to compare.
[in]bThe metricclass_flags object to compare against.
Returns
true if a < b according to metricclass_flags::cmp() , false otherwise.

◆ operator<<()

std::ostream & operator<< ( std::ostream &  out,
const metricclass_flags a 
)
related

Print a representation of a metricclass_flags object to the specified stream.

Parameters
[in]outThe stream to print to.
[in]aThe metricclass_flags object to print.
Returns
void

◆ operator<=()

bool operator<= ( const metricclass_flags a,
const metricclass_flags b 
)
related

Less-than-or-equal operator for metricclass_flags.

Parameters
[in]aThe metricclass_flags object to compare.
[in]bThe metricclass_flags object to compare against.
Returns
true if a <= b according to metricclass_flags::cmp() , false otherwise.

◆ operator==()

bool operator== ( const metricclass_flags a,
const metricclass_flags b 
)
related

Equality operator for metricclass_flags.

Parameters
[in]aThe metricclass_flags object to compare.
[in]bThe metricclass_flags object to compare against.
Returns
true if a and b are equal according to metricclass_flags::cmp(), false otherwise.

◆ operator>()

bool operator> ( const metricclass_flags a,
const metricclass_flags b 
)
related

Greater-than operator for metricclass_flags.

Parameters
[in]aThe metricclass_flags object to compare.
[in]bThe metricclass_flags object to compare against.
Returns
true if a > b according to metricclass_flags::cmp() , false otherwise.

◆ operator>=()

bool operator>= ( const metricclass_flags a,
const metricclass_flags b 
)
related

Greater-than-or-equal operator for metricclass_flags.

Parameters
[in]aThe metricclass_flags object to compare.
[in]bThe metricclass_flags object to compare against.
Returns
true if a >= b according to metricclass_flags::cmp() , false otherwise.

◆ operator|()

metricclass_flags operator| ( const metricclass_flags a,
const metricclass_flags b 
)
related

OR operator for metricclass_flags.

Parameters
[in]aOR operand.
[in]bOR operand.
Returns
A metricclass_flags object containing all flags that are in at least one of a, b.

Member Data Documentation

◆ AUTO

const metricclass_flags cs::metricclass_flags::AUTO
static

Singleton set containing the "auto" flag: automatically compute values for this metric.

If this flag is not set, values for the metric must be explicitly reported using the appropriate *_metricclass report() method.

◆ NONE

const metricclass_flags cs::metricclass_flags::NONE
static

Empty set: contains no flags.

◆ POST_ANALYSIS

const metricclass_flags cs::metricclass_flags::POST_ANALYSIS
static

Singleton set containing the "post-analysis" flag: this metric relies on data from the analysis and should not be computed until after the analysis has completed; its value will therefore not be available until after the analysis has completed.

Analysis-phase metrics (those where metricclass_flags::POST_ANALYSIS is not set) can be reported at any point during the serial depth-first traversal, during the parallel depth-first traversal, or by a bottom-up program visitor. (see analysis::add_project_bottom_up_visitor()).

Post-analysis metrics can be reported at any point between the start of the bottom-up traversal and the transition to daemon mode.

If you specify metricclass_flags::POST_ANALYSIS in combination with metricclass_flags::AUTO, CodeSonar will automatically invoke the metric computation function at the appropriate stage of the analysis. Otherwise, you will need to explicitly report the metric value by invoking the appropriate metric class report() method from a suitable visitor.

The result::ERROR_INVALID_PHASE_FOR_OPERATION documentation lists the visitor types associated with the different phases.


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