| 6555 | } |
| 6556 | |
| 6557 | bool cPopulation::LoadStructuredSystematicsGroup(cAvidaContext& ctx, const Systematics::RoleID& role, const cString& filename) |
| 6558 | { |
| 6559 | cInitFile input_file(filename, m_world->GetWorkingDir(), ctx.Driver().Feedback()); |
| 6560 | if (!input_file.WasOpened()) return false; |
| 6561 | |
| 6562 | |
| 6563 | Systematics::ManagerPtr classmgr = Systematics::Manager::Of(m_world->GetNewWorld()); |
| 6564 | Systematics::ArbiterPtr arbiter = classmgr->ArbiterForRole(role); |
| 6565 | |
| 6566 | for (int line_id = 0; line_id < input_file.GetNumLines(); line_id++) { |
| 6567 | cString cur_line = input_file.GetLine(line_id); |
| 6568 | |
| 6569 | // Setup the group for this line... |
| 6570 | Apto::SmartPtr<Apto::Map<Apto::String, Apto::String> > props = input_file.GetLineAsDict(line_id); |
| 6571 | Systematics::GroupPtr grp = arbiter->LegacyLoad(&props); |
| 6572 | |
| 6573 | // Process resident cell ids |
| 6574 | cString cellstr(props->Get("cells")); |
| 6575 | if (cellstr.GetSize()) { |
| 6576 | while (cellstr.GetSize()) { |
| 6577 | int cell_id = cellstr.Pop(',').AsInt(); |
| 6578 | if (cell_array[cell_id].IsOccupied()) { |
| 6579 | Systematics::UnitPtr unit(cell_array[cell_id].GetOrganism()); |
| 6580 | cell_array[cell_id].GetOrganism()->AddReference(); // creating new smart pointer to org, explicitly add reference |
| 6581 | unit->AddClassification(grp->ClassifyNewUnit(unit, Systematics::ConstGroupMembershipPtr(NULL))); |
| 6582 | } |
| 6583 | } |
| 6584 | } |
| 6585 | } |
| 6586 | |
| 6587 | return true; |
| 6588 | } |
| 6589 | |
| 6590 | bool cPopulation::SaveFlameData(const cString& filename) |
| 6591 | { |
no test coverage detected