Dependencies

- Supports new "depends" attribute.
- Supports "task <id> depends:1,2".
- Supports "task <id> depends:-1,-2".
- Supports id <--> uuid mapping in TDB.
This commit is contained in:
Paul Beckingham
2010-07-12 01:05:25 -04:00
parent c6f6d405e3
commit 7e5c0eb9a5
6 changed files with 127 additions and 1 deletions

View File

@@ -304,6 +304,10 @@ int TDB::loadPending (std::vector <Task>& tasks, Filter& filter)
task.id = mId++;
mPending.push_back (task);
// Maintain mapping for ease of link/dependency resolution.
mI2U[task.id] = task.get ("uuid");
mU2I[task.get ("uuid")] = task.id;
}
++line_number;
@@ -425,6 +429,8 @@ int TDB::loadCompleted (std::vector <Task>& tasks, Filter& filter)
void TDB::add (const Task& task)
{
mNew.push_back (task);
mI2U[task.id] = task.get ("uuid");
mU2I[task.get ("uuid")] = task.id;
}
////////////////////////////////////////////////////////////////////////////////
@@ -1425,6 +1431,26 @@ void TDB::merge (const std::string& mergeFile)
mods.clear();
}
////////////////////////////////////////////////////////////////////////////////
std::string TDB::uuid (int id) const
{
std::map <int, std::string>::const_iterator i;
if ((i = mI2U.find (id)) != mI2U.end ())
return i->second;
return "";
}
////////////////////////////////////////////////////////////////////////////////
int TDB::id (const std::string& uuid) const
{
std::map <std::string, int>::const_iterator i;
if ((i = mU2I.find (uuid)) != mU2I.end ())
return i->second;
return 0;
}
////////////////////////////////////////////////////////////////////////////////
FILE* TDB::openAndLock (const std::string& file)
{