rwsf::ArrayHandle<T> rwsf::XmlOlHandle rwsf::HandleBase
#include <rw/rwsf/soapworx/ArrayHandle.h>
All generated SOAP-Encoded arrays are derived from rwsf::ArrayHandle<T> instantiated on the type of element contained in the array.
rwsf::ArrayHandle implements the handle/body idiom in which rwsf::ArrayBody is the body. The handle passes all methods to the body, which contains an instance of rwsf::SoapArray, the class that contains all the actual container functionality and to which the array body passes all its methods.
For more information on SOAP-Encoded arrays, see Section A.5.1, "SOAP-Encoded Arrays," in the HydraExpress Web Service Development Guide
Note: For information on the parent class rwsf::XmlOlHandle, see its entry in the HydraExpress XML Binding Reference Guide.
NOTE -- Handle methods that just call the corresponding method on the body are described only in the body class. For instance, if the handle class includes a method invoke() that calls the body's corresponding method doInvoke(), that method is documented only in the body class.
In this example, genArray is a SOAP array containing doubles, derived from rwsf::ArrayHandle.
// // genArrayExample.cpp // #include "genArray.h" #include <iostream> using std::cout; using std::endl; int main() { genArray array; array.insert(22.0); array.insert(5.3); array.insert(-102.5); array.insert(15.0); array.insert(5.3); // Prints "5" cout << array.entries() << " entries\n" << endl; for (genArray::iterator it = array.begin();
it != array.end(); it++) cout << *it << endl; return 0; }
Program Output:
5 entries 22 5.3 -102.5 15 5.3
typedef typename rwsf::ArrayBody<T> body_type; typedef typename body_type::iterator
iterator; typedef typename body_type::const_iterator const_iterator; typedef typename body_type::size_type size_type; typedef typename body_type::value_type value_type; typedef typename body_type::reference reference; typedef typename body_type::const_reference const_reference;
ArrayHandle<T>(ArrayBody<T>* body)
Constructs a new handle attached to the body body.
ArrayHandle<T>(const ArrayHandle<T>& other)
Copy constructor. Constructs a new handle from handle other.
ArrayHandle<T>(const rwsf::SoapArray<T>& body)
Constructs a new handle using the rwsf::SoapArray as the basis for the new body.
iterator begin(); const_iterator begin() const;
Returns an iterator positioned at the first element of the body.
iterator end(); const_iterator end() const;
Returns a past-the-end valued iterator of the body.
iterator insert(iterator it, const_reference key);
Adds the item key before position it in the array. The return value points to the position it.
iterator insert(const_reference key);
Adds the item key to the end of the collection.
reference operator()(size_type idx); const_reference operator() (size_type idx) const;
Returns a reference to the idxth element of the body. Index idx should be between 0 and one less then the number of entries, otherwise the results are undefined. No bounds checking is performed.
reference operator[](size_type idx); const_reference operator[](size_type idx) const;
Returns a reference to the idxth element of the body. Index idx must be between 0 and one less then the number of entries in self, otherwise the function throws an exception of type rwsf::OutOfBoundsException.
void append(const_reference item);
Adds item to the end of the collection body.
reference at(size_type idx); const_reference at(size_type idx) const;
Returns a reference to the idxth element of the body. Index idx must be between 0 and one less then the number of entries in self, otherwise the function throws an exception of type rwsf::OutOfBoundsException.
reference back(); const_reference back() const;
Returns a reference to the last element.
void clear();
Clears the collection by removing all items from the body. Each item will have its destructor called.
bool contains(const_reference key) const;
Returns true if there exists an element t in self such that the expression(t == key) is true, otherwise returns false.
bool empty() const;
Returns true if the size is zero.
size_type entries() const;
Returns the number of elements in the body.
bool find(const_reference key, value_type& val) const;
If there exists an element t in self such that the expression (t == key) is true, assigns t to val and returns true. Otherwise, returns false and leaves the value of val unchanged.
reference first(); const_reference first() const;
Returns a reference to the first element of the body.
std::vector<size_t>& getDimensions() const std::vector<size_t>& getDimensions() const
Returns a vector containing the size of each dimension in the array. If the array is int[2,3,4], then the returned vector contains 2, 3 and 4 in that order. Any dimension without a size is set to 0. For example, a one-dimension array returns a vector with a single element whose value is the upper bound of the array or 0 if there is no upper bound (defined as int[]).
size_type index(const_reference key) const;
Returns the position of the first item t in the body, such that (t == key), or returns rwsf_NPOS if no such item exists.
void insertAt(size_type index, const_reference item);
Inserts item in front of the item at position index in self. This position must be between 0 and the number of entries in the collection, otherwise the function throws an exception of type rwsf::OutOfBoundsException.
bool isEmpty() const;
Returns true if there are no items in the collection, false otherwise.
reference last(); const_reference last() const;
Returns a reference to the last item in the collection.
size_type length() const;
Returns the number of elements in the body.
size_type occurrencesOf(const_reference key) const;
Returns the number of elements t in self such that the expression (t == key) is true.
void parseDimensions(const std::string& arrayType) Parses the dimension string in the XML SOAP Array definition and sets the array dimensions in "this". void prepend(const_reference item);
Adds the item a to the beginning of the collection.
void push_back(const_reference item);
Inserts a copy of item to the end of the body.
bool remove(const_reference key);
Removes the first element t in self such that the expression (t == key) is true and returns true. Returns false if there is no such element.
size_type removeAll(const_reference key);
Removes all elements t in self such that the expression (t == key) is true. Returns the number of items removed.
value_type removeAt(size_type index);
Removes and returns the item at position index in self. This position must be between 0 and one less then the number of entries in the collection, otherwise the function throws an exception of type rwsf::OutOfBoundsException.
value_type removeFirst();
Removes and returns the first item in the collection.
value_type removeLast();
Removes and returns the last item in the collection.
size_type replaceAll(const_reference oldVal, const_reference newVal);
Replaces all elements t in self such that the expression (t == oldVal) is true with newVal. Returns the number of items replaced.
void resize(size_t n);
Modify the capacity of the vector to be at least as large as n. The function has no effect if the capacity is already as large as n.
size_type size() const
Returns the number of elements in the body.
body_type & body() const body_type& body() const
Returns the array, a rwsf::ArrayBody.
©2004-2007 Copyright Quovadx, Inc. All Rights Reserved.
Quovadx and Rogue Wave are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.