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

Enumeration class: the possible outcomes of a transform query with step_xform::query(). 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 xform_query_result object that includes information useful for debugging. More...
 
std::string as_string () const
 Get a simple string representation of a xform_query_result object. More...
 
int cmp (const xform_query_result &other) const
 Comparison function for xform_query_result, with respect to a stable overall ordering. More...
 
cs_hash_t hash () const
 Hash function for xform_query_result. More...
 
std::string name () const
 Get the name of a xform_query_result object. More...
 

Static Public Member Functions

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

Static Public Attributes

static const xform_query_result IMPOSSIBLE
 The query evaluates to FALSE. More...
 
static const xform_query_result LHS_UNMODIFIED
 The query's lhs xform_expr had mode xform_expr_mode::POST_STRICT or xform_expr_mode::POST_DEREFS_PRE_STRICT, but the value of lhs was the same at the beginning and end of the transformation described by the step_xform. More...
 
static const xform_query_result OK
 The query could evaluate to either TRUE or FALSE: there is no reason to believe definitely one or the other. More...
 
static const xform_query_result REDUNDANT
 The query definitely evaluates to TRUE. More...
 
static const xform_query_result REDUNDANT_SUSPECT
 The query evaluates to TRUE, but is implied by preconditions that arise from: More...
 
static const xform_query_result RHS_UNMODIFIED
 The query's rhs xform_expr had mode xform_expr_mode::POST_STRICT or xform_expr_mode::POST_DEREFS_PRE_STRICT, but the value of rhs was the same at the beginning and end of the transformation described by the step_xform. More...
 

Related Functions

(Note that these are not member functions.)

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

Detailed Description

Enumeration class: the possible outcomes of a transform query with step_xform::query().

This class is used when implementing step visitors. When you implement transition() as part of the overall task of subclassing step_state, you will use step_xform::query() invocations to inspect its step_xform arguments; these query invocations return xform_query_result.

Member Function Documentation

◆ as_integer()

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

Get an integer representation of this.

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

◆ as_repr()

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

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

Returns
The string representation.

◆ as_string()

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

Get a simple string representation of a xform_query_result object.

Returns
The string representation.

◆ cmp()

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

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

Parameters
otherThe xform_query_result 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 xform_query_result cs::xform_query_result::from_integer ( csint64  _inner)
inlinestatic

Construct an instance from an integer representation.

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

◆ hash()

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

Hash function for xform_query_result.

◆ name()

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

Get the name of a xform_query_result object.

Returns
The name.

Friends And Related Function Documentation

◆ operator!=()

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

Inequality operator for xform_query_result.

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

◆ operator<()

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

Less-than operator for xform_query_result.

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

◆ operator<<()

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

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

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

◆ operator<=()

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

Less-than-or-equal operator for xform_query_result.

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

◆ operator==()

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

Equality operator for xform_query_result.

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

◆ operator>()

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

Greater-than operator for xform_query_result.

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

◆ operator>=()

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

Greater-than-or-equal operator for xform_query_result.

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

Member Data Documentation

◆ IMPOSSIBLE

const xform_query_result cs::xform_query_result::IMPOSSIBLE
static

The query evaluates to FALSE.

There are two possible cases:

  • Case 1: the query evaluates to FALSE because of preconditions that arise from:
  • Case 2: the query evaluates to FALSE for any other reason.

We use the term "suspect" to describe case 1.

If some query Q has outcome xform_query_result::IMPOSSIBLE and you need to distinguish between the two cases, proceed as follows.

  1. Create a new query R that is the inverse of Q.
  2. Execute query R and look at the outcome.

◆ LHS_UNMODIFIED

const xform_query_result cs::xform_query_result::LHS_UNMODIFIED
static

The query's lhs xform_expr had mode xform_expr_mode::POST_STRICT or xform_expr_mode::POST_DEREFS_PRE_STRICT, but the value of lhs was the same at the beginning and end of the transformation described by the step_xform.

◆ OK

const xform_query_result cs::xform_query_result::OK
static

The query could evaluate to either TRUE or FALSE: there is no reason to believe definitely one or the other.

◆ REDUNDANT

const xform_query_result cs::xform_query_result::REDUNDANT
static

The query definitely evaluates to TRUE.

◆ REDUNDANT_SUSPECT

const xform_query_result cs::xform_query_result::REDUNDANT_SUSPECT
static

The query evaluates to TRUE, but is implied by preconditions that arise from:

◆ RHS_UNMODIFIED

const xform_query_result cs::xform_query_result::RHS_UNMODIFIED
static

The query's rhs xform_expr had mode xform_expr_mode::POST_STRICT or xform_expr_mode::POST_DEREFS_PRE_STRICT, but the value of rhs was the same at the beginning and end of the transformation described by the step_xform.


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