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

A set of symbols (symbol). More...

Public Types

typedef iterator const_iterator
 const iterator over the set contents. More...
 
typedef const symbolconst_pointer
 const pointer to the type of the set elements. More...
 
typedef const symbolconst_reference
 const reference to the type of the set elements. More...
 
typedef symbol_set_iterator iterator
 Iterator over the set contents. More...
 
typedef symbol key_type
 The type of the set elements. More...
 
typedef symbolpointer
 Pointer to the type of the set elements. More...
 
typedef symbolreference
 Reference to the type of the set elements. More...
 
typedef size_t size_type
 Type of set size (cardinality). More...
 
typedef symbol value_type
 The type of the set elements. More...
 

Public Member Functions

 symbol_set (const symbol_set &other)
 Copy constructor. More...
 
 symbol_set ()
 Construct an empty set. More...
 
 symbol_set (const std::vector< symbol_set > &v)
 Constructor: given a std::vector of sets, construct a set that is a multi-union of those sets. More...
 
 symbol_set (const std::vector< symbol > &v)
 Construct a set from a std::vector of elements. More...
 
 symbol_set (set_kind k)
 Construct an empty set of the specified kind. More...
 
bool add (const symbol &v)
 Add an element to the set. More...
 
std::string as_repr () const
 Get a representation of a set object that includes information useful for debugging.
 
std::string as_string () const
 Get a simple string representation of a set object. More...
 
iterator begin () const
 Get an iterator whose current position is the first element in the set. More...
 
iterator cbegin () const
 Get an iterator whose current position is the first element in the set. More...
 
iterator cend () const
 Get an iterator whose current position is after the end of the set. More...
 
void clear ()
 Remove all elements from the set (that is, make it empty). More...
 
size_type count (const symbol &e) const
 Count the number of times the specified element appears in a set. More...
 
symbol_set difference (const symbol_set &b) const
 Set difference. More...
 
bool empty () const
 Check: is the set empty? More...
 
iterator end () const
 Get an iterator whose current position is after the end of the set. More...
 
size_type erase (const symbol &v)
 Remove an element from the set. More...
 
const_iterator find (const symbol &e) const
 Find element e in the set and return an iterator pointing to it if it is found. More...
 
cs_hash_t hash () const
 Get a hash of the set. More...
 
std::pair< iterator, bool > insert (const symbol &v)
 Insert an element into the set. More...
 
symbol_set intersect (const symbol_set &b) const
 Set intersection. More...
 
set_kind kind () const
 Get the kind of a set. More...
 
symbol_setoperator= (symbol_set other)
 Assignment operator for symbol_set. More...
 
size_type size () const
 Get the set cardinality. More...
 
void swap (symbol_set &other)
 Exchange the contents of this and other. More...
 
std::vector< symbolto_vector () const
 Get a std::vector of all the elements in the set. More...
 
symbol_set union_ (const symbol_set &b) const
 Set union. More...
 
void union_p (const symbol_set &b)
 Update a set to the union of itself and another set. More...
 

Related Functions

(Note that these are not member functions.)

bool operator!= (const symbol_set &__x, const symbol_set &__y)
 Inequality operator for symbol_set. More...
 
std::ostream & operator<< (std::ostream &out, const symbol_set &a)
 Print a representation of a symbol_set object to the specified stream. More...
 
bool operator== (const symbol_set &__x, const symbol_set &__y)
 Equality operator for symbol_set. More...
 

Detailed Description

A set of symbols (symbol).

The symbol_set class corresponds to the ABS_LOC_SET abstraction.

Return and/or parameter type for various queries on point, procedure, project, symbol.

Use a symbol_set_iterator to iterate over a symbol_set. For example:

for (cs::symbol_set_iterator it = my_symbol_set.begin(); !it.at_end(); ++it){
std::cout << "symbol: " << *it;
}

Member Typedef Documentation

◆ const_iterator

typedef iterator cs::symbol_set::const_iterator
inherited

const iterator over the set contents.

◆ const_pointer

typedef const symbol * cs::symbol_set::const_pointer
inherited

const pointer to the type of the set elements.

◆ const_reference

typedef const symbol & cs::symbol_set::const_reference
inherited

const reference to the type of the set elements.

◆ iterator

typedef symbol_set_iterator cs::symbol_set::iterator
inherited

Iterator over the set contents.

◆ key_type

typedef symbol cs::symbol_set::key_type
inherited

The type of the set elements.

◆ pointer

typedef symbol * cs::symbol_set::pointer
inherited

Pointer to the type of the set elements.

◆ reference

typedef symbol & cs::symbol_set::reference
inherited

Reference to the type of the set elements.

◆ size_type

typedef size_t cs::symbol_set::size_type
inherited

Type of set size (cardinality).

◆ value_type

typedef symbol cs::symbol_set::value_type
inherited

The type of the set elements.

Constructor & Destructor Documentation

◆ symbol_set() [1/5]

cs::symbol_set::symbol_set ( const symbol_set other)

Copy constructor.

◆ symbol_set() [2/5]

cs::symbol_set::symbol_set ( )

Construct an empty set.

◆ symbol_set() [3/5]

cs::symbol_set::symbol_set ( set_kind  k)

Construct an empty set of the specified kind.

Parameters
[in]kThe set kind.
Exceptions
result::ERROR_CODESURFER_ONLYif k is set_kind::TRIE, which is only available in CodeSurfer.

◆ symbol_set() [4/5]

cs::symbol_set::symbol_set ( const std::vector< symbol_set > &  v)

Constructor: given a std::vector of sets, construct a set that is a multi-union of those sets.

◆ symbol_set() [5/5]

cs::symbol_set::symbol_set ( const std::vector< symbol > &  v)

Construct a set from a std::vector of elements.

Parameters
[in]vThe set elements.

Member Function Documentation

◆ add()

bool cs::symbol_set::add ( const symbol v)
inlineinherited

Add an element to the set.

Parameters
[in]vThe element to add.
Returns
true if v was not already present in the set, false if it was already present.

◆ as_string()

std::string cs::symbol_set::as_string ( ) const
inlineinherited

Get a simple string representation of a set object.

◆ begin()

iterator cs::symbol_set::begin ( ) const
inlineinherited

Get an iterator whose current position is the first element in the set.

Returns
The iterator.

◆ cbegin()

iterator cs::symbol_set::cbegin ( ) const
inlineinherited

Get an iterator whose current position is the first element in the set.

Returns
The iterator.

◆ cend()

iterator cs::symbol_set::cend ( ) const
inlineinherited

Get an iterator whose current position is after the end of the set.

Returns
The iterator.

◆ clear()

void cs::symbol_set::clear ( )
inlineinherited

Remove all elements from the set (that is, make it empty).

Returns
void

◆ count()

size_type cs::symbol_set::count ( const symbol e) const
inlineinherited

Count the number of times the specified element appears in a set.

Parameters
[in]eThe element of interest.
Returns
1 if e is present in the set, 0 otherwise.

◆ difference()

symbol_set cs::symbol_set::difference ( const symbol_set b) const
inlineinherited

Set difference.

Parameters
[in]bThe set to subtract from this.
Returns
A set containing this - b.

The returned set contains the elements in this that are not in b.

◆ empty()

bool cs::symbol_set::empty ( ) const
inlineinherited

Check: is the set empty?

Returns
true if the set is empty, false otherwise.

◆ end()

iterator cs::symbol_set::end ( ) const
inlineinherited

Get an iterator whose current position is after the end of the set.

Returns
The iterator.

◆ erase()

size_type cs::symbol_set::erase ( const symbol v)
inlineinherited

Remove an element from the set.

Parameters
[in]vThe element to remove.
Returns
The number of elements deleted:
  • 1 if v was present in the set.
  • 0 if v was not present in the set.

◆ find()

const_iterator cs::symbol_set::find ( const symbol e) const
inlineinherited

Find element e in the set and return an iterator pointing to it if it is found.

Returns
An iterator whose current position is:
  • the set element matching e if e is present in the set,
  • after the end of the set otherwise.

◆ hash()

cs_hash_t cs::symbol_set::hash ( ) const
inlineinherited

Get a hash of the set.

Returns
The hash value for the set.

◆ insert()

std::pair<iterator, bool> cs::symbol_set::insert ( const symbol v)
inlineinherited

Insert an element into the set.

Parameters
[in]vThe element to add.
Returns
A pair (itr,b), where
  • itr points to the newly inserted element (or the element whose key is equivalent, if it was already present).
  • b is true if v was not already present in the set, false if it was already present.

◆ intersect()

symbol_set cs::symbol_set::intersect ( const symbol_set b) const
inlineinherited

Set intersection.

Parameters
[in]bThe other operand for the intersection operation.
Returns
A set containing this INTERSECT b.

The returned set contains the elements that are in both this and b.

◆ kind()

set_kind cs::symbol_set::kind ( ) const
inlineinherited

Get the kind of a set.

Returns
The set kind (cs::set_kind).
Exceptions
result::ELEMENT_NOT_PRESENTif the set was constructed with the default constructor and no elements have been added yet.

◆ operator=()

symbol_set& cs::symbol_set::operator= ( symbol_set  other)

Assignment operator for symbol_set.

◆ size()

size_type cs::symbol_set::size ( ) const
inlineinherited

Get the set cardinality.

Returns
The number of elements in the set.

◆ swap()

void cs::symbol_set::swap ( symbol_set other)
inlineinherited

Exchange the contents of this and other.

◆ to_vector()

std::vector<symbol > cs::symbol_set::to_vector ( ) const
inlineinherited

Get a std::vector of all the elements in the set.

Returns
A std::vector containing all the elements in the set.

◆ union_()

symbol_set cs::symbol_set::union_ ( const symbol_set b) const
inlineinherited

Set union.

Parameters
[in]bThe other operand for the union operation.
Returns
A set containing this UNION b.

The returned set contains the elements that are in this, b, or both.

◆ union_p()

void cs::symbol_set::union_p ( const symbol_set b)
inlineinherited

Update a set to the union of itself and another set.

Parameters
[in]bThe set whose elements are to be added.
Returns
void

this is updated to contain this UNION b.

Friends And Related Function Documentation

◆ operator!=()

bool operator!= ( const symbol_set __x,
const symbol_set __y 
)
related

Inequality operator for symbol_set.

Parameters
[in]__xThe set to compare.
[in]__yThe set to compare against.
Returns
false if __x equal to __y according to operator==(), true otherwise.

◆ operator<<()

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

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

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

◆ operator==()

bool operator== ( const symbol_set __x,
const symbol_set __y 
)
related

Equality operator for symbol_set.

Parameters
[in]__xThe set to compare.
[in]__yThe set to compare against.
Returns
true if __x equal to __y, false otherwise.

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