<commit_before>/*
 * UILayersCollection.cpp
 *
 * Copyright (C) 2019 MegaMol Team
 * Alle Rechte vorbehalten. All rights reserved.
 */

#include "UILayersCollection.hpp"
#include "vislib/sys/Log.h"

#define init bool ret = false; m_lastCapture = nullptr;
#define abort {m_lastCapture = uil; break;}

using namespace megamol::console;
using namespace megamol;
using namespace core::view;

std::shared_ptr<AbstractUILayer> UILayersCollection::lastEventCaptureUILayer() {
	return std::move(m_lastCapture);
}

void UILayersCollection::AddUILayer(std::shared_ptr<AbstractUILayer>& uiLayer) {
    auto it = std::find(m_uiLayers.begin(), m_uiLayers.end(), uiLayer);
    if (it != m_uiLayers.end()) {
        vislib::sys::Log::DefaultLog.WriteWarn("uiLayer already part of the collection");
        return;
    }
    m_uiLayers.push_back(uiLayer);
}
void UILayersCollection::RemoveUILayer(std::shared_ptr<AbstractUILayer>& uiLayer) {
    auto it = std::find(m_uiLayers.begin(), m_uiLayers.end(), uiLayer);
    if (it == m_uiLayers.end()) return;
    m_uiLayers.erase(it);
}
void UILayersCollection::ClearUILayers() {
	m_lastCapture = nullptr;
	m_uiLayers.clear();
}
<commit_msg>UILayersCollection: use stl algorithm header<commit_after>/*
 * UILayersCollection.cpp
 *
 * Copyright (C) 2019 MegaMol Team
 * Alle Rechte vorbehalten. All rights reserved.
 */

#include "UILayersCollection.hpp"
#include "vislib/sys/Log.h"

#include <algorithm>

#define init bool ret = false; m_lastCapture = nullptr;
#define abort {m_lastCapture = uil; break;}

using namespace megamol::console;
using namespace megamol;
using namespace core::view;

std::shared_ptr<AbstractUILayer> UILayersCollection::lastEventCaptureUILayer() {
	return std::move(m_lastCapture);
}

void UILayersCollection::AddUILayer(std::shared_ptr<AbstractUILayer>& uiLayer) {
    auto it = std::find(m_uiLayers.begin(), m_uiLayers.end(), uiLayer);
    if (it != m_uiLayers.end()) {
        vislib::sys::Log::DefaultLog.WriteWarn("uiLayer already part of the collection");
        return;
    }
    m_uiLayers.push_back(uiLayer);
}
void UILayersCollection::RemoveUILayer(std::shared_ptr<AbstractUILayer>& uiLayer) {
    auto it = std::find(m_uiLayers.begin(), m_uiLayers.end(), uiLayer);
    if (it == m_uiLayers.end()) return;
    m_uiLayers.erase(it);
}
void UILayersCollection::ClearUILayers() {
	m_lastCapture = nullptr;
	m_uiLayers.clear();
}

{'fraction_non_alphanumeric': 0.1345591307981613, 'fraction_numerical': 0.003343083994985374, 'mean_word_length': 5.576923076923077, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2471703', 'n_tokens_mistral': 870, 'n_tokens_neox': 832, 'n_words': 164}