tracy/server/TracyUserData.hpp

50 lines
1.0 KiB
C++
Raw Normal View History

2019-07-26 21:05:24 +00:00
#ifndef __TRACYUSERDATA_HPP__
#define __TRACYUSERDATA_HPP__
2019-10-13 14:29:24 +00:00
#include <memory>
2019-07-26 21:05:24 +00:00
#include <stdint.h>
2019-08-28 17:28:31 +00:00
#include <stdio.h>
2019-07-26 21:05:24 +00:00
#include <string>
2019-10-13 14:29:24 +00:00
#include <vector>
2019-07-26 21:05:24 +00:00
namespace tracy
{
2019-10-13 14:29:24 +00:00
struct Annotation;
2019-08-28 17:45:22 +00:00
struct ViewData;
2019-07-26 21:05:24 +00:00
class UserData
{
public:
UserData();
UserData( const char* program, uint64_t time );
bool Valid() const { return !m_program.empty(); }
void Init( const char* program, uint64_t time );
const std::string& GetDescription() const { return m_description; }
bool SetDescription( const char* description );
2019-08-28 17:45:22 +00:00
void LoadState( ViewData& data );
void SaveState( const ViewData& data );
void StateShouldBePreserved();
2019-10-13 14:29:24 +00:00
void LoadAnnotations( std::vector<std::unique_ptr<Annotation>>& data );
void SaveAnnotations( const std::vector<std::unique_ptr<Annotation>>& data );
2019-07-26 21:05:24 +00:00
private:
2019-08-28 17:28:31 +00:00
FILE* OpenFile( const char* filename, bool write );
2019-10-13 14:29:02 +00:00
void Remove( const char* filename );
2019-08-28 17:28:31 +00:00
2019-07-26 21:05:24 +00:00
std::string m_program;
uint64_t m_time;
std::string m_description;
bool m_preserveState;
2019-07-26 21:05:24 +00:00
};
}
#endif