| //+------------------------------------------------------------------+
|
| //| RegService.mqh |
|
| //| Copyright 2026, Niquel Mendoza |
|
| //| https://www.mql5.com |
|
| //+------------------------------------------------------------------+
|
| #property copyright "Copyright 2026, Niquel Mendoza"
|
| #property link "https://www.mql5.com"
|
| #property strict
|
|
|
| #ifndef MQLARTICLES_UTILS_REGSERVISE_MQH
|
| #define MQLARTICLES_UTILS_REGSERVISE_MQH
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| #include <TSN/GCol/GenericHashes.mqh>
|
| #include <TSN/GCol/HashMap.mqh>
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| namespace TSN
|
| {
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| template <typename TObject>
|
| class CRegService
|
| {
|
| public:
|
| CRegService(void) {}
|
| ~CRegService(void) {}
|
| //---
|
| static CHashMapFastP(ulong, TObject*, _fibbo) s_values;
|
| static TObject* s_current_value;
|
|
|
| //---
|
| static bool SelectCurrentInstance(const ulong id)
|
| {
|
| if(!s_values.ContainsKey(id))
|
| return false;
|
| s_current_value = s_values.m_table[s_values.m_last_pos_tbl].value;
|
| return true;
|
| }
|
| };
|
| //---
|
| template <typename TObject> CHashMapFastP(ulong, TObject*, _fibbo) CRegService::s_values;
|
| template <typename TObject> TObject* CRegService::s_current_value = NULL;
|
| }
|
| //+------------------------------------------------------------------+
|
| #endif // MQLARTICLES_UTILS_REGSERVISE_MQH
|
| //+------------------------------------------------------------------+
|