From 4ff4599d0350bfed94f78e073446af7b12442027 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Fri, 18 Apr 2008 00:01:20 +0200 Subject: [PATCH] Add a filter-by-from/to-chunk in ExitManager::List. --- src/DB/Managers/ExitManager.cpp | 18 ++++++++++++++++-- src/DB/Managers/ExitManager.h | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/DB/Managers/ExitManager.cpp b/src/DB/Managers/ExitManager.cpp index aa993d7..832541b 100644 --- a/src/DB/Managers/ExitManager.cpp +++ b/src/DB/Managers/ExitManager.cpp @@ -22,14 +22,28 @@ #include "Exit.h" #include "TableImpls.h" #include "FieldImpls.h" +#include "Chunk.h" using mud::ExitManager; using mud::Exit; using mud::ExitPtr; -std::vector ExitManager::List() -{ +std::vector ExitManager::List(mud::ChunkPtr from, mud::ChunkPtr to) +{ SelectionMaskPtr mask(new SelectionMask(GetTable())); + + if(from) + { + ValuePtr value(new FieldValue(db::TableImpls::Get()->EXITS->FKCHUNKSFROM, from->getID())); + mask->addField(value); + } + + if(to) + { + ValuePtr value(new FieldValue(db::TableImpls::Get()->EXITS->FKCHUNKSTO, from->getID())); + mask->addField(value); + } + return GetTable()->tableList(mask); } diff --git a/src/DB/Managers/ExitManager.h b/src/DB/Managers/ExitManager.h index 2d46a01..6a5b8af 100644 --- a/src/DB/Managers/ExitManager.h +++ b/src/DB/Managers/ExitManager.h @@ -28,7 +28,7 @@ namespace mud { public: TableImplPtr GetTable(); - std::vector List(); + std::vector List(mud::ChunkPtr from = mud::ChunkPtr(), mud::ChunkPtr to = mud::ChunkPtr()); KeysPtr Add(); mud::ExitPtr GetByKey(value_type id); -- 2.11.4.GIT