Codechange: strongly type LinkGraphID and LinkGraphJobID

This commit is contained in:
Rubidium 2025-01-31 21:43:40 +01:00 committed by rubidium42
parent 6c8915fdbc
commit c311e6e4a9
3 changed files with 8 additions and 6 deletions

View File

@ -24,7 +24,7 @@ class LinkGraph;
* Type of the pool for link graph components. Each station can be in at up to
* 32 link graphs. So we allow for plenty of them to be created.
*/
typedef Pool<LinkGraph, LinkGraphID, 32, 0xFFFF> LinkGraphPool;
using LinkGraphPool = Pool<LinkGraph, LinkGraphID, 32, LinkGraphID::End().base()>;
/** The actual pool with link graphs. */
extern LinkGraphPool _link_graph_pool;

View File

@ -10,11 +10,13 @@
#ifndef LINKGRAPH_TYPE_H
#define LINKGRAPH_TYPE_H
typedef uint16_t LinkGraphID;
static const LinkGraphID INVALID_LINK_GRAPH = UINT16_MAX;
#include "../core/pool_type.hpp"
typedef uint16_t LinkGraphJobID;
static const LinkGraphJobID INVALID_LINK_GRAPH_JOB = UINT16_MAX;
using LinkGraphID = PoolID<uint16_t, struct LinkGraphIDTag, 0xFFFF, 0xFFFF>;
static constexpr LinkGraphID INVALID_LINK_GRAPH = LinkGraphID::Invalid();
using LinkGraphJobID = PoolID<uint16_t, struct LinkGraphJobIDTag, 0xFFFF, 0xFFFF>;
static constexpr LinkGraphJobID INVALID_LINK_GRAPH_JOB = LinkGraphJobID::Invalid();
typedef uint16_t NodeID;
static const NodeID INVALID_NODE = UINT16_MAX;

View File

@ -19,7 +19,7 @@ class Path;
typedef std::list<Path *> PathList;
/** Type of the pool for link graph jobs. */
typedef Pool<LinkGraphJob, LinkGraphJobID, 32, 0xFFFF> LinkGraphJobPool;
using LinkGraphJobPool = Pool<LinkGraphJob, LinkGraphJobID, 32, LinkGraphJobID::End().base()>;
/** The actual pool with link graph jobs. */
extern LinkGraphJobPool _link_graph_job_pool;