HydraExpress™ C++ API Reference Guide

Product Documentation:
   HydraExpress C++
Documentation Home
List of all members | Public Member Functions | Static Public Member Functions | Related Functions
rwsf::Attribute Class Reference

Provides a wrapper around any type to hold attribute values. More...

#include <rwsf/core/Attribute.h>

Inheritance diagram for rwsf::Attribute:
rwsf::HandleBase

Public Member Functions

 Attribute ()
 
 Attribute (const Attribute &rhs)
 
virtual ~Attribute ()
 
Attributeoperator= (const Attribute &rhs)
 
- Public Member Functions inherited from rwsf::HandleBase
bool isValid (void) const
 
bool operator!= (const HandleBase &second) const
 
bool operator== (const HandleBase &second) const
 

Static Public Member Functions

template<class T >
static T & value (Attribute &attr)
 
template<class T >
static const T & value (const Attribute &attr)
 

Related Functions

(Note that these are not member functions.)

template<class T >
void operator<< (Attribute &attr, const T &value)
 
template<class T >
void operator>> (const Attribute &attr, T &value)
 

Additional Inherited Members

- Protected Member Functions inherited from rwsf::HandleBase
 HandleBase (void)
 
 HandleBase (StaticCtor)
 
 HandleBase (BodyBase *body)
 
 HandleBase (const HandleBase &second)
 
virtual ~HandleBase (void)
 
BodyBase & body (void) const
 
HandleBaseoperator= (const HandleBase &second)
 

Detailed Description

rwsf::Attribute provides a wrapper around objects of any type. rwsf::Attribute contains a single object by value. The contained object must provide a default constructor, a copy constructor, and an assignment operator. The copy constructor must not invalidate the original object. The class provides an inserter template to copy values into an instance and an extractor template to copy values out of an instance.

An instance of rwsf::Attribute is the value of the key/value pair in several Core and Web Services classes, such as rwsf::CallInfo and rwsf::NamedObject.

Templatized insertion and extraction operators are provided for moving typed objects into and out of an rwsf::Attribute instance.

Note
This class uses reference semantics wherein copies and assignments always point to the same object instance.

Constructor & Destructor Documentation

rwsf::Attribute::Attribute ( )

Constructs an invalid Attribute instance. A typed object needs to be inserted into this object before it is usable.

rwsf::Attribute::Attribute ( const Attribute rhs)

Copy constructor. This instance becomes a handle to the same value as rhs. Attaches to and increments the reference count on the body of rhs.

virtual rwsf::Attribute::~Attribute ( )
virtual

Destructor. Detaches from the current body (if any), decrements its reference count, and deletes it if there are no other references.

Member Function Documentation

Attribute& rwsf::Attribute::operator= ( const Attribute rhs)

Assignment operator. Results in this instance referencing the same value as rhs.

template<class T >
static T& rwsf::Attribute::value ( Attribute attr)
static

Returns a reference to the typed value held in self. If this attribute does not hold an object of type T, throws an exception.

template<class T >
static const T& rwsf::Attribute::value ( const Attribute attr)
static

Returns a const reference to the typed value held in self. If this attribute does not hold an object of type T, throws an exception.

Friends And Related Function Documentation

template<class T >
void operator<< ( Attribute attr,
const T &  value 
)
related

Insertion operator. Inserts a copy of value into attr. Note that T must be a single object rather than an array, and that the operator uses the exact type of T. In particular, an attribute cannot hold an array of char. Instead, use an std::string:

Attribute attr;
attr << std::string("Inserts an std::string.");
template<class T >
void operator>> ( const Attribute attr,
T &  value 
)
related

Extraction operator. Extracts the value stored in attr and copies it into value. If attr does not contain a value, value is unchanged. Note that the type of value must exactly match the type inserted into attr. Otherwise, the operator throws an exception of type rwsf::Exception.

Copyright © 2019 Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is registered trademark of Rogue Wave Software, Inc. in the United States and other countries, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.