[2.2.1] Apply reviewed header file (Base to Collection)
[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. To get the information, you must provide the <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">RuntimeInfo key</a>.
46  *
47  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">Runtime Information</a>.
48  *
49  * The following example demonstrates how to use the %RuntimeInfo class.
50  * @code
51  * #include <FBase.h>
52  * #include <FSystem.h>
53  *
54  * using namespace Tizen::Base;
55  * using namespace Tizen::System;
56  *
57  * result
58  * MyClass::GetAllocatedMemory(void)
59  * {
60  *       result r = E_SUCCESS;
61  *
62  *       String key(L"http://tizen.org/runtime/memory.allocated");
63  *       long long allocatedMemory = 0;
64  *
65  *       r = RuntimeInfo::GetValue(key, allocatedMemory);
66  *       TryCatch(r == E_SUCCESS, , "MyRuntimeInfo: Failed to get value");
67  *
68  *       return E_SUCCESS;
69  *
70  *      CATCH:
71  *       return r;
72  * }
73  * @endcode
74  *
75  */
76
77 class _OSP_EXPORT_ RuntimeInfo
78         : public Tizen::Base::Object
79 {
80
81 public:
82         /**
83          * Gets the specific Tizen::Base::String type runtime information based on the specified
84          * 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 specific integer type runtime information based on the specified
99          * designators (key).
100          *
101          * @since       2.0
102          *
103          * @return      An error code
104          * @param[in]   key     The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information @n
105          * @if OSPCOMPAT
106          *                      The following key values are updated: @n
107          *                      - Since Tizen, refer <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">here</a>.
108          *                      - @b Deprecated All the key values provided prior to %Tizen are deprecated. For more detailed information, refer 
109          *                       <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info_deprecated.htm">here</a>.
110          * @endif
111          * @param[out]  value                   The integer type runtime information
112          * @exception   E_SUCCESS               The method is successful.
113          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
114          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
115          */
116         static result GetValue(const Tizen::Base::String& key, int& value);
117
118         /**
119          * Gets the specific @c long @c long type runtime information based on the specified
120          * designators (key).
121          *
122          * @since       2.0
123          *
124          * @return      An error code
125          * @param[in]   key     The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information @n
126          * @if OSPCOMPAT
127          *                      The following key values are updated: @n
128          *                      - Since Tizen, refer <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">here</a>.
129          *                      - @b Deprecated All the key values provided prior to %Tizen are deprecated. For more detailed information, refer 
130          *                       <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info_deprecated.htm">here</a>.
131          *                       @xmlonly <pcheck kind="value" since="1.0" deprecated="yes"> @endxmlonly MaxAllocatableMemory, AvailableVideoMemory @xmlonly </pcheck> @endxmlonly
132          * @endif
133          * @param[out]  value                   The @c long @c long type runtime information
134          * @exception   E_SUCCESS               The method is successful.
135          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
136          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
137         */
138         static result GetValue(const Tizen::Base::String& key, long long& value);
139
140         /**
141          * Gets the specific double type runtime information based on the specified
142          * designators (key).
143          *
144          * @since       2.0
145          *
146          * @return      An error code
147          * @param[in]   key     The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information
148          * @param[out]  value                   The @c double type runtime information
149          * @exception   E_SUCCESS               The method is successful.
150          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
151          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
152          */
153         static result GetValue(const Tizen::Base::String& key, double& value);
154
155         /**
156          * Gets the specific @c bool type runtime information based on the specified
157          * designators (key).
158          *
159          * @since       2.0
160          *
161          * @return      An error code
162          * @param[in]   key     The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information
163          * @param[out]  value                   The @c bool type runtime information
164          * @exception   E_SUCCESS               The method is successful.
165          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
166          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
167          */
168         static result GetValue(const Tizen::Base::String& key, bool& value);
169
170         /**
171          * Gets the specific UuId type runtime information based on the specified
172          * designators (key).
173          *
174          * @since       2.0
175          *
176          * @return      An error code
177          * @param[in]   key     The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information
178          * @param[out]  value                   The UuId type runtime information
179          * @exception   E_SUCCESS               The method is successful.
180          * @exception   E_OBJ_NOT_FOUND         The specified @c key is not found.
181          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
182          */
183         static result GetValue(const Tizen::Base::String& key, Tizen::Base::UuId& value);
184
185         /**
186          * Gets the specific @c long @c long type runtime information based on specified designators (key) asynchronously.
187          *
188          * @since       2.0
189          *
190          * @return      An error code
191          * @param[in]   key     The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information
192          * @param[in]   listener        The result listener
193          * @exception   E_SUCCESS       The method is successful.
194          * @exception   E_OBJ_NOT_FOUND The specified @c key is not found.
195          * @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
196          */
197         static result GetValueAsync(const Tizen::Base::String& key, IRuntimeInfoGetLonglongAsyncResultListener* listener);
198
199         /**
200          * Gets the specific @c int type runtime information based on specified designators (key) asynchronously.
201          *
202          * @since       2.0
203          *
204          * @return      An error code
205          * @param[in]   key     The <a href="../org.tizen.native.appprogramming/html/guide/system/runtime_info.htm">key name</a> of the runtime information
206          * @param[in]   listener        The result listener
207          * @exception   E_SUCCESS       The method is successful.
208          * @exception   E_OBJ_NOT_FOUND The specified @c key is not found.
209          * @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
210          */
211         static result GetValueAsync(const Tizen::Base::String& key, IRuntimeInfoGetIntAsyncResultListener* listener);
212
213 private:
214         /**
215          * 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.
216          */
217         RuntimeInfo(void);
218
219         /**
220          * This is the destructor for this class. This destructor overrides Tizen::Base::Object::~Object().
221          */
222         virtual ~RuntimeInfo(void);
223
224         /**
225          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
226          */
227         RuntimeInfo(const RuntimeInfo& value);
228
229         /**
230          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
231          */
232         RuntimeInfo& operator =(const RuntimeInfo& value);
233
234 private:
235         friend class _RuntimeInfoImpl;
236         class _RuntimeInfoImpl* __pRuntimeInfoImpl;
237 }; // RuntimeInfo
238
239 } } // Tizen::System
240
241 #endif // _FSYS_RUNTIME_INFO_H_