stlab.adobe.com Adobe Systems Incorporated

selection_t Class Reference
[Selection]

A container used to represent a linear boolean selection. More...

#include <selection.hpp>

List of all members.

Public Types

typedef store_type::const_iterator const_iterator
typedef const value_typeconst_pointer
typedef const value_typeconst_reference
typedef store_type::difference_type difference_type
typedef store_type::iterator iterator
typedef value_typepointer
typedef value_typereference
typedef store_type::size_type size_type
typedef std::vector< value_typestore_type
typedef std::size_t value_type

Public Member Functions

const_iterator begin () const
bool empty () const
const_iterator end () const
void invert ()
const value_typeoperator[] (const size_type &i) const
void push_back (const value_type &x)
 selection_t (bool start_selected=false)
template<typename I >
 selection_t (I first, I last, bool start_selected=false)
size_type size () const
bool start_selected () const

Friends

bool operator== (const selection_t &x, const selection_t &y)

Detailed Description

A linear boolean selection is a set of context-free indices, each of which toggles the selection "on" or "off". From an implementation standpoint, each selection index must be greater than the one that precedes it (strictly monotonically increasing). There is also a boolean value associated with the selection, and that is to represent whether or not the selection is to start out "on" or "off" -- thus the inversion of a selection has the same selection boundary set but a different boolean value.

Selections are context-free, meaning that a selection can be spoken about without making reference to a container. This allows for selections to be manipulated without applying them to a series of elements (e.g., union, size, etc.). Selections can then be applied to a container to get context-relevant information (e.g., the number of elements contained within a selection). Selections can also be used in place of a predicate for some algorithms. There are a series of algorithms associated with the selection container; Please see selection.

Definition at line 48 of file selection.hpp.


Member Typedef Documentation

typedef store_type::const_iterator const_iterator

const_iterator for selection_t

Definition at line 58 of file selection.hpp.

typedef const value_type* const_pointer

const_pointer for selection_t

Definition at line 70 of file selection.hpp.

typedef const value_type& const_reference

const_reference for selection_t

Definition at line 66 of file selection.hpp.

typedef store_type::difference_type difference_type

difference_type for selection_t

Definition at line 62 of file selection.hpp.

typedef store_type::iterator iterator

iterator for selection_t

Definition at line 56 of file selection.hpp.

typedef value_type* pointer

pointer for selection_t

Definition at line 68 of file selection.hpp.

reference for selection_t

Definition at line 64 of file selection.hpp.

typedef store_type::size_type size_type

size_type for selection_t

Definition at line 60 of file selection.hpp.

typedef std::vector<value_type> store_type

store_type for selection_t

Definition at line 54 of file selection.hpp.

typedef std::size_t value_type

value_type for selection_t

Definition at line 52 of file selection.hpp.


Constructor & Destructor Documentation

selection_t ( bool  start_selected = false ) [explicit]

Default constructor.

Parameters:
start_selectedSpecifies whether or not this selection begins "on" or not. If so, a selection has everything selected when it is first constructed (as it has no other toggle points).

Definition at line 79 of file selection.hpp.

selection_t ( first,
last,
bool  start_selected = false 
)

Constructor with the ability to initialize the selection with toggle points from the get-go.

Precondition:
[ first, last ) is strictly monotonically increasing
Parameters:
firstan iterator to the first toggle point to include
lastan iterator to one past the last toggle point to include
start_selectedSpecifies whether or not this selection begins "on" or not.

Definition at line 94 of file selection.hpp.


Member Function Documentation

const_iterator begin (  ) const

gets an iterator to the beginning of the toggle point sequence

Definition at line 121 of file selection.hpp.

bool empty (  ) const
Returns:
true if there is at least one toggle point, or the selection starts selected.

Definition at line 108 of file selection.hpp.

const_iterator end (  ) const

gets an iterator to the end of the toggle point sequence

Definition at line 124 of file selection.hpp.

void invert (  )

inverts the selection.

Definition at line 133 of file selection.hpp.

const value_type& operator[] ( const size_type i ) const

fetches a toggle point at index i of the toggle point sequence

Definition at line 127 of file selection.hpp.

void push_back ( const value_type x )

pushes a toggle point onto the back of the selection. The index must be greater than the previous toggle point.

Definition at line 113 of file selection.hpp.

size_type size (  ) const
Returns:
the number of boundaries in the selection; to get the number of elements contained within a selection, a container must also be supplied, as such: selection_t::size_type selected_element_size(adobe::size(selection, container))

Definition at line 104 of file selection.hpp.

bool start_selected (  ) const
Returns:
Whether or not the selection begins toggled "on"

Definition at line 139 of file selection.hpp.


Friends And Related Function Documentation

bool operator== ( const selection_t x,
const selection_t y 
) [friend]

Definition at line 142 of file selection.hpp.

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google