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

This is a builder to create resource with properties and attributes. More...

Public Member Functions

 Builder (std::string uri, std::string type, std::string interface)
 Constructs a Builder. More...
 
BuilderaddInterface (std::string interface)
 Add an interface for the resource. More...
 
BuilderaddType (std::string type)
 Add a type for the resource. More...
 
BuildersetDefaultInterface (std::string interface)
 Sets the default interface. More...
 
BuildersetDiscoverable (bool discoverable)
 Sets whether the resource is discoverable. More...
 
BuildersetObservable (bool observable)
 Sets the observable property of the resource. More...
 
BuildersetSecureFlag (bool secureFlag)
 Sets whether the resource should be secure or not. More...
 
BuildersetAttributes (const RCSResourceAttributes &attributes)
 Sets attributes for the resource. More...
 
BuildersetAttributes (RCSResourceAttributes &&attributes)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
RCSResourceObject::Ptr build ()
 Register a resource and returns a RCSResourceObject. More...
 

Detailed Description

This is a builder to create resource with properties and attributes.

The resource will be observable and discoverable by default, to make them disable set these properties explicitly with setDiscoverable and setObservable.

"oic.if.baseline" is an interface that a resource always holds, by default, even it is not added manually.

Constructor & Destructor Documentation

OIC::Service::RCSResourceObject::Builder::Builder ( std::string  uri,
std::string  type,
std::string  interface 
)

Constructs a Builder.

Parameters
uriResource uri
typeResource type
interfaceResource interface

Member Function Documentation

Builder& OIC::Service::RCSResourceObject::Builder::addInterface ( std::string  interface)

Add an interface for the resource.

Parameters
interfacenew interface.
Builder& OIC::Service::RCSResourceObject::Builder::addType ( std::string  type)

Add a type for the resource.

Parameters
typenew type.
RCSResourceObject::Ptr OIC::Service::RCSResourceObject::Builder::build ( )

Register a resource and returns a RCSResourceObject.

Exceptions
RCSPlatformExceptionif resource registration is failed.
Builder& OIC::Service::RCSResourceObject::Builder::setAttributes ( const RCSResourceAttributes attributes)

Sets attributes for the resource.

Parameters
attributesattributes to set
Builder& OIC::Service::RCSResourceObject::Builder::setAttributes ( RCSResourceAttributes &&  attributes)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Builder& OIC::Service::RCSResourceObject::Builder::setDefaultInterface ( std::string  interface)

Sets the default interface.

If it is not called, the interface passed to the constructor is the default.

Parameters
interfacedefault interface name
Builder& OIC::Service::RCSResourceObject::Builder::setDiscoverable ( bool  discoverable)

Sets whether the resource is discoverable.

Parameters
discoverablewhether to be discoverable.
Builder& OIC::Service::RCSResourceObject::Builder::setObservable ( bool  observable)

Sets the observable property of the resource.

Parameters
observablewhether to be observable.
Builder& OIC::Service::RCSResourceObject::Builder::setSecureFlag ( bool  secureFlag)

Sets whether the resource should be secure or not.

Parameters
secureFlagwhether to be secure or not.

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