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