mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 23:44:35 +00:00
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.
This commit is contained in:
parent
449dff0eca
commit
8034fce416
@ -1,8 +1,11 @@
|
||||
#ifndef __TRACYTIMELINECONTROLLER_HPP__
|
||||
#define __TRACYTIMELINECONTROLLER_HPP__
|
||||
|
||||
#include <vector>
|
||||
|
||||
#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<class T, class U>
|
||||
void AddItem( U* data )
|
||||
{
|
||||
auto it = m_itemMap.find( data );
|
||||
if( it == m_itemMap.end() ) it = m_itemMap.emplace( data, std::make_unique<T>( m_view, m_worker, data ) ).first;
|
||||
m_items.emplace_back( it->second.get() );
|
||||
}
|
||||
|
||||
float GetHeight() const { return m_height; }
|
||||
const unordered_flat_map<const void*, VisData>& GetVisData() const { return m_visData; }
|
||||
|
||||
@ -41,6 +52,9 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<TimelineItem*> m_items;
|
||||
unordered_flat_map<const void*, std::unique_ptr<TimelineItem>> m_itemMap;
|
||||
|
||||
unordered_flat_map<const void*, VisData> m_visData;
|
||||
|
||||
float m_height;
|
||||
|
Loading…
Reference in New Issue
Block a user