[CONPRO-1430] BlockWiseTransfer Error
[platform/upstream/iotivity.git] / service / scene-manager / include / SceneCollection.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 #ifndef SM_SCENECOLLECTION_H_
22 #define SM_SCENECOLLECTION_H_
23
24 #include "Scene.h"
25
26 namespace OIC
27 {
28     namespace Service
29     {
30
31         class SceneCollectionResource;
32
33         /**
34          * @class SceneCollection
35          *
36          * @brief SceneCollection class is an interface class to manage SceneCollection resource.
37          * This class provides APIs to create a new Scene instance and retrieve all Scene instances
38          * created before. Besides, it provide APIs for retrieving and updating attribute values
39          * like name attribute
40          *
41          */
42         class SceneCollection
43         {
44         public:
45             typedef std::shared_ptr< SceneCollection > Ptr;
46
47         private:
48             SceneCollection(const std::shared_ptr< SceneCollectionResource >&);
49             friend class SceneList;
50
51         public:
52
53             /**
54              * Adds new Scene instance to SceneCollection resource
55              *
56              * @param sceneName              A scene's name
57              *
58              * @return A shared pointer of Scene instance
59              *
60              * @throw RCSInvalidParameterException if scene name is empty
61              * @throw RCSInvalidParameterException if scene name is dupltcated
62              *
63              * @note Scene instance is only produced by SceneCollection class
64              * @note Scene's name must unique in one SceneCollection resource
65              */
66             Scene::Ptr addNewScene(const std::string& sceneName);
67
68             /**
69              * Gets all Scene instances from SceneCollection resource
70              *
71              * @return A unordered_map of shared pointers of Scene instances with a Scene's name
72              */
73             std::unordered_map< std::string, Scene::Ptr > getScenes() const;
74
75             /**
76              * Gets a Scene instance with a specific Scene's name.
77              *
78              * @param sceneName             A Scene's name
79              *
80              * @return A shared pointer of Scene instance
81              *
82              * @throws RCSInvalidParameterException
83              * if Scene's name does not exist in SceneCollection resource
84              */
85             Scene::Ptr getScene(const std::string& sceneName) const;
86
87             /**
88              * Sets a name attribute of SceneCollection resource
89              *
90              * @param name               A SceneCollection resource's name
91              */
92             void setName(const std::string& name);
93
94             /**
95              * Gets a name attribute from SceneCollection resource.
96              *
97              * @return A SceneCollection resource's name
98              */
99             std::string getName() const;
100
101             /**
102              * Gets a Id attribute of SceneCollection resource.
103              *
104              * @return A SceneCollection resource's Id
105              *
106              */
107             std::string getId() const;
108
109         private:
110             std::shared_ptr< SceneCollectionResource > m_sceneCollectionResource;
111
112         };
113     } /* namespace Service */
114 } /* namespace OIC */
115
116 #endif /* SM_SCENECOLLECTION_H_ */
117