IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OIC::Service::RCSResourceAttributes Class Reference

This represents the attributes for a resource. More...

Classes

class  const_iterator
 A forward iterator to const KeyValuePair. More...
 
struct  is_supported_type
 Trait class that identifies whether T is supported by the Value. More...
 
class  iterator
 A forward iterator to KeyValuePair. More...
 
class  KeyValuePair
 KeyValuePair is a class to access attribute's key and value of an element pointed by iterators of RCSResourceAttributes. More...
 
class  Type
 A Helper class to identify types of Value. More...
 
class  Value
 Value holds a value among various types at a time. More...
 

Public Types

enum  TypeId {
  TypeId::NULL_T, TypeId::INT, TypeId::DOUBLE, TypeId::BOOL,
  TypeId::STRING, TypeId::BYTESTRING, TypeId::ATTRIBUTES, TypeId::VECTOR
}
 Identifiers for types of Value. More...
 

Public Member Functions

 RCSResourceAttributes ()=default
 
 RCSResourceAttributes (const RCSResourceAttributes &)=default
 
 RCSResourceAttributes (RCSResourceAttributes &&)=default
 
RCSResourceAttributesoperator= (const RCSResourceAttributes &)=default
 
RCSResourceAttributesoperator= (RCSResourceAttributes &&)=default
 
iterator begin () BOOST_NOEXCEPT
 Returns an iterator referring to the first element. More...
 
iterator end () BOOST_NOEXCEPT
 Returns an iterator referring to the past-the-end element. More...
 
const_iterator begin () const BOOST_NOEXCEPT
 Returns a const_iterator referring to the first element. More...
 
const_iterator end () const BOOST_NOEXCEPT
 Returns a const_iterator referring to the past-the-end element. More...
 
const_iterator cbegin () const BOOST_NOEXCEPT
 Returns a const_iterator referring to the first element. More...
 
const_iterator cend () const BOOST_NOEXCEPT
 Returns a const_iterator referring to the past-the-end element. More...
 
Valueoperator[] (const std::string &key)
 Accesses a value. More...
 
Valueoperator[] (std::string &&key)
 Accesses a value. More...
 
Valueat (const std::string &key)
 Accesses a value. More...
 
const Valueat (const std::string &key) const
 Accesses a value. More...
 
void clear () BOOST_NOEXCEPT
 Removes all elements. More...
 
bool erase (const std::string &key)
 Removes a single element. More...
 
iterator erase (const_iterator pos)
 Removes a single element. More...
 
bool contains (const std::string &key) const
 Checks this contains an element for the specified key. More...
 
bool empty () const BOOST_NOEXCEPT
 Returns whether it is empty. More...
 
size_t size () const BOOST_NOEXCEPT
 Returns the number of elements. More...
 

Related Functions

(Note that these are not member functions.)

bool operator== (const RCSResourceAttributes &lhs, const RCSResourceAttributes &rhs)
 
bool operator!= (const RCSResourceAttributes &, const RCSResourceAttributes &)
 

Detailed Description

This represents the attributes for a resource.

It provides similar usage to c++ standard containers. (iterator, operators and accessors)
An attribute value can be one of various types.

See Also
Value
Type
iterator
const_iterator
RCSDiscoveryManager
RCSRemoteResourceObject
RCSResourceObject
RCSByteString

Member Enumeration Documentation

Identifiers for types of Value.

See Also
Type
Enumerator
NULL_T 

nullptr_t

INT 

int

DOUBLE 

double

BOOL 

bool

STRING 

std::string

BYTESTRING 

RCSByteString.

ATTRIBUTES 

RCSResourceAttributes.

VECTOR 

std::vector

Constructor & Destructor Documentation

OIC::Service::RCSResourceAttributes::RCSResourceAttributes ( )
default
OIC::Service::RCSResourceAttributes::RCSResourceAttributes ( const RCSResourceAttributes )
default
OIC::Service::RCSResourceAttributes::RCSResourceAttributes ( RCSResourceAttributes &&  )
default

Member Function Documentation

Value& OIC::Service::RCSResourceAttributes::at ( const std::string &  key)

Accesses a value.

If key matches the key of a value, returns a reference to its mapped value.
If key doesn't match the key of any value, throws InvalidKeyException.

Parameters
keyKey of the element whose mapped value is accessed.
Exceptions
InvalidKeyExceptionIf key doesn't match the key of any value.
Returns
A reference to the mapped value with key.
See Also
operator[]
const Value& OIC::Service::RCSResourceAttributes::at ( const std::string &  key) const

Accesses a value.

If key matches the key of a value, returns a reference to its mapped value.
If key doesn't match the key of any value, throws InvalidKeyException.

Parameters
keyKey of the element whose mapped value is accessed.
Exceptions
InvalidKeyExceptionIf key doesn't match the key of any value.
Returns
A const reference to the mapped value with key.
See Also
operator[]
iterator OIC::Service::RCSResourceAttributes::begin ( )

Returns an iterator referring to the first element.

const_iterator OIC::Service::RCSResourceAttributes::begin ( ) const

Returns a const_iterator referring to the first element.

const_iterator OIC::Service::RCSResourceAttributes::cbegin ( ) const

Returns a const_iterator referring to the first element.

const_iterator OIC::Service::RCSResourceAttributes::cend ( ) const

Returns a const_iterator referring to the past-the-end element.

void OIC::Service::RCSResourceAttributes::clear ( )

Removes all elements.

bool OIC::Service::RCSResourceAttributes::contains ( const std::string &  key) const

Checks this contains an element for the specified key.

Parameters
keyKey to check.
Returns
true if an element exists, false otherwise.
bool OIC::Service::RCSResourceAttributes::empty ( ) const

Returns whether it is empty.

See Also
size
iterator OIC::Service::RCSResourceAttributes::end ( )

Returns an iterator referring to the past-the-end element.

const_iterator OIC::Service::RCSResourceAttributes::end ( ) const

Returns a const_iterator referring to the past-the-end element.

bool OIC::Service::RCSResourceAttributes::erase ( const std::string &  key)

Removes a single element.

Parameters
keyKey of the element to be removed.
Returns
true if an element is erased, false otherwise.
iterator OIC::Service::RCSResourceAttributes::erase ( const_iterator  pos)

Removes a single element.

Parameters
posIterator to the element to remove.
Returns
Iterator following the last removed element.
RCSResourceAttributes& OIC::Service::RCSResourceAttributes::operator= ( const RCSResourceAttributes )
default
RCSResourceAttributes& OIC::Service::RCSResourceAttributes::operator= ( RCSResourceAttributes &&  )
default
Value& OIC::Service::RCSResourceAttributes::operator[] ( const std::string &  key)

Accesses a value.

If key matches the key of a value, returns a reference to its mapped value.
If key doesn't match the key of any value, inserts a new value with that key and returns a reference to it. The element is a Value that has null.

Parameters
keyKey of the element whose mapped value is accessed.
Returns
A reference to the mapped value with key.
See Also
at
Value& OIC::Service::RCSResourceAttributes::operator[] ( std::string &&  key)

Accesses a value.

If key matches the key of a value, returns a reference to its mapped value.
If key doesn't match the key of any value, inserts a new value with that key and returns a reference to it. The value has null.

Parameters
keyKey of the element whose mapped value is accessed. This is moved instead of copied when a new value is inserted.
Returns
A reference to the mapped value with key.
See Also
at
size_t OIC::Service::RCSResourceAttributes::size ( ) const

Returns the number of elements.

See Also
empty

Friends And Related Function Documentation

bool operator!= ( const RCSResourceAttributes ,
const RCSResourceAttributes  
)
related

Checks if the attributes are not equal, that is, whether contents are not equal.

Returns
true if the attributes are not equal, false otherwise.
bool operator== ( const RCSResourceAttributes lhs,
const RCSResourceAttributes rhs 
)
related

Checks if the attributes are equal, that is, whether contents are equal.

Returns
true if the attributes are equal, false otherwise.

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