Debian Codegraph @

Source/Scheduler/CTaskSchedulerCommunicator.cpp

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #include "CTaskSchedulerCommunicator.h"
22
23
24 namespace Konclude {
25
26 namespace Scheduler {
27
28
29 CTaskSchedulerCommunicator::CTaskSchedulerCommunicator(CTaskEventHandlerBasedScheduler* taskScheduler, CTaskEventHandlerBasedProcessor* taskProcessor) : mSchedulerTaskEventCommunicator(taskScheduler->getEventHandler()), mProcessorTaskEventCommunicator(taskProcessor->getEventHandler()) {
30 mTaskScheduler = taskScheduler;
31 mTaskProcessor = taskProcessor;
32 }
33
34 CTaskSchedulerCommunicator::~CTaskSchedulerCommunicator() {
35 }
36
37 CTaskSchedulerCommunicator* CTaskSchedulerCommunicator::communicateRequestScheduleTask(CTaskScheduleItem* taskScheduleItem, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) {
38 mProcessorTaskEventCommunicator.postRequestScheduleTaskEvent(this,taskScheduleItem,memoryTmpAllocatorManager);
39 return this;
40 }
41
42 CTaskSchedulerCommunicator* CTaskSchedulerCommunicator::communicateResponseScheduleTask(CTaskScheduleItem* taskScheduleItem, CTask* task, bool schedulingTask, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) {
43 mSchedulerTaskEventCommunicator.postResponseScheduleTaskEvent(this,taskScheduleItem,task,schedulingTask,memoryTmpAllocatorManager);
44 return this;
45 }
46
47 CTaskSchedulerCommunicator* CTaskSchedulerCommunicator::communicateCriticalScheduleTask(CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) {
48 mSchedulerTaskEventCommunicator.postCriticalScheduleTaskEvent(this,memoryTmpAllocatorManager);
49 return this;
50 }
51
52 CTaskSchedulerCommunicator* CTaskSchedulerCommunicator::communicateRequestProcessTask(CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) {
53 mSchedulerTaskEventCommunicator.postRequestProcessTaskEvent(this,memoryTmpAllocatorManager);
54 return this;
55 }
56
57 CTaskSchedulerCommunicator* CTaskSchedulerCommunicator::communicateTaskDispenseNotification(CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) {
58 mSchedulerTaskEventCommunicator.postTaskDispenseNotificationEvent(this,memoryTmpAllocatorManager);
59 return this;
60 }
61
62 CTaskSchedulerCommunicator* CTaskSchedulerCommunicator::communicateProcessTask(CTask* task, bool schedulingTask, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) {
63 mProcessorTaskEventCommunicator.postSendTaskProcessEvent(task,schedulingTask,memoryTmpAllocatorManager);
64 return this;
65 }
66
67 bool CTaskSchedulerCommunicator::requiresTaskDispenseNotification(cint64 &dispenseNotificationTag) {
68 return mTaskScheduler->requiresTaskDispenseNotification(dispenseNotificationTag);
69 }
70
71
72 bool CTaskSchedulerCommunicator::canDispenseProcessingTasks() {
73 return mTaskProcessor->canDispenseProcessingTasks();
74 }
75
76 bool CTaskSchedulerCommunicator::requiresProcessingTasks() {
77 return mTaskProcessor->requiresProcessingTasks();
78 }
79
80 bool CTaskSchedulerCommunicator::requiresSchedulingTasks() {
81 return mTaskProcessor->requiresSchedulingTasks();
82 }
83
84 cint64 CTaskSchedulerCommunicator::countDispensableProcessingTasks() {
85 return mTaskProcessor->countDispensableProcessingTasks();
86 }
87
88
89 cint64 CTaskSchedulerCommunicator::countScheduleableProcessingTasks() {
90 return mTaskProcessor->countScheduleableProcessingTasks();
91 }
92
93
94 CTaskSchedulerCommunicator* CTaskSchedulerCommunicator::communicateScheduleUpdateTaskStatus(CTask* parentTask, CTask* updateTask, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) {
95 mSchedulerTaskEventCommunicator.postUpdateTaskStatusEvent(parentTask,updateTask,memoryTmpAllocatorManager);
96 return this;
97 }
98
99 CTaskSchedulerCommunicator* CTaskSchedulerCommunicator::communicateUpdateTaskStatus(CTask* parentTask, CTask* updateTask, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) {
100 mProcessorTaskEventCommunicator.postUpdateTaskStatusEvent(parentTask,updateTask,memoryTmpAllocatorManager);
101 return this;
102 }
103
104 bool CTaskSchedulerCommunicator::hasTaskOwner(CTaskOwner* taskOwner) {
105 return taskOwner == mTaskProcessor;
106 }
107
108 cint64 CTaskSchedulerCommunicator::getRecievedTasks() {
109 return mTaskProcessor->getRecievedTasks();
110 }
111
112 }; // end namespace Scheduler
113
114 }; // end namespace Konclude
115