Merge "Update deprecated libprivilege-control API functions." into tizen
[platform/framework/native/appfw.git] / inc / FSysRuntimeInfo.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file        FSysRuntimeInfo.h
19  * @brief       This is the header file for the %RuntimeInfo class.
20  *
21  * This header file contains the declarations of the %RuntimeInfo class.
22  */
23
24 #ifndef _FSYS_RUNTIME_INFO_H_
25 #define _FSYS_RUNTIME_INFO_H_
26
27 #include <FBaseString.h>
28 #include <FBaseUuId.h>
29 #include <FBaseColIList.h>
30
31 namespace Tizen { namespace System
32 {
33
34 class IRuntimeInfoGetIntAsyncResultListener;
35 class IRuntimeInfoGetLonglongAsyncResultListener;
36
37 /**
38  * @class       RuntimeInfo
39  * @brief       This class provides methods for getting runtime information.
40  *
41  * @since       2.0
42  *
43  * @final       This class is not intended for extension.
44  *
45  * The %RuntimeInfo class provides runtime information, such as the allocated memory used by the application storage, memory, and CPU utilization. 
46  * To get the information, you must provide the <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">RuntimeInfo key</a>.
47  *
48  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">Runtime Information</a>.
49  *
50  * The following example demonstrates how to use the %RuntimeInfo class.
51  * @code
52  * #include <FBase.h>
53  * #include <FSystem.h>
54  *
55  * using namespace Tizen::Base;
56  * using namespace Tizen::System;
57  *
58  * result
59  * MyClass::GetAllocatedMemory(void)
60  * {
61  *       result r = E_SUCCESS;
62  *
63  *       String key(L"http://tizen.org/runtime/memory.allocated");
64  *       long long allocatedMemory = 0;
65  *
66  *       r = RuntimeInfo::GetValue(key, allocatedMemory);
67  *       TryCatch(r == E_SUCCESS, , "MyRuntimeInfo: Failed to get value");
68  *
69  *       return E_SUCCESS;
70  *
71  *      CATCH:
72  *       return r;
73  * }
74  * @endcode
75  *
76  */
77
78 class _OSP_EXPORT_ RuntimeInfo
79         : public Tizen::Base::Object
80 {
81
82 public:
83         /**
84          * Gets the Tizen::Base::String type runtime information based on the specified designators (key).
85          *
86          * @since               2.0
87          *
88          * @return              An error code
89          * @param[in]   key             The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information
90          * @param[out]  value                           The runtime information of type Tizen::Base::String
91          * @exception   E_SUCCESS                       The method is successful.
92          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
93          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
94          */
95         static result GetValue(const Tizen::Base::String& key, Tizen::Base::String& value);
96
97         /**
98          * Gets the integer type runtime information based on the specified designators (key).
99          *
100          * @since               2.0
101          *
102          * @return              An error code
103          * @param[in]   key             The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information @n
104          * @if OSPCOMPAT
105          *                      The following key values are updated: @n
106          *                      - Since Tizen, refer <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">here</a>.
107          *                      - @b Deprecated All the key values provided prior to %Tizen are deprecated. For more detailed information, refer 
108          *                       <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info_deprecated.htm">here</a>.
109          * @endif
110          * @param[out]  value                           The integer type runtime information
111          * @exception   E_SUCCESS                       The method is successful.
112          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
113          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
114          */
115         static result GetValue(const Tizen::Base::String& key, int& value);
116
117         /**
118          * Gets the @c long @c long type runtime information based on the specified designators (key).
119          *
120          * @since               2.0
121          *
122          * @return              An error code
123          * @param[in]   key             The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information @n
124          * @if OSPCOMPAT
125          *                      The following key values are updated: @n
126          *                      - Since Tizen, refer <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">here</a>.
127          *                      - @b Deprecated All the key values provided prior to %Tizen are deprecated. For more detailed information, refer 
128          *                       <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info_deprecated.htm">here</a>.
129          *                       @xmlonly <pcheck kind="value" since="1.0" deprecated="yes"> @endxmlonly MaxAllocatableMemory, AvailableVideoMemory @xmlonly </pcheck> @endxmlonly
130          * @endif
131          * @param[out]  value                           The @c long @c long type runtime information
132          * @exception   E_SUCCESS                       The method is successful.
133          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
134          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
135         */
136         static result GetValue(const Tizen::Base::String& key, long long& value);
137
138         /**
139          * Gets the double type runtime information based on the specified designators (key).
140          *
141          * @since       2.0
142          *
143          * @return              An error code
144          * @param[in]   key             The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information
145          * @param[out]  value                           The @c double type runtime information
146          * @exception   E_SUCCESS                       The method is successful.
147          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
148          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
149          */
150         static result GetValue(const Tizen::Base::String& key, double& value);
151
152         /**
153          * Gets the @c bool type runtime information based on the specified designators (key).
154          *
155          * @since               2.0
156          *
157          * @return              An error code
158          * @param[in]   key             The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information
159          * @param[out]  value                           The @c bool type runtime information
160          * @exception   E_SUCCESS                       The method is successful.
161          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
162          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
163          */
164         static result GetValue(const Tizen::Base::String& key, bool& value);
165
166         /**
167          * Gets the UuId type runtime information based on the specified designators (key).
168          *
169          * @since               2.0
170          *
171          * @return              An error code
172          * @param[in]   key             The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information
173          * @param[out]  value                           The UuId type runtime information
174          * @exception   E_SUCCESS                       The method is successful.
175          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
176          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
177          */
178         static result GetValue(const Tizen::Base::String& key, Tizen::Base::UuId& value);
179
180         /**
181          * Gets the @c long @c long type runtime information based on specified designators (key) asynchronously.
182          *
183          * @since               2.0
184          *
185          * @return              An error code
186          * @param[in]   key             The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information
187          * @param[in]   listener                The result listener
188          * @exception   E_SUCCESS               The method is successful.
189          * @exception   E_OBJ_NOT_FOUND The specified @c key is not found.
190          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
191          */
192         static result GetValueAsync(const Tizen::Base::String& key, IRuntimeInfoGetLonglongAsyncResultListener* listener);
193
194         /**
195          * Gets the @c int type runtime information based on specified designators (key) asynchronously.
196          *
197          * @since               2.0
198          *
199          * @return              An error code
200          * @param[in]   key             The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information
201          * @param[in]   listener                The result listener
202          * @exception   E_SUCCESS               The method is successful.
203          * @exception   E_OBJ_NOT_FOUND The specified @c key is not found.
204          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
205          */
206         static result GetValueAsync(const Tizen::Base::String& key, IRuntimeInfoGetIntAsyncResultListener* listener);
207
208 private:
209         /**
210          * This is the default constructor for this class. This default constructor is intentionally declared as private so that only the platform can create an instance.
211          */
212         RuntimeInfo(void);
213
214         /**
215          * This is the destructor for this class. This destructor overrides Tizen::Base::Object::~Object().
216          */
217         virtual ~RuntimeInfo(void);
218
219         /**
220          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
221          */
222         RuntimeInfo(const RuntimeInfo& value);
223
224         /**
225          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
226          */
227         RuntimeInfo& operator =(const RuntimeInfo& value);
228
229 private:
230         friend class _RuntimeInfoImpl;
231         class _RuntimeInfoImpl* __pRuntimeInfoImpl;
232 }; // RuntimeInfo
233
234 } } // Tizen::System
235
236 #endif // _FSYS_RUNTIME_INFO_H_