/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file FileBucket.cpp14/// @author Pablo Alvarez Lopez15/// @date Nov 202516///17// class used for link Elements with their filenames18/****************************************************************************/1920#include "FileBucket.h"21#include "UtilExceptions.h"2223// ===========================================================================24// static members25// ===========================================================================2627const std::vector<FileBucket::Type> FileBucket::types = {28FileBucket::Type::SUMO_CONFIG,29FileBucket::Type::NETEDIT_CONFIG,30FileBucket::Type::NETCONVERT_CONFIG,31FileBucket::Type::NETWORK,32FileBucket::Type::EDGETYPE,33FileBucket::Type::TLS,34FileBucket::Type::DEMAND,35FileBucket::Type::MEANDATA,36FileBucket::Type::ADDITIONAL,37FileBucket::Type::DATA38};3940const std::vector<FileBucket::Type> FileBucket::prefixes = {41FileBucket::Type::NETEDIT_PREFIX,42FileBucket::Type::SUMO_PREFIX,43FileBucket::Type::NETCONVERT_PREFIX,44};4546// ===========================================================================47// member method definitions48// ===========================================================================4950FileBucket::FileBucket(FileBucket::Type type) :51myFileType(type),52myDefaultBucket(true) {53}545556FileBucket::FileBucket(FileBucket::Type type, const std::string filename) :57myFileType(type),58myFilename(filename),59myDefaultBucket(false) {60}616263FileBucket::~FileBucket() {}646566FileBucket::Type67FileBucket::getType() const {68return myFileType;69}707172const std::string&73FileBucket::getFilename() const {74return myFilename;75}767778void79FileBucket::setFilename(const std::string& filename) {80myFilename = filename;81}828384bool85FileBucket::isDefaultBucket() const {86return myDefaultBucket;87}888990void91FileBucket::addElement(const bool isTemplate) {92if (isTemplate) {93myNumTemplates++;94} else {95myNumElements++;96}97}9899100void101FileBucket::removeElement(const bool isTemplate) {102if (isTemplate) {103myNumTemplates--;104// check that number of elementes are not negative105if (myNumTemplates < 0) {106throw ProcessError("Number of element negative");107}108} else {109myNumElements--;110// check that number of elementes are not negative111if (myNumElements < 0) {112throw ProcessError("Number of templates negative");113}114}115}116117118void119FileBucket::addDefaultVType() {120myNumDefaultVTypes++;121}122123124void125FileBucket::removeDefaultVType() {126myNumDefaultVTypes--;127// check that number of elementes are not negative128if (myNumElements < 0) {129throw ProcessError("Number of defaultVTypes negative");130}131}132133134int135FileBucket::getNumElements() const {136return myNumElements;137}138139140bool141FileBucket::isEmpty() const {142return (myNumElements + myNumTemplates) == 0;143}144145/****************************************************************************/146147148