diff --git a/events/EventManager.cpp b/events/EventManager.cpp index 3988210fb..57bda13fb 100644 --- a/events/EventManager.cpp +++ b/events/EventManager.cpp @@ -4,20 +4,15 @@ #include "../ipc/MutexFactory.h" -const uint16_t EventManager::POOL_SIZES[N_POOLS] = { - sizeof(EventMatchTree::Node), sizeof(EventIdRangeMatcher), - sizeof(ReporterRangeMatcher) }; // If one checks registerListener calls, there are around 40 (to max 50) // objects registering for certain events. // Each listener requires 1 or 2 EventIdMatcher and 1 or 2 ReportRangeMatcher. // So a good guess is 75 to a max of 100 pools required for each, which fits well. -// SHOULDDO: Shouldn't this be in the config folder and passed via ctor? -const uint16_t EventManager::N_ELEMENTS[N_POOLS] = { 240, 120, 120 }; - +// This should be configurable.. const LocalPool::LocalPoolConfig EventManager::poolConfig = { - {sizeof(EventMatchTree::Node), 240}, - {sizeof(EventIdRangeMatcher), 120}, - {sizeof(ReporterRangeMatcher), 120} + {240, sizeof(EventMatchTree::Node)}, + {120, sizeof(EventIdRangeMatcher)}, + {120, sizeof(ReporterRangeMatcher)} }; EventManager::EventManager(object_id_t setObjectId) : diff --git a/storagemanager/LocalPool.cpp b/storagemanager/LocalPool.cpp index f61ef2b83..4a6f332c2 100644 --- a/storagemanager/LocalPool.cpp +++ b/storagemanager/LocalPool.cpp @@ -9,8 +9,8 @@ LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig poolConfig, spillsToHigherPools(spillsToHigherPools) { uint16_t index = 0; for (const auto& currentPoolConfig: poolConfig) { - this->elementSizes[index] = currentPoolConfig.first; - this->numberOfElements[index] = currentPoolConfig.second; + this->numberOfElements[index] = currentPoolConfig.first; + this->elementSizes[index] = currentPoolConfig.second; store[index] = std::vector( numberOfElements[index] * elementSizes[index]); sizeLists[index] = std::vector(numberOfElements[index]); diff --git a/storagemanager/LocalPool.h b/storagemanager/LocalPool.h index a3ccd3a39..494e2cbb7 100644 --- a/storagemanager/LocalPool.h +++ b/storagemanager/LocalPool.h @@ -33,7 +33,7 @@ public: using poolElementSize = size_type; using numberPoolElements = uint16_t; - using LocalPoolCfgPair = std::pair; + using LocalPoolCfgPair = std::pair; using LocalPoolConfig = std::multiset; /** * @brief This definition generally sets the number of different sized pools. @@ -44,7 +44,7 @@ public: * @brief This is the default constructor for a pool manager instance. * @details * The pool is configured by passing a set of pairs into the constructor. - * The first value of that pair determines the number of one element on + * The first value of that pair determines the number of one elements on * the respective page of the pool while the second value determines how * many elements with that size are created on that page. * All regions are to zero on start up. diff --git a/tmtcpacket/packetmatcher/PacketMatchTree.cpp b/tmtcpacket/packetmatcher/PacketMatchTree.cpp index 80ec67e68..ac72b3e77 100644 --- a/tmtcpacket/packetmatcher/PacketMatchTree.cpp +++ b/tmtcpacket/packetmatcher/PacketMatchTree.cpp @@ -3,17 +3,12 @@ #include "ServiceMatcher.h" #include "SubserviceMatcher.h" -const uint16_t PacketMatchTree::POOL_SIZES[N_POOLS] = { sizeof(ServiceMatcher), - sizeof(SubServiceMatcher), sizeof(ApidMatcher), - sizeof(PacketMatchTree::Node) }; -//Maximum number of types and subtypes to filter should be more than sufficient. -const uint16_t PacketMatchTree::N_ELEMENTS[N_POOLS] = { 10, 20, 2, 40 }; - +// This should be configurable.. const LocalPool::LocalPoolConfig PacketMatchTree::poolConfig = { - LocalPool::LocalPoolCfgPair(sizeof(ServiceMatcher), 10), - LocalPool::LocalPoolCfgPair(sizeof(SubServiceMatcher), 20), - LocalPool::LocalPoolCfgPair(sizeof(ApidMatcher), 2), - LocalPool::LocalPoolCfgPair(sizeof(PacketMatchTree::Node), 40) + {10, sizeof(ServiceMatcher)}, + {20, sizeof(SubServiceMatcher)}, + {2, sizeof(ApidMatcher)}, + {40, sizeof(PacketMatchTree::Node)} }; PacketMatchTree::PacketMatchTree(Node* root) :