merge with master
[platform/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 class TaskList :
31     public Task
32 {
33   private:
34     typedef std::list<Task *> Tasks;
35
36     Tasks m_tasks;
37     Tasks::iterator m_currentTask;
38     bool m_switched;
39
40     bool m_running;
41
42   protected:
43     void AddTask(Task *task);
44     void SwitchToTask(Task *task);
45
46   public:
47     TaskList();
48     virtual ~TaskList();
49
50     bool NextStep();
51     bool Abort();
52     size_t GetTaskCount() const;
53     size_t GetStepCount() const;
54 };
55 } // namespace DPL
56
57 #endif // DPL_TASK_LIST_H