Skip to content

Commit

Permalink
THE RETURN OF REMOVE
Browse files Browse the repository at this point in the history
# this commit sounds like film name, doesn't it?)
# this method unused in PlotArea but needed in DataManager
  • Loading branch information
UmbrellaLeaf5 committed Apr 14, 2024
1 parent 6a6e775 commit 5338bc5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
24 changes: 24 additions & 0 deletions data_tools/data_manager/data_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@

namespace data_tools {

void DataManager::Remove(gui::ObjectType obj_type, size_t index) {
switch (obj_type) {
case gui::ObjectType::Targets: {
targets_.erase(targets_.begin() + index);
break;
}

case gui::ObjectType::Hills: {
hills_.erase(hills_.begin() + index);
break;
}

case gui::ObjectType::TrappyCircles: {
tr_circles_.erase(tr_circles_.begin() + index);
break;
}

case gui::ObjectType::TrappyLines: {
tr_lines_.erase(tr_lines_.begin() + index);
break;
}
}
}

void DataManager::Clear() {
targets_.clear();
tr_circles_.clear();
Expand Down
7 changes: 7 additions & 0 deletions data_tools/data_manager/data_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ class DataManager {
public:
DataManager() = default;

/**
* @brief удаляет объект из менеджера по индексу
* @param obj_type: тип объекта
* @param index: индекс объекта в его векторе
*/
void Remove(gui::ObjectType obj_type, size_t index);

/// @brief очищает все вектора объектов
void Clear();

Expand Down

0 comments on commit 5338bc5

Please sign in to comment.