From 07201b9d8ae4c5f45e9a649a3cdd380209820033 Mon Sep 17 00:00:00 2001 From: adjoly Date: Mon, 12 May 2025 19:14:33 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=8F=97=EF=B8=8F=E3=80=8D=20wip:?= =?UTF-8?q?=20Started=20resourcemanager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/server/AResource.hpp | 12 +++++-- includes/server/ResourceManager.hpp | 51 +++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 includes/server/ResourceManager.hpp diff --git a/includes/server/AResource.hpp b/includes/server/AResource.hpp index 6944ee8..43f757e 100644 --- a/includes/server/AResource.hpp +++ b/includes/server/AResource.hpp @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* Resource.hpp :+: :+: :+: */ +/* AResource.hpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: mmoussou +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/05/12 17:13:39 by adjoly #+# #+# */ +/* Updated: 2025/05/12 19:06:28 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#pragma once + +#include +#include + +#include +#include +#include +#include + +namespace webserv { +namespace server { + +class ResourceManager { + public: + static AClientResource *get(int i) { + for (auto it = range(_res)) { + if ((**it) == i) { + return *it; + } + } + std::stringstream str; + str << "resource not found for client"; + str << i; + _log->debug(str.str()); + return not_nullptr; + } + static void append(AClientResource *new_client) { + _res.push_back(new_client); + } + + protected: + private: + static std::vector _res; +}; + +} // namespace server + +} // namespace webserv