tizen beta release
[framework/web/wrt-commons.git] / modules / core / include / dpl / task_list.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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  * @file    task_list.h
18  * @author  Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
19  * @author  Radoslaw Wicik (r.wicik@samsung.com)
20  * @version 1.0
21  * @brief   Header file for task list
22  */
23 #ifndef DPL_TASK_LIST_H
24 #define DPL_TASK_LIST_H
25
26 #include <dpl/task.h>
27 #include <list>
28
29 namespace DPL
30 {
31 class TaskList
32     : public Task      
33 {
34 private:
35     typedef std::list<Task *> Tasks;
36
37     Tasks m_tasks;
38     Tasks::iterator m_currentTask;
39     bool m_switched;
40
41     bool m_running;
42
43 protected:
44     void AddTask(Task *task);
45     void SwitchToTask(Task *task);
46
47 public:
48     TaskList();
49     virtual ~TaskList();
50
51     bool NextStep();
52     bool Abort();
53     size_t GetTaskCount() const;
54     size_t GetStepCount() const;
55 };
56 } // namespace DPL
57
58 #endif // DPL_TASK_LIST_H