| 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 "CTaskEventCommunicator.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Scheduler { |
| 27 |
|
| 28 |
|
| 29 |
CTaskEventCommunicator::CTaskEventCommunicator(CEventHandler* eventHandler) : CEventCommunicator(eventHandler) { |
| 30 |
mPostedEventCount = 0; |
| 31 |
mTmpStoredMemoryPool = nullptr; |
| 32 |
} |
| 33 |
|
| 34 |
CTaskEventCommunicator::~CTaskEventCommunicator() { |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
CTaskEventCommunicator* CTaskEventCommunicator::postSendTaskProcessEvent(CTask* task, bool schedulerTask, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 39 |
CSendTaskProcessEvent* sendEvent = CEventAllocator<CSendTaskProcessEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 40 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 41 |
CSendTaskProcessEvent* newSendEvent = CEventAllocator<CSendTaskProcessEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 42 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 43 |
sendEvent = newSendEvent; |
| 44 |
} |
| 45 |
sendEvent->setSchedulingTask(schedulerTask); |
| 46 |
sendEvent->setTask(task); |
| 47 |
++mPostedEventCount; |
| 48 |
CEventCommunicator::postEvent(sendEvent); |
| 49 |
return this; |
| 50 |
} |
| 51 |
|
| 52 |
CTaskEventCommunicator* CTaskEventCommunicator::postSendTaskCompleteEvent(CTask* task, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 53 |
CSendTaskCompleteEvent* sendEvent = CEventAllocator<CSendTaskCompleteEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 54 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 55 |
CSendTaskCompleteEvent* newSendEvent = CEventAllocator<CSendTaskCompleteEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 56 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 57 |
sendEvent = newSendEvent; |
| 58 |
} |
| 59 |
sendEvent->setTask(task); |
| 60 |
++mPostedEventCount; |
| 61 |
CEventCommunicator::postEvent(sendEvent); |
| 62 |
return this; |
| 63 |
} |
| 64 |
|
| 65 |
CTaskEventCommunicator* CTaskEventCommunicator::postSendTaskScheduleEvent(CTask* task, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 66 |
CSendTaskScheduleEvent* sendEvent = CEventAllocator<CSendTaskScheduleEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 67 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 68 |
CSendTaskScheduleEvent* newSendEvent = CEventAllocator<CSendTaskScheduleEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 69 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 70 |
sendEvent = newSendEvent; |
| 71 |
} |
| 72 |
sendEvent->setTask(task); |
| 73 |
++mPostedEventCount; |
| 74 |
CEventCommunicator::postEvent(sendEvent); |
| 75 |
return this; |
| 76 |
} |
| 77 |
|
| 78 |
CTaskEventCommunicator* CTaskEventCommunicator::postRequestScheduleTaskEvent(CTaskSchedulerCommunicator* communicator, CTaskScheduleItem* taskScheduleItem, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 79 |
CRequestScheduleTaskEvent* sendEvent = CEventAllocator<CRequestScheduleTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 80 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 81 |
CRequestScheduleTaskEvent* newSendEvent = CEventAllocator<CRequestScheduleTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 82 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 83 |
sendEvent = newSendEvent; |
| 84 |
} |
| 85 |
sendEvent->setTaskScheduleItem(taskScheduleItem); |
| 86 |
sendEvent->setCommunicator(communicator); |
| 87 |
++mPostedEventCount; |
| 88 |
CEventCommunicator::postEvent(sendEvent); |
| 89 |
return this; |
| 90 |
} |
| 91 |
|
| 92 |
CTaskEventCommunicator* CTaskEventCommunicator::postResponseScheduleTaskEvent(CTaskSchedulerCommunicator* communicator, CTaskScheduleItem* taskScheduleItem, CTask* task, bool schedulerTask, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 93 |
CResponseScheduleTaskEvent* sendEvent = CEventAllocator<CResponseScheduleTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 94 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 95 |
CResponseScheduleTaskEvent* newSendEvent = CEventAllocator<CResponseScheduleTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 96 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 97 |
sendEvent = newSendEvent; |
| 98 |
} |
| 99 |
sendEvent->setTask(task); |
| 100 |
sendEvent->setTaskScheduleItem(taskScheduleItem); |
| 101 |
sendEvent->setCommunicator(communicator); |
| 102 |
sendEvent->setSchedulingTask(schedulerTask); |
| 103 |
++mPostedEventCount; |
| 104 |
CEventCommunicator::postEvent(sendEvent); |
| 105 |
return this; |
| 106 |
} |
| 107 |
|
| 108 |
CTaskEventCommunicator* CTaskEventCommunicator::postRequestProcessTaskEvent(CTaskSchedulerCommunicator* communicator, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 109 |
CRequestProcessTaskEvent* sendEvent = CEventAllocator<CRequestProcessTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 110 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 111 |
CRequestProcessTaskEvent* newSendEvent = CEventAllocator<CRequestProcessTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 112 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 113 |
sendEvent = newSendEvent; |
| 114 |
} |
| 115 |
sendEvent->setCommunicator(communicator); |
| 116 |
++mPostedEventCount; |
| 117 |
CEventCommunicator::postEvent(sendEvent); |
| 118 |
return this; |
| 119 |
} |
| 120 |
|
| 121 |
CTaskEventCommunicator* CTaskEventCommunicator::postCriticalScheduleTaskEvent(CTaskSchedulerCommunicator* communicator, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 122 |
CCriticalScheduleTaskEvent* sendEvent = CEventAllocator<CCriticalScheduleTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 123 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 124 |
CCriticalScheduleTaskEvent* newSendEvent = CEventAllocator<CCriticalScheduleTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 125 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 126 |
sendEvent = newSendEvent; |
| 127 |
} |
| 128 |
sendEvent->setCommunicator(communicator); |
| 129 |
++mPostedEventCount; |
| 130 |
CEventCommunicator::postEvent(sendEvent); |
| 131 |
return this; |
| 132 |
} |
| 133 |
|
| 134 |
CTaskEventCommunicator* CTaskEventCommunicator::postAdditionalAllocationTaskEvent(CTask* task, CMemoryPool* memoryPools, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 135 |
CTaskAdditionalAllocationEvent* sendEvent = CEventAllocator<CTaskAdditionalAllocationEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 136 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 137 |
CTaskAdditionalAllocationEvent* newSendEvent = CEventAllocator<CTaskAdditionalAllocationEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 138 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 139 |
sendEvent = newSendEvent; |
| 140 |
} |
| 141 |
sendEvent->setTask(task); |
| 142 |
sendEvent->setAdditionalAllocatedMemoryPools(memoryPools); |
| 143 |
++mPostedEventCount; |
| 144 |
CEventCommunicator::postEvent(sendEvent); |
| 145 |
return this; |
| 146 |
} |
| 147 |
|
| 148 |
CTaskEventCommunicator* CTaskEventCommunicator::postDistributeMemoryPoolsEvent(CMemoryPool* memoryPools, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 149 |
CDistributeMemoryPoolEvent* sendEvent = CEventAllocator<CDistributeMemoryPoolEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 150 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 151 |
CDistributeMemoryPoolEvent* newSendEvent = CEventAllocator<CDistributeMemoryPoolEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 152 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 153 |
sendEvent = newSendEvent; |
| 154 |
} |
| 155 |
sendEvent->setMemoryPools(memoryPools); |
| 156 |
++mPostedEventCount; |
| 157 |
CEventCommunicator::postEvent(sendEvent); |
| 158 |
return this; |
| 159 |
} |
| 160 |
|
| 161 |
CTaskEventCommunicator* CTaskEventCommunicator::postDistributeMemoryPoolsEvent(CMemoryPool* memoryPools) { |
| 162 |
if (memoryPools) { |
| 163 |
CMemoryPool* memoryPool = memoryPools; |
| 164 |
memoryPools = memoryPools->getNextMemoryPool(); |
| 165 |
memoryPool->resetMemoryBlockPointer(); |
| 166 |
bool eventPostable = true; |
| 167 |
CDistributeMemoryPoolEvent* sendEvent = CEventAllocator<CDistributeMemoryPoolEvent>::allocateAndConstructEvent(memoryPool); |
| 168 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 169 |
if (memoryPools) { |
| 170 |
CMemoryPool* newMemoryPool = memoryPools; |
| 171 |
newMemoryPool->resetMemoryBlockPointer(); |
| 172 |
memoryPools = memoryPools->getNextMemoryPool(); |
| 173 |
CDistributeMemoryPoolEvent* newSendEvent = CEventAllocator<CDistributeMemoryPoolEvent>::allocateAndConstructEvent(newMemoryPool); |
| 174 |
memoryPools = memoryPool->setNext(memoryPools); |
| 175 |
sendEvent = newSendEvent; |
| 176 |
} else { |
| 177 |
mTmpStoredMemoryPool = memoryPool; |
| 178 |
eventPostable = false; |
| 179 |
} |
| 180 |
} |
| 181 |
if (eventPostable) { |
| 182 |
if (mTmpStoredMemoryPool) { |
| 183 |
memoryPools = mTmpStoredMemoryPool->setNextMemoryPool(memoryPools); |
| 184 |
} |
| 185 |
sendEvent->setMemoryPools(memoryPools); |
| 186 |
++mPostedEventCount; |
| 187 |
CEventCommunicator::postEvent(sendEvent); |
| 188 |
} |
| 189 |
} |
| 190 |
return this; |
| 191 |
} |
| 192 |
|
| 193 |
CTaskEventCommunicator* CTaskEventCommunicator::postTaskDispenseNotificationEvent(CTaskSchedulerCommunicator* communicator, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 194 |
CTaskDispenseNotificationEvent* sendEvent = CEventAllocator<CTaskDispenseNotificationEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 195 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 196 |
CTaskDispenseNotificationEvent* newSendEvent = CEventAllocator<CTaskDispenseNotificationEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 197 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 198 |
sendEvent = newSendEvent; |
| 199 |
} |
| 200 |
sendEvent->setCommunicator(communicator); |
| 201 |
++mPostedEventCount; |
| 202 |
CEventCommunicator::postEvent(sendEvent); |
| 203 |
return this; |
| 204 |
} |
| 205 |
|
| 206 |
CTaskEventCommunicator* CTaskEventCommunicator::postUpdateTaskStatusEvent(CTask* parentTask, CTask* updateTask, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 207 |
CUpdateTaskStatusEvent* sendEvent = CEventAllocator<CUpdateTaskStatusEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 208 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 209 |
CUpdateTaskStatusEvent* newSendEvent = CEventAllocator<CUpdateTaskStatusEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 210 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 211 |
sendEvent = newSendEvent; |
| 212 |
} |
| 213 |
sendEvent->setParentTask(parentTask); |
| 214 |
sendEvent->setUpdateTask(updateTask); |
| 215 |
++mPostedEventCount; |
| 216 |
CEventCommunicator::postEvent(sendEvent); |
| 217 |
return this; |
| 218 |
} |
| 219 |
|
| 220 |
CTaskEventCommunicator* CTaskEventCommunicator::postAlignedUpdateTaskStatusEvent(CTask* updateTask, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 221 |
CAlignedUpdateTaskStatusEvent* sendEvent = CEventAllocator<CAlignedUpdateTaskStatusEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 222 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 223 |
CAlignedUpdateTaskStatusEvent* newSendEvent = CEventAllocator<CAlignedUpdateTaskStatusEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 224 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 225 |
sendEvent = newSendEvent; |
| 226 |
} |
| 227 |
sendEvent->setUpdateTask(updateTask); |
| 228 |
++mPostedEventCount; |
| 229 |
CEventCommunicator::postEvent(sendEvent); |
| 230 |
return this; |
| 231 |
} |
| 232 |
|
| 233 |
CTaskEventCommunicator* CTaskEventCommunicator::postTaskStatusUpdatedEvent(CTask* parentTask, CTask* updatedTask, bool updateSuccess, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 234 |
CTaskStatusUpdatedEvent* sendEvent = CEventAllocator<CTaskStatusUpdatedEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 235 |
if (!CEventCommunicator::checkPostEvent(sendEvent)) { |
| 236 |
CTaskStatusUpdatedEvent* newSendEvent = CEventAllocator<CTaskStatusUpdatedEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 237 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 238 |
sendEvent = newSendEvent; |
| 239 |
} |
| 240 |
sendEvent->setParentTask(parentTask); |
| 241 |
sendEvent->setUpdatedTask(updatedTask); |
| 242 |
sendEvent->setUpdateSuccess(updateSuccess); |
| 243 |
++mPostedEventCount; |
| 244 |
CEventCommunicator::postEvent(sendEvent); |
| 245 |
return this; |
| 246 |
} |
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
bool CTaskEventCommunicator::postSendTaskProcessEvent(CEventHandler* eventHandler, CTask* task, bool schedulerTask, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 257 |
CSendTaskProcessEvent* sendEvent = CEventAllocator<CSendTaskProcessEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 258 |
if (!CEventCommunicator::checkPostEvent(eventHandler,sendEvent)) { |
| 259 |
CSendTaskProcessEvent* newSendEvent = CEventAllocator<CSendTaskProcessEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 260 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 261 |
sendEvent = newSendEvent; |
| 262 |
} |
| 263 |
sendEvent->setTask(task); |
| 264 |
sendEvent->setSchedulingTask(schedulerTask); |
| 265 |
CEventCommunicator::postEvent(eventHandler,sendEvent); |
| 266 |
return true; |
| 267 |
} |
| 268 |
|
| 269 |
bool CTaskEventCommunicator::postSendTaskCompleteEvent(CEventHandler* eventHandler, CTask* task, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 270 |
CSendTaskCompleteEvent* sendEvent = CEventAllocator<CSendTaskCompleteEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 271 |
if (!CEventCommunicator::checkPostEvent(eventHandler,sendEvent)) { |
| 272 |
CSendTaskCompleteEvent* newSendEvent = CEventAllocator<CSendTaskCompleteEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 273 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 274 |
sendEvent = newSendEvent; |
| 275 |
} |
| 276 |
sendEvent->setTask(task); |
| 277 |
CEventCommunicator::postEvent(eventHandler,sendEvent); |
| 278 |
return true; |
| 279 |
} |
| 280 |
|
| 281 |
bool CTaskEventCommunicator::postSendTaskScheduleEvent(CEventHandler* eventHandler, CTask* task, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 282 |
CSendTaskScheduleEvent* sendEvent = CEventAllocator<CSendTaskScheduleEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 283 |
if (!CEventCommunicator::checkPostEvent(eventHandler,sendEvent)) { |
| 284 |
CSendTaskScheduleEvent* newSendEvent = CEventAllocator<CSendTaskScheduleEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 285 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 286 |
sendEvent = newSendEvent; |
| 287 |
} |
| 288 |
sendEvent->setTask(task); |
| 289 |
CEventCommunicator::postEvent(eventHandler,sendEvent); |
| 290 |
return true; |
| 291 |
} |
| 292 |
|
| 293 |
bool CTaskEventCommunicator::postRequestScheduleTaskEvent(CEventHandler* eventHandler, CTaskSchedulerCommunicator* communicator, CTaskScheduleItem* taskScheduleItem, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 294 |
CRequestScheduleTaskEvent* sendEvent = CEventAllocator<CRequestScheduleTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 295 |
if (!CEventCommunicator::checkPostEvent(eventHandler,sendEvent)) { |
| 296 |
CRequestScheduleTaskEvent* newSendEvent = CEventAllocator<CRequestScheduleTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 297 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 298 |
sendEvent = newSendEvent; |
| 299 |
} |
| 300 |
sendEvent->setTaskScheduleItem(taskScheduleItem); |
| 301 |
sendEvent->setCommunicator(communicator); |
| 302 |
CEventCommunicator::postEvent(eventHandler,sendEvent); |
| 303 |
return true; |
| 304 |
} |
| 305 |
|
| 306 |
bool CTaskEventCommunicator::postResponseScheduleTaskEvent(CEventHandler* eventHandler, CTaskSchedulerCommunicator* communicator, CTaskScheduleItem* taskScheduleItem, CTask* task, bool schedulerTask, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 307 |
CResponseScheduleTaskEvent* sendEvent = CEventAllocator<CResponseScheduleTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 308 |
if (!CEventCommunicator::checkPostEvent(eventHandler,sendEvent)) { |
| 309 |
CResponseScheduleTaskEvent* newSendEvent = CEventAllocator<CResponseScheduleTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 310 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 311 |
sendEvent = newSendEvent; |
| 312 |
} |
| 313 |
sendEvent->setTask(task); |
| 314 |
sendEvent->setTaskScheduleItem(taskScheduleItem); |
| 315 |
sendEvent->setCommunicator(communicator); |
| 316 |
sendEvent->setSchedulingTask(schedulerTask); |
| 317 |
CEventCommunicator::postEvent(eventHandler,sendEvent); |
| 318 |
return true; |
| 319 |
} |
| 320 |
|
| 321 |
bool CTaskEventCommunicator::postRequestProcessTaskEvent(CEventHandler* eventHandler, CTaskSchedulerCommunicator* communicator, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 322 |
CRequestProcessTaskEvent* sendEvent = CEventAllocator<CRequestProcessTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 323 |
if (!CEventCommunicator::checkPostEvent(eventHandler,sendEvent)) { |
| 324 |
CRequestProcessTaskEvent* newSendEvent = CEventAllocator<CRequestProcessTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 325 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 326 |
sendEvent = newSendEvent; |
| 327 |
} |
| 328 |
sendEvent->setCommunicator(communicator); |
| 329 |
CEventCommunicator::postEvent(eventHandler,sendEvent); |
| 330 |
return true; |
| 331 |
} |
| 332 |
|
| 333 |
bool CTaskEventCommunicator::postCriticalScheduleTaskEvent(CEventHandler* eventHandler, CTaskSchedulerCommunicator* communicator, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 334 |
CCriticalScheduleTaskEvent* sendEvent = CEventAllocator<CCriticalScheduleTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 335 |
if (!CEventCommunicator::checkPostEvent(eventHandler,sendEvent)) { |
| 336 |
CCriticalScheduleTaskEvent* newSendEvent = CEventAllocator<CCriticalScheduleTaskEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 337 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 338 |
sendEvent = newSendEvent; |
| 339 |
} |
| 340 |
sendEvent->setCommunicator(communicator); |
| 341 |
CEventCommunicator::postEvent(eventHandler,sendEvent); |
| 342 |
return true; |
| 343 |
} |
| 344 |
|
| 345 |
bool CTaskEventCommunicator::postAdditionalAllocationTaskEvent(CEventHandler* eventHandler, CTask* task, CMemoryPool* memoryPools, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 346 |
CTaskAdditionalAllocationEvent* sendEvent = CEventAllocator<CTaskAdditionalAllocationEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 347 |
if (!CEventCommunicator::checkPostEvent(eventHandler,sendEvent)) { |
| 348 |
CTaskAdditionalAllocationEvent* newSendEvent = CEventAllocator<CTaskAdditionalAllocationEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 349 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 350 |
sendEvent = newSendEvent; |
| 351 |
} |
| 352 |
sendEvent->setTask(task); |
| 353 |
sendEvent->setAdditionalAllocatedMemoryPools(memoryPools); |
| 354 |
CEventCommunicator::postEvent(eventHandler,sendEvent); |
| 355 |
return true; |
| 356 |
} |
| 357 |
|
| 358 |
bool CTaskEventCommunicator::postDistributeMemoryPoolsEvent(CEventHandler* eventHandler, CMemoryPool* memoryPools, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 359 |
CDistributeMemoryPoolEvent* sendEvent = CEventAllocator<CDistributeMemoryPoolEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 360 |
if (!CEventCommunicator::checkPostEvent(eventHandler,sendEvent)) { |
| 361 |
CDistributeMemoryPoolEvent* newSendEvent = CEventAllocator<CDistributeMemoryPoolEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 362 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 363 |
sendEvent = newSendEvent; |
| 364 |
} |
| 365 |
sendEvent->setMemoryPools(memoryPools); |
| 366 |
CEventCommunicator::postEvent(eventHandler,sendEvent); |
| 367 |
return true; |
| 368 |
} |
| 369 |
|
| 370 |
|
| 371 |
bool CTaskEventCommunicator::postTaskDispenseNotificationEvent(CEventHandler* eventHandler, CTaskSchedulerCommunicator* communicator, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 372 |
CTaskDispenseNotificationEvent* sendEvent = CEventAllocator<CTaskDispenseNotificationEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 373 |
if (!CEventCommunicator::checkPostEvent(eventHandler,sendEvent)) { |
| 374 |
CTaskDispenseNotificationEvent* newSendEvent = CEventAllocator<CTaskDispenseNotificationEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 375 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 376 |
sendEvent = newSendEvent; |
| 377 |
} |
| 378 |
sendEvent->setCommunicator(communicator); |
| 379 |
CEventCommunicator::postEvent(eventHandler,sendEvent); |
| 380 |
return true; |
| 381 |
} |
| 382 |
|
| 383 |
|
| 384 |
bool CTaskEventCommunicator::postUpdateTaskStatusEvent(CEventHandler* eventHandler, CTask* parentTask, CTask* updateTask, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 385 |
CUpdateTaskStatusEvent* sendEvent = CEventAllocator<CUpdateTaskStatusEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 386 |
if (!CEventCommunicator::checkPostEvent(eventHandler,sendEvent)) { |
| 387 |
CUpdateTaskStatusEvent* newSendEvent = CEventAllocator<CUpdateTaskStatusEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 388 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 389 |
sendEvent = newSendEvent; |
| 390 |
} |
| 391 |
sendEvent->setParentTask(parentTask); |
| 392 |
sendEvent->setUpdateTask(updateTask); |
| 393 |
CEventCommunicator::postEvent(eventHandler,sendEvent); |
| 394 |
return true; |
| 395 |
} |
| 396 |
|
| 397 |
bool CTaskEventCommunicator::postAlignedUpdateTaskStatusEvent(CEventHandler* eventHandler, CTask* updateTask, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 398 |
CAlignedUpdateTaskStatusEvent* sendEvent = CEventAllocator<CAlignedUpdateTaskStatusEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 399 |
if (!CEventCommunicator::checkPostEvent(eventHandler,sendEvent)) { |
| 400 |
CAlignedUpdateTaskStatusEvent* newSendEvent = CEventAllocator<CAlignedUpdateTaskStatusEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 401 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 402 |
sendEvent = newSendEvent; |
| 403 |
} |
| 404 |
sendEvent->setUpdateTask(updateTask); |
| 405 |
CEventCommunicator::postEvent(eventHandler,sendEvent); |
| 406 |
return true; |
| 407 |
} |
| 408 |
|
| 409 |
bool CTaskEventCommunicator::postTaskStatusUpdatedEvent(CEventHandler* eventHandler, CTask* parentTask, CTask* updatedTask, bool updateSuccess, CMemoryTemporaryAllocationManager* memoryTmpAllocatorManager) { |
| 410 |
CTaskStatusUpdatedEvent* sendEvent = CEventAllocator<CTaskStatusUpdatedEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 411 |
if (!CEventCommunicator::checkPostEvent(eventHandler,sendEvent)) { |
| 412 |
CTaskStatusUpdatedEvent* newSendEvent = CEventAllocator<CTaskStatusUpdatedEvent>::allocateAndConstructEvent(memoryTmpAllocatorManager); |
| 413 |
memoryTmpAllocatorManager->releaseMemoryPoolContainer(sendEvent); |
| 414 |
sendEvent = newSendEvent; |
| 415 |
} |
| 416 |
sendEvent->setParentTask(parentTask); |
| 417 |
sendEvent->setUpdatedTask(updatedTask); |
| 418 |
sendEvent->setUpdateSuccess(updateSuccess); |
| 419 |
CEventCommunicator::postEvent(eventHandler,sendEvent); |
| 420 |
return true; |
| 421 |
} |
| 422 |
|
| 423 |
}; // end namespace Scheduler |
| 424 |
|
| 425 |
}; // end namespace Konclude |
| 426 |
|