v1 using observer pattern

This commit is contained in:
2026-01-11 23:10:47 +00:00
parent 792dab6211
commit 98e3237d37
11 changed files with 207 additions and 2 deletions
@@ -0,0 +1,20 @@
#pragma once
#include <string>
#include <unordered_map>
#include "core/subscribable.hpp"
using ProductCount = int;
using ProductId = std::string;
// inventory manager is not generic ( works with the specific types ProductId
// and ProductCount ) but the subscribable is generic
class InventoryManager : public Subscribable<ProductId, ProductCount> {
private:
std::unordered_map<ProductId, int> inventory_;
public:
void setInventory(const ProductId& productId, ProductCount quantity);
};