26 if (LHSStart < RHSStart) {
27 return (RHSStart < LHSEnd) && (LHSEnd <= RHSEnd);
29 return (LHSStart < RHSEnd) && (RHSEnd <= LHSEnd);
34 return Cmd->
getType() == Command::EMPTY_TASK &&
41 std::remove(MGenericCommands.begin(), MGenericCommands.end(), Cmd);
42 size_t RemovedCount = std::distance(NewEnd, MGenericCommands.end());
43 MGenericCommands.erase(NewEnd, MGenericCommands.end());
49 return eraseHostAccessorCommand(
static_cast<EmptyCommand *
>(Cmd));
57 addHostAccessorCommand(
static_cast<EmptyCommand *
>(Cmd), ToEnqueue);
59 Result = addGenericCommand(Cmd, ToEnqueue);
64 std::vector<LeavesCollection::value_type> LeavesCollection::toVector()
const {
65 std::vector<value_type> Result;
66 Result.reserve(MGenericCommands.size() + MHostAccessorCommands.size());
68 Result.insert(Result.end(), MGenericCommands.begin(), MGenericCommands.end());
71 Result.push_back(Cmd);
76 bool LeavesCollection::addHostAccessorCommand(
EmptyCommand *Cmd,
77 EnqueueListT &ToEnqueue) {
80 HostAccessorCommandSingleXRefT OldCmdIt;
85 OldCmdIt = MHostAccessorCommands.end();
87 OldCmdIt = std::find_if(
88 MHostAccessorCommands.begin(), MHostAccessorCommands.end(),
90 return doOverlap(Test->getRequirement(), Cmd->getRequirement());
94 if (OldCmdIt != MHostAccessorCommands.end() && *OldCmdIt == Cmd)
100 if (OldCmdIt != MHostAccessorCommands.end()) {
102 MAllocateDependency(Cmd, *OldCmdIt, MRecord, ToEnqueue);
105 eraseHostAccessorCommand(
static_cast<EmptyCommand *
>(*OldCmdIt));
110 insertHostAccessorCommand(Cmd);
114 bool LeavesCollection::addGenericCommand(Command *Cmd,
115 EnqueueListT &ToEnqueue) {
116 if (MGenericCommands.full()) {
117 Command *OldLeaf = MGenericCommands.front();
123 MAllocateDependency(Cmd, OldLeaf, MRecord, ToEnqueue);
126 MGenericCommands.push_back(Cmd);
131 void LeavesCollection::insertHostAccessorCommand(EmptyCommand *Cmd) {
132 MHostAccessorCommandsXRef[Cmd] =
133 MHostAccessorCommands.insert(MHostAccessorCommands.end(), Cmd);
136 size_t LeavesCollection::eraseHostAccessorCommand(EmptyCommand *Cmd) {
137 auto XRefIt = MHostAccessorCommandsXRef.find(Cmd);
139 if (XRefIt == MHostAccessorCommandsXRef.end())
142 MHostAccessorCommands.erase(XRefIt->second);
143 MHostAccessorCommandsXRef.erase(XRefIt);