diff --git a/LvaluePropertyAccessor.html b/LvaluePropertyAccessor.html deleted file mode 100644 index 06ba40e..0000000 --- a/LvaluePropertyAccessor.html +++ /dev/null @@ -1,106 +0,0 @@ - - -
-
-
-| PA | -A type that is a model of LvaluePropertyAccessor. | -
| pa | -An object of type PA. | -
| key | -An object of type boost::property_traits<PA>::key_type. | -
| Property Accessor Category - | boost::property_traits<PA>::category | --The category of the property: a type convertible to -boost::lvalue_property_accessor_tag. - | -
| Name | Expression | Return Type | Description | -
|---|---|---|---|
| Access Property Value | -pa[key] | --value_type& for mutable, const value_type& -otherwise. - | -Obtain a reference to the property identified by key. | -
| Copyright © 2000 | -Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu) - |
-
-| PA | -A type that is a model of LvaluePropertyAccessor. | -
| Property Accessor Category - | boost::property_traits<PA>::category | --The category of the property accessor must be a type convertible to -read_write_property_accessor_tag. - | -
| Copyright © 2000 | -Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu) - |
-
-| PA | -A type that is a model of LvaluePropertyAccessor. | -
| pa | -An object of type PA. | -
| key | -An object of type boost::property_traits<PA>::key_type. | -
| Value Type | -boost::property_traits<PA>::value_type | -The type of the property. | -
| Key Type | -boost::property_traits<PA>::key_type | --The type of the key object used to look up the property. The property -accessor may be templated on the key type, in which case this -typedef can be void. - | -
| Property Accessor Category | -boost::property_traits<PA>::category | --The category of the property: a type convertible to -readable_property_accessor_tag. - | -
| Name | Expression | Return Type | Description | -
|---|---|---|---|
| Get Property Value | -get(pa, key) | -value_type | -Lookup the property of the object identified by key. | -
| Copyright © 2000 | -Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu) - |
-
-| PA | -A type that is a model of LvaluePropertyAccessor. | -
| pa | -An object of type PA. | -
| key | -An object of type boost::property_traits<PA>::key_type. | -
| val | -An object of type boost::property_traits<PA>::value_type. | -
| Value Type | -boost::property_traits<PA>::value_type | --The type of the property. - | -
| Key Type | -boost::property_traits<PA>::key_type | --The type of the key object used to look up the property. The property -accessor may be templated on the key type, in which case this typedef -can be void. - | -
| Property Accessor Category | -boost::property_traits<PA>::category | --The category of the property: a type convertible to -writable_property_accessor_tag. - | -
| Name | Expression | Return Type | Description | -
|---|---|---|---|
| Put Property Value[1] | -put(pa, key, val) | -void | --Assign val to the property associated with k. - | -
-#include <set>
-using namespace std;
-namespace boost {
- void set() { }
-}
-
-
-
-| Copyright © 2000 | -Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu) - |
-
--identity_property_accessor --
| Type | Description | -
|---|---|
| -boost::property_traits<identity_property_accessor>::value_type - | --This type is void; the accessor functions are templated. - | -
| -boost::property_traits<identity_property_accessor>::key_type - | --This type is void; the accessor functions are templated. - | -
| -boost::property_traits<identity_property_accessor>::category - | --This type is boost::readable_op_bracket_tag. - | -
| Member | Description | -
|---|---|
|
-template <class T> -T operator[](T x) const - |
--Returns a copy of object x. - | -
| Member | Description | -
|---|---|
|
-template <class T> -T get(const identity_property_accessor& pa, T x) - |
--Returns a copy of object x. - | -
| Copyright © 2000 |
-Jeremy Siek,
-Univ.of Notre Dame (jsiek@lsc.nd.edu) -Lie-Quan Lee, Univ.of Notre Dame (llee1@lsc.nd.edu) -Andrew Lumsdaine, -Univ.of Notre Dame (lums@lsc.nd.edu) - |
-
-
-template <class AddressAccessor>
-void foo(AddressAccessor address)
-{
- typedef typename boost::property_traits<AddressAccessor>::value_type value_type;
- typedef typename boost::property_traits<AddressAccessor>::key_type key_type;
-
- value_type old_address, new_address;
- key_type fred = "Fred";
- old_address = get(address, fred);
- new_address = "384 Fitzpatrick Street"
- put(address, fred, new_address);
-
- key_type joe = "Joe";
- value_type& joes_address = at(address, joe);
- joes_address = "325 Cushing Avenue";
-}
-
-
--For each property accessor object there is a set of valid keys -for which the mapping to value objects is defined. Invoking a -property accessor function on an invalid key results in -undefined behaviour. The property accessor concepts do not specify how -this set of valid keys is created or modified. A function that uses a -property accessor must specify the expected set of valid keys in its -preconditions. - -
-The need for property accessors came out of the design of the Boost -Graph Library, whose algorithms needed an interface for accessing -properties attached to vertices and edges in a graph. In this context -the vertex and edge descriptors are the key type of the property -accessors. - - - -
-Several categories of property accessors provide -different access capabilities: -
-
-
-
-
-There is a separate concept defined for each of the four property -accessor categories. These property accessor concepts are listed -below, with links to the documentation for each of them. - -
-There is a tag struct for each of the categories of property -accessors, which is defined in the header -<boost/property_accessor.hpp>. - -
-
-namespace boost {
-
- struct readable_property_accessor_tag { };
-
- struct writable_property_accessor_tag { };
-
- struct read_write_property_accessor_tag :
- public readable_property_accessor_tag,
- public writable_property_accessor_tag { };
-
- struct lvalue_property_accessor_tag :
- public read_write_property_accessor_tag { };
-
-}
-
-
--Similar to the std::iterator_traits class of the STL, there -is a boost::property_traits class that can be used to deduce -the types associated with a property accessor type: the key and value -types, and the property accessor category. There is a specialization -of boost::property_traits so that pointers can be used as -property accessor objects. In addition, the property accessor -functions are overloaded for pointers. These traits classes and -functions are defined in <boost/property_accessor.hpp>. - -
-
-namespace boost {
-
- template <class PropertyAccessor>
- struct property_traits {
- typedef typename PropertyAccessor::key_type key_type;
- typedef typename PropertyAccessor::value_type value_type;
- typedef typename PropertyAccessor::category category;
- };
-
- // specialization for using pointers as property accessors
- template <class T>
- struct property_traits<T*> {
- typedef T value_type;
- typedef ptrdiff_t key_type;
- typedef random_access_iterator_pa_tag category;
- };
-
- // overloads of the property accessor functions for pointers
- template
- void put(T* pa, std::ptrdiff_t k, const T& val) { pa[k] = val; }
-
- template
- const T& get(const T* pa, std::ptrdiff_t k) { return pa[k]; }
-
- template
- T& at(T* pa, std::ptrdiff_t k) { return pa[k]; }
-
- template
- const T& at(const T* pa, std::ptrdiff_t k) { return pa[k]; }
-
-}
-
-
-
-| Copyright © 2000 | -Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu) - |
-
--random_access_iterator_property_accessor<Iterator,T,R,OffsetPA> --
-This property accessor is an adaptor that converts any random access -iterator into a LvaluePropertyAccessor. -The OffsetPA type is responsible for converting -key objects to integers that can be used as offsets with the -random access iterator. - -
- -
-// print out the capacity and flow for all the edges in the graph
-template <class Graph, class CapacityPA, class FlowPA>
-void print_network(Graph& G, CapacityPA capacity, FlowPA flow)
-{
- typedef typename boost::graph_traits<Graph>::vertex_iterator Viter;
- typedef typename boost::graph_traits<Graph>::out_edge_iterator OutEdgeIter;
- typedef typename boost::graph_traits<Graph>::in_edge_iterator InEdgeIter;
-
- Viter ui, uiend;
- for (boost::tie(ui, uiend) = vertices(G); ui != uiend; ++ui) {
- OutEdgeIter out, out_end;
- std::cout << *ui << "\t";
-
- for(boost::tie(out, out_end) = out_edges(*ui, G); out != out_end; ++out)
- std::cout << "--(" << get(capacity, *out) << ", "
- << get(flow, *out) << ")--> " << target(*out,G) << "\t";
- std::cout << std::endl << "\t";
-
- InEdgeIter in, in_end;
- for(boost::tie(in, in_end) = in_edges(*ui, G); in != in_end; ++in)
- std::cout << "<--(" << get(capacity, *in) << "," << get(flow, *in) << ")-- "
- << source(*in,G) << "\t";
- std::cout << std::endl;
- }
-}
-
-int main(int, char*[])
-{
- typedef boost::adjacency_list<boost::vecS, boost::vecS,
- boost::bidirectionalS, boost::no_plugin,
- boost::plugin<boost::id_tag, std::size_t> > Graph;
-
- const int num_vertices = 9;
- Graph G(num_vertices);
-
- int capacity[] = { 10, 20, 20, 20, 40, 40, 20, 20, 20, 10 };
- int flow[] = { 8, 12, 12, 12, 12, 12, 16, 16, 16, 8 };
-
- // add edges to the graph, and assign each edge an ID number
- // to index into the property arrays
- add_edge(G, 0, 1, 0);
- // ...
-
- typedef boost::graph_traits<Graph>::edge_descriptor Edge;
- typedef boost::edge_property_accessor<Graph, boost::id_tag>::type EdgeID_PA;
- EdgeID_PA edge_id = get_edge_property_accessor(G, boost::id_tag());
-
- boost::random_access_iterator_property_accessor<int*, int, int&, EdgeID_PA>
- capacity_pa(capacity, edge_id),
- flow_pa(flow, edge_id);
-
- print_network(G, capacity_pa, flow_pa);
-
- return 0;
-}
-
-
--boost/property_accessor.hpp - -
-
- -
- -
| Parameter | Description | Default | -
|---|---|---|
| Iterator | -Must be a model of RandomAccessIterator. | -- |
| T | -The value type of the iterator. | -std::iterator_traits<RandomAccessIterator>::value_type | -
| R | -The reference type of the iterator. | -std::iterator_traits<RandomAccessIterator>::reference | -
| OffsetPA | Must be a model of ReadablePropertyAccessor -and the value type must be convertible to the difference type of the -iterator. | boost::identity_property_accessor | -
- -
-In addition the methods and functions required by LvaluePropertyAccessor, this -class has the following members. - -
- -
| Member | Description | -
|---|---|
| -value_type - | -This will be the same type as -std::iterator_traits<Iterator>::value_type. - | -
| -random_access_iterator_property_accessor(Iterator i) - | --Constructor. - | -
| -reference operator[](difference_type v) const - | --The operator bracket for property access. The reference and -difference_type types are from -std::iterator_traits<Iterator>. - | -
| Copyright © 2000 |
-Jeremy Siek,
-Univ.of Notre Dame (jsiek@lsc.nd.edu) -Lie-Quan Lee, Univ.of Notre Dame (llee1@lsc.nd.edu) -Andrew Lumsdaine, -Univ.of Notre Dame (lums@lsc.nd.edu) - |