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