ROSE  0.11.54.0
Public Types | Public Member Functions | List of all members
Sawyer::Container::Set< T, C, A > Class Template Reference

Description

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
class Sawyer::Container::Set< T, C, A >

Ordered set of values.

This container holds an ordered set of values. This container differs from std::set in the following ways:

Definition at line 52 of file Set.h.

#include <Set.h>

Inheritance diagram for Sawyer::Container::Set< T, C, A >:
Inheritance graph
[legend]

Public Types

typedef T Value
 Type of values stored in this set. More...
 
typedef C Comparator
 How to compare values with each other. More...
 
typedef A Allocator
 How to allocate storge for new values. More...
 
typedef InternalSet::const_iterator ConstIterator
 Iterator for traversing values stored in the set. More...
 

Public Member Functions

 Set (const Comparator &comparator=Comparator(), const Allocator &allocator=Allocator())
 Default constructor. More...
 
 Set (const Value &value)
 Singleton constructor. More...
 
 Set (const Set &other)
 Copy constructor. More...
 
Setoperator= (const Set &other)
 Assignment operator. More...
 
boost::iterator_range< ConstIteratorvalues () const
 Value iterator range. More...
 
bool isEmpty () const
 Whether the set is empty. More...
 
bool exists (const Value &value) const
 Whether a value exists. More...
 
bool existsAny (const Set &other) const
 Whether any value exists. More...
 
bool existsAll (const Set &other) const
 Whether all values exist. More...
 
size_t size () const
 Size of the set. More...
 
Value least () const
 Smallest member. More...
 
Value greatest () const
 Largest member. More...
 
Interval< Valuehull () const
 Range of members. More...
 
bool operator== (const Set &other) const
 Whether two sets contain the same members. More...
 
bool operator!= (const Set &other) const
 Whether two sets do not contain the same members. More...
 
bool insert (const Value &value)
 Insert a value. More...
 
bool insert (const Set &values)
 Insert multiple values. More...
 
bool erase (const Value &value)
 Erase a value. More...
 
bool erase (const Set &values)
 Erase multiple values. More...
 
void clear ()
 Erase all values. More...
 
Setoperator&= (const Set &other)
 Intersects this set with another. More...
 
Setoperator|= (const Set &other)
 Unions this set with another. More...
 
Setoperator-= (const Set &other)
 Differences two sets. More...
 
Set operator& (const Set &other) const
 Compute the intersection of this set with another. More...
 
Set operator| (const Set &other) const
 Compute the union of this set with another. More...
 
Set operator- (const Set &other) const
 Compute the difference of this set with another. More...
 
template<class InputIterator >
 Set (InputIterator begin, InputIterator end, const Comparator &comparator=Comparator(), const Allocator &allocator=Allocator())
 Iterative constructor. More...
 
template<class InputIterator >
 Set (const boost::iterator_range< InputIterator > &range, const Comparator &=Comparator(), const Allocator &=Allocator())
 Iterative constructor. More...
 

Member Typedef Documentation

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
typedef T Sawyer::Container::Set< T, C, A >::Value

Type of values stored in this set.

Definition at line 56 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
typedef C Sawyer::Container::Set< T, C, A >::Comparator

How to compare values with each other.

Definition at line 57 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
typedef A Sawyer::Container::Set< T, C, A >::Allocator

How to allocate storge for new values.

Definition at line 58 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
typedef InternalSet::const_iterator Sawyer::Container::Set< T, C, A >::ConstIterator

Iterator for traversing values stored in the set.

Definition at line 59 of file Set.h.

Constructor & Destructor Documentation

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
Sawyer::Container::Set< T, C, A >::Set ( const Comparator comparator = Comparator(),
const Allocator allocator = Allocator() 
)
inlineexplicit

Default constructor.

Constructs a new set containing no values.

Definition at line 79 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
Sawyer::Container::Set< T, C, A >::Set ( const Value value)
inline

Singleton constructor.

Constructs a singleton set having only the specified value.

Definition at line 85 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
template<class InputIterator >
Sawyer::Container::Set< T, C, A >::Set ( InputIterator  begin,
InputIterator  end,
const Comparator comparator = Comparator(),
const Allocator allocator = Allocator() 
)
inline

Iterative constructor.

Constructs a new set and copies values into the set. For instance, this can be used to initialize a set from a vector:

Map<Key, int> v = ...;
Set<int> set(v.values());

Definition at line 100 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
template<class InputIterator >
Sawyer::Container::Set< T, C, A >::Set ( const boost::iterator_range< InputIterator > &  range,
const Comparator = Comparator(),
const Allocator = Allocator() 
)
inlineexplicit

Iterative constructor.

Constructs a new set and copies values into the set. For instance, this can be used to initialize a set from a vector:

Map<Key, int> v = ...;
Set<int> set(v.values());

Definition at line 105 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
Sawyer::Container::Set< T, C, A >::Set ( const Set< T, C, A > &  other)
inline

Copy constructor.

Definition at line 111 of file Set.h.

Member Function Documentation

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
Set& Sawyer::Container::Set< T, C, A >::operator= ( const Set< T, C, A > &  other)
inline

Assignment operator.

Definition at line 115 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
boost::iterator_range<ConstIterator> Sawyer::Container::Set< T, C, A >::values ( ) const
inline
template<typename T, class C = std::less<T>, class A = std::allocator<T>>
bool Sawyer::Container::Set< T, C, A >::isEmpty ( ) const
inline

Whether the set is empty.

Returns true if the set is empty, false if not empty.

Definition at line 138 of file Set.h.

Referenced by Sawyer::Container::Set< Function::Ptr >::greatest(), Sawyer::Container::Set< Function::Ptr >::hull(), and Sawyer::Container::Set< Function::Ptr >::least().

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
bool Sawyer::Container::Set< T, C, A >::exists ( const Value value) const
inline
template<typename T, class C = std::less<T>, class A = std::allocator<T>>
bool Sawyer::Container::Set< T, C, A >::existsAny ( const Set< T, C, A > &  other) const
inline

Whether any value exists.

Returns true if any of the specified values exist in this set.

Definition at line 152 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
bool Sawyer::Container::Set< T, C, A >::existsAll ( const Set< T, C, A > &  other) const
inline

Whether all values exist.

Returns true if all specified values exist in this set.

Definition at line 163 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
size_t Sawyer::Container::Set< T, C, A >::size ( void  ) const
inline

Size of the set.

Returns the number of values that are members of this set.

Definition at line 174 of file Set.h.

Referenced by Rose::BinaryAnalysis::Partitioner2::CfgVertex::nOwningFunctions().

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
Value Sawyer::Container::Set< T, C, A >::least ( ) const
inline

Smallest member.

Returns the smallest member of the set. The set must not be empty.

Definition at line 181 of file Set.h.

Referenced by Sawyer::Container::Set< Function::Ptr >::hull().

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
Value Sawyer::Container::Set< T, C, A >::greatest ( ) const
inline

Largest member.

Returns the largest member of the set. The set must not be empty.

Definition at line 189 of file Set.h.

Referenced by Sawyer::Container::Set< Function::Ptr >::hull().

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
Interval<Value> Sawyer::Container::Set< T, C, A >::hull ( ) const
inline

Range of members.

Returns a range having the minimum and maximum members of the set.

Definition at line 199 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
bool Sawyer::Container::Set< T, C, A >::operator== ( const Set< T, C, A > &  other) const
inline

Whether two sets contain the same members.

Returns true if this set and other contain exactly the same members.

Definition at line 208 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
bool Sawyer::Container::Set< T, C, A >::operator!= ( const Set< T, C, A > &  other) const
inline

Whether two sets do not contain the same members.

Returns true if this set and the other set are not equal, although this method is faster than using !(*this==other).

Definition at line 216 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
bool Sawyer::Container::Set< T, C, A >::insert ( const Value value)
inline
template<typename T, class C = std::less<T>, class A = std::allocator<T>>
bool Sawyer::Container::Set< T, C, A >::insert ( const Set< T, C, A > &  values)
inline

Insert multiple values.

Inserts all specified values into this set. Returns true if any value was inserted, false if all the values were already members of this set.

Definition at line 236 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
bool Sawyer::Container::Set< T, C, A >::erase ( const Value value)
inline

Erase a value.

Erases value from the set. Returns true if the value was erased, false if the value was not a member.

Definition at line 248 of file Set.h.

Referenced by Rose::BinaryAnalysis::Partitioner2::CfgVertex::eraseOwningFunction(), Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::eraseWriter(), and Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::eraseWriters().

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
bool Sawyer::Container::Set< T, C, A >::erase ( const Set< T, C, A > &  values)
inline

Erase multiple values.

Erases all specified values from this set. Returns true if any value was erased, false if none of the specified values were members of this set.

Definition at line 256 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
void Sawyer::Container::Set< T, C, A >::clear ( )
inline

Erase all values.

Erases all values from the set so that the set becomes empty.

Definition at line 268 of file Set.h.

Referenced by Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::MemoryCell::eraseWriters(), and Rose::BinaryAnalysis::BestMapAddress::reset().

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
Set& Sawyer::Container::Set< T, C, A >::operator&= ( const Set< T, C, A > &  other)
inline

Intersects this set with another.

Removes those members of this set that are not in the other set.

Definition at line 275 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
Set& Sawyer::Container::Set< T, C, A >::operator|= ( const Set< T, C, A > &  other)
inline

Unions this set with another.

Adds those members of other that are not already members of this set.

Definition at line 290 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
Set& Sawyer::Container::Set< T, C, A >::operator-= ( const Set< T, C, A > &  other)
inline

Differences two sets.

Removes those members of this set that are in the other set. This is like the intersection of the complement but does not require computing a potentially large complement.

Definition at line 300 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
Set Sawyer::Container::Set< T, C, A >::operator& ( const Set< T, C, A > &  other) const
inline

Compute the intersection of this set with another.

Returns a new set which has only those members that are common to this set and the other set.

Definition at line 320 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
Set Sawyer::Container::Set< T, C, A >::operator| ( const Set< T, C, A > &  other) const
inline

Compute the union of this set with another.

Returns a new set containing the union of all members of this set and the other set.

Definition at line 329 of file Set.h.

template<typename T, class C = std::less<T>, class A = std::allocator<T>>
Set Sawyer::Container::Set< T, C, A >::operator- ( const Set< T, C, A > &  other) const
inline

Compute the difference of this set with another.

Returns a new set containing those elements of this set that are not members of the other set.

Definition at line 338 of file Set.h.


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