* It provides the build() API
* which builds a resource and return pointer to RCSResourceObject class.
*
- *@see build()
+ * @see build()
*/
class Builder
{
const std::string &interface);
/**
- * Sets the discoverable(OC_DISCOVERABLE) property for the resource.
- *
- * @param discoverable Whether to be discovered.
- *
- * @return reference of this Builder
- *
- *@see OC_DISCOVERABLE
- */
+ * Sets the discoverable(OC_DISCOVERABLE) property for the resource.
+ *
+ * @param discoverable Whether to be discovered.
+ *
+ * @return reference of this Builder
+ *
+ * @see OC_DISCOVERABLE
+ */
Builder &setDiscoverable(bool discoverable);
/**
- * Sets the observable(OC_OBSERVABLE) property of the resource.
- *
- * @param observable Whether to be observed.
- *
- * @return reference of this Builder
- *
- *@see OC_OBSERVABLE
- */
+ * Sets the observable(OC_OBSERVABLE) property of the resource.
+ *
+ * @param observable Whether to be observed.
+ *
+ * @return reference of this Builder
+ *
+ * @see OC_OBSERVABLE
+ */
Builder &setObservable(bool observable);
/**
- * Sets attribute of the resource.
- *
- * @param attributes Resource attributes to set
- *
- * @return reference of this Builder
- */
+ * Sets attribute of the resource.
+ *
+ * @param attributes Resource attributes to set
+ *
+ * @return reference of this Builder
+ */
Builder &setAttributes(const RCSResourceAttributes &attributes);
/**
- * API for setting attributes of the resource.
- *
- * @param attributes Resource Attributes to set
- *
- * @return reference of this Builder
- */
+ * API for setting attributes of the resource.
+ *
+ * @param attributes Resource Attributes to set
+ *
+ * @return reference of this Builder
+ */
Builder &setAttributes(RCSResourceAttributes &&attributes);
/**
typedef std::function < RCSSetResponse(const RCSRequest&,
RCSResourceAttributes&) > SetRequestHandler;
+ /**
+ * typedef for characterizing AttributeUpdatedListener with 2 parameters.
+ *
+ * The first Value represents the old Value before being changed.
+ * The second Value means the new Value right after when it is used
+ *
+ * @see addAttributeUpdatedListener
+ */
typedef std::function < void(const RCSResourceAttributes::Value&,
const RCSResourceAttributes::Value &) > AttributeUpdatedListener;
* @note It is guaranteed thread-safety about attributes.
*
* @throw InvalidKeyException
- * Throw exception when empty string is provided as Attribute key.
+ * Throw an exception when key is empty.
*/
RCSResourceAttributes::Value getAttributeValue(const std::string& key) const;
*
* @param key Name of the attribute
*
- * @return resource attributes value.
+ * @return resource attributes value which can support various types.
+ *
+ * @see ValueVariant
*
* It is guaranteed thread-safety about attributes.
*/
*
* @param key Name of the attribute.
*
- * @return If the key exist and matched attribute is deleted, return true.
+ * @return If the key exists and matched attribute is deleted, return true.
*
* It is guaranteed thread-safety about attributes.
*/
*
* @param key Name of the attribute.
*
- * @return If the key exist, return true.
+ * @return If the key exists, return true.
*
* It is guaranteed thread-safety about attributes.
*/
* API for getting all the attributes of the RCSResourceObject.
* It invokes the expectOwnLock() API to check the owner of the lock using the
* thread id.
- * If it is not the owner then it throws exception.
+ * If it is not the owner then it throws an exception.
*
* @return reference of the attributes of this RCSResourceObject.
*
const RCSResourceAttributes& getAttributes() const;
/**
- * API for checking whether the particular resource is observable or not
- */
+ * API for checking whether the particular resource is observable or not
+ */
virtual bool isObservable() const;
/**
- * API for checking whether the particular resource is discoverable or not
- */
+ * API for checking whether the particular resource is discoverable or not
+ */
virtual bool isDiscoverable() const;
/**
* @param key The interested attribute's key
* @param listener Listener for updation of the interested attribute
*
+ * @see AttributeUpdatedListener
*/
virtual void addAttributeUpdatedListener(const std::string& key,
AttributeUpdatedListener listener);
* @param key The interested attribute's key
* @param listener Listener for updation of the interested attribute
*
+ * @see AttributeUpdatedListener
*/
virtual void addAttributeUpdatedListener(std::string&& key,
AttributeUpdatedListener listener);
/**
- * API for removing the handler for a particular attribute update.
- *
- * @param key The interested attribute's key
- *
- */
+ * API for removing the Listener for a particular attribute update.
+ *
+ * @param key The name of interested attribute's key
+ *
+ */
virtual bool removeAttributeUpdatedListener(const std::string& key);
/**
virtual void notify() const;
/**
- * API for setting Auto notify policy
- *
- * @param policy policy to be set
- *
- * @see AutoNotifyPolicy
- *
- */
+ * API for setting Auto notify policy
+ *
+ * @param policy policy to be set
+ *
+ * @see AutoNotifyPolicy
+ *
+ */
void setAutoNotifyPolicy(AutoNotifyPolicy policy);
/**
- * API for getting auto notify policy
- *
- * @returns AntoNotify policy
- *
- * @see AutoNotifyPolicy
- *
- */
+ * API for getting auto notify policy
+ *
+ * @returns AntoNotify policy
+ *
+ * @see AutoNotifyPolicy
+ *
+ */
AutoNotifyPolicy getAutoNotifyPolicy() const;
/**
- * API for setting the policy for a setRequestHandler.
- *
- * @param policy policy to be set
- *
- * @see SetRequestHandlerPolicy
- *
- */
+ * API for setting the policy for a setRequestHandler.
+ *
+ * @param policy policy to be set
+ *
+ * @see SetRequestHandlerPolicy
+ *
+ */
void setSetRequestHandlerPolicy(SetRequestHandlerPolicy policy);
/**
- * API for getting the SetRequestHandler Policy.
- *
- * @returns Property of setRequesthandler
- *
- * @see SetRequestHandlerPolicy
- *
- */
+ * API for getting the SetRequestHandler Policy.
+ *
+ * @returns Property of setRequesthandler
+ *
+ * @see SetRequestHandlerPolicy
+ *
+ */
SetRequestHandlerPolicy getSetRequestHandlerPolicy() const;
private:
};
+ /**
+ * @class LockGuard
+ *
+ * The class LockGuard owns a mutex for the duration of a scoped block.
+ * When a LockGuard is created, it attempts to take ownership of the mutex it is given.
+ * When control leaves the scope in which the LockGuard object was created,
+ * the LockGuard is destructed and the mutex is released.
+ *
+ */
class RCSResourceObject::LockGuard
{
public:
+ /**
+ * The function locks the objects and ensures that all arguments are locked on return.
+ * Working of AutoNotifyPolicy follows the current AutoNotifyPolicy status
+ *
+ * @param Object to be locked
+ *
+ */
LockGuard(const RCSResourceObject&);
+
+ /**
+ * @overload
+ */
LockGuard(const RCSResourceObject::Ptr);
+
+ /**
+ * The function locks the objects and ensures that all arguments are locked on return.
+ *
+ * @param Object to be locked
+ * @param AutoNotifyPolicy is set for sepcifying AutoNotifyPolicy status
+ *
+ * @see AutoNotifyPolicy
+ */
LockGuard(const RCSResourceObject&, AutoNotifyPolicy);
+
+ /**
+ * @overload
+ */
LockGuard(const RCSResourceObject::Ptr, AutoNotifyPolicy);
~LockGuard();