From 8034fce416482995ba34e2f16f0bc1d008ba396a Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 3 Sep 2022 16:41:17 +0200 Subject: [PATCH] Allow adding timeline items to TimelineController. TimelineItem class is basically an expansion of the previous VisData structure. After the transition process is finished the VisData map will be removed, as it will no longer have any function. --- server/TracyTimelineController.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/server/TracyTimelineController.hpp b/server/TracyTimelineController.hpp index 8298d5d4..e7bfe228 100644 --- a/server/TracyTimelineController.hpp +++ b/server/TracyTimelineController.hpp @@ -1,8 +1,11 @@ #ifndef __TRACYTIMELINECONTROLLER_HPP__ #define __TRACYTIMELINECONTROLLER_HPP__ +#include + #include "../public/common/TracyForceInline.hpp" #include "tracy_robin_hood.h" +#include "TracyTimelineItem.hpp" namespace tracy { @@ -24,6 +27,14 @@ public: void FirstFrameExpired(); void End( float offset ); + template + void AddItem( U* data ) + { + auto it = m_itemMap.find( data ); + if( it == m_itemMap.end() ) it = m_itemMap.emplace( data, std::make_unique( m_view, m_worker, data ) ).first; + m_items.emplace_back( it->second.get() ); + } + float GetHeight() const { return m_height; } const unordered_flat_map& GetVisData() const { return m_visData; } @@ -41,6 +52,9 @@ public: } private: + std::vector m_items; + unordered_flat_map> m_itemMap; + unordered_flat_map m_visData; float m_height;