Enable build with iniparser v 3.1
[platform/framework/native/appfw.git] / inc / FBaseRtIRunnable.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                FBaseRtIRunnable.h
19  * @brief               This is the header file for the %IRunnable interface.
20  *
21  * This header file contains the declarations of the %IRunnable interface.
22  */
23 #ifndef _FBASE_RT_I_RUNNABLE_H_
24 #define _FBASE_RT_I_RUNNABLE_H_
25
26 #include <FBaseResult.h>
27 #include <FBaseObject.h>
28
29
30 namespace Tizen { namespace Base { namespace Runtime
31 {
32 /**
33  * @interface IRunnable
34  * @brief       This interface is the basic unit of a task. Also, it is the execution unit of
35  *          the thread. This interface must be inherited by the class whose instances are
36  *                  run on the thread.
37  *
38  * @since 2.0
39  *
40  * @remarks     Classes which inherit the %IRunnable interface must implement the Run() method.
41  *
42  * The %IRunnable interface is the basic unit of a task. Also, it is the execution unit of
43  * the thread. This interface must be inherited by the class whose instances are
44  * run on the thread.
45  * @n
46  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/thread_programming.htm">Thread Programming</a>.
47  *
48  * @see         Thread
49  *
50  * The following example demonstrates how to use the %IRunnable interface.
51  *
52  * @code
53  *
54  *              #include <FBase.h>
55  *
56  *      using namespace Tizen::Base;
57  *      using namespace Tizen::Base::Runtime;
58  *
59  *              class MyRun
60  *                      : public Tizen::Base::Object
61  *                      , public Tizen::Base::Runtime::IRunnable
62  *              {
63  *              public:
64  *                      Object* Run(void)
65  *                      {
66  *                              for (int i = 0; i < 10000; ++i)
67  *                              {
68  *                                      // ...
69  *                              }
70  *
71  *                              return null;
72  *                      }
73  *              }
74  *
75  * @endcode
76  *
77  *
78  *
79  */
80 class _OSP_EXPORT_ IRunnable
81 {
82 public:
83         /**
84          * This is the destructor for this class.
85          *
86          * @since 2.0
87          */
88         virtual ~IRunnable(void);
89
90         /**
91          * Runs the task. @n
92          * The %Run() method is an executable body of the task. In many cases, this method is called by the thread.
93          * Although this method can return the result of the execution, the returned value might be discarded
94          * by the executor of this task.
95          *
96          * @since 2.0
97          *
98          * @return      A pointer to the result of the task, @n
99          *                      else @c null if it fails
100          */
101         virtual Tizen::Base::Object* Run(void) = 0;
102 }; // IRunnable
103
104 } } } // Tizen::Base::Runtime
105
106 #endif // _FBASE_RT_I_RUNNABLE_H_