Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
ConnectionCache.cpp
Go to the documentation of this file.
1/**
2 * @file ConnectionCache.cpp
3 * @brief Bezier control-point cache implementation (Phase 7).
4 * @author Olympe Engine
5 * @date 2026-03-10
6 */
7
8#include "ConnectionCache.h"
9
10#include <cstring>
11
12namespace Olympe {
13
14// ============================================================================
15// Singleton
16// ============================================================================
17
19{
20 static ConnectionCache s_Instance;
21 return s_Instance;
22}
23
24// ============================================================================
25// Construction
26// ============================================================================
27
32
33// ============================================================================
34// Cache operations
35// ============================================================================
36
38{
39 return m_Cache.find(connectionId) != m_Cache.end();
40}
41
43{
44 std::map<int, BezierPoints>::const_iterator it = m_Cache.find(connectionId);
45 if (it == m_Cache.end())
46 return m_DefaultBezier;
47 return it->second;
48}
49
54
59
61{
62 m_Cache.clear();
63}
64
66{
67 return m_Cache.size();
68}
69
70} // namespace Olympe
Bezier control-point cache for VS graph connections (Phase 7).
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
Singleton cache mapping connection IDs to Bezier control points.
std::map< int, BezierPoints > m_Cache
BezierPoints m_DefaultBezier
Returned when ID is not in cache.
bool HasCached(int connectionId) const
Returns true if Bezier points are stored for connectionId.
void SetBezier(int connectionId, const BezierPoints &pts)
Stores or overwrites the Bezier points for connectionId.
static ConnectionCache & Get()
Returns the single shared instance.
size_t GetCacheSize() const
Returns the number of entries currently in the cache.
void InvalidateAll()
Clears all cached entries.
void Invalidate(int connectionId)
Removes the cached entry for connectionId.
const BezierPoints & GetBezier(int connectionId) const
Returns the cached Bezier points for connectionId.
< Provides AssetID and INVALID_ASSET_ID
Four cubic Bezier control points (P0..P3).