Merge branch 'master' into group-manager
[platform/upstream/iotivity.git] / service / scene-manager / src / SceneListResource.h
1 //******************************************************************
2 //
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 /**
22  * @file
23  *
24  * This file contains the declaration of classes and its members related to SceneListResrouceObject
25  */
26
27 #ifndef SCENE_LIST_RESOURCE_OBJECT_H
28 #define SCENE_LIST_RESOURCE_OBJECT_H
29
30 #include <string>
31
32 #include "RCSResourceObject.h"
33 #include "SceneCollectionResource.h"
34 #include "SceneCommons.h"
35
36 namespace OIC
37 {
38     namespace Service
39     {
40         class SceneListResource
41         {
42         public:
43             /**
44              * Returns Scene List Resource object as single instance.
45              */
46             static SceneListResource * getInstance();
47
48             /**
49              * Add Scene Collection resource object to Scene List Resource.
50              *
51              * @param collectionObj created Scene Collection Resource Object by constructor of SceneCollectionResourceObject class
52              */
53             void addSceneCollectionResource(SceneCollectionResource::Ptr collectionObj);
54
55             /**
56              * Returns Scene List name.
57              */
58             std::string getName() const;
59
60             /**
61              * Sets Scene List name.
62              *
63              * @param name name to set
64              */
65             void setName(std::string && name);
66
67             /**
68              * @overload
69              */
70             void setName(const std::string &);
71
72             /**
73              * Returns all of Scene Collection Resource object.
74              */
75             const std::vector<SceneCollectionResource::Ptr> getSceneCollections();
76
77         private:
78             class SceneListRequestHandler
79             {
80             public:
81                 SceneListRequestHandler() = default;
82                 ~SceneListRequestHandler() = default;
83
84                 static RCSSetResponse onSetRequest(const RCSRequest &, RCSResourceAttributes &);
85             };
86
87             std::string m_SceneListName;
88             RCSResourceObject::Ptr m_SceneListObj;
89             SceneListRequestHandler m_RequestHandler;
90             std::mutex m_SceneCollectionLock;
91             std::vector<SceneCollectionResource::Ptr> m_SceneCollections;
92
93             SceneListResource();
94             ~SceneListResource() = default;
95
96             SceneListResource(const SceneListResource &) = delete;
97             SceneListResource & operator = (const SceneListResource &) = delete;
98
99             SceneListResource(SceneListResource &&) = delete;
100             SceneListResource && operator = (SceneListResource &&) = delete;
101         };
102     }
103 }
104
105
106 #endif // SCENE_LIST_RESOURCE_OBJECT_H