ROSE  0.9.10.54
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 46 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 50 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 51 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 52 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 53 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 73 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 79 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 94 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 99 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 105 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 109 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 132 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 146 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 157 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 168 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 175 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 183 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 193 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 202 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 210 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 230 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 242 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 250 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 262 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 269 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 284 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 294 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 314 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 323 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 332 of file Set.h.


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