ActionLabel.hh 1.11 KB
Newer Older
Philip Trettner's avatar
Philip Trettner committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once

#include <string>
#include <cstdint>
#include <vector>

#include "common/property.hh"

#include "ActionEntry.hh"

namespace aion
{
class ActionLabel
{
private:
    std::string mName;
    std::string mFile;
    int mLine;
    std::string mFunction;

    int32_t mIndex;

public:
Philip Trettner's avatar
Philip Trettner committed
24
    AION_GETTER(Index);
Philip Trettner's avatar
Philip Trettner committed
25

Philip Trettner's avatar
Philip Trettner committed
26
27
28
29
    AION_GETTER(Name);
    AION_GETTER(File);
    AION_GETTER(Line);
    AION_GETTER(Function);
Philip Trettner's avatar
Philip Trettner committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

    std::string shortDesc() const;

    std::string nameOrFunc() const;

public:
    ActionLabel(const char* file, int line, const char* function, const char* name);

    void startEntry();
    void endEntry();

    /// gets a COPY! of the vector of all labels (labels itself are not copied)
    static std::vector<ActionLabel*> getAllLabels();

    static int64_t getLastEntryIdx();
    /// inclusive
    static std::vector<ActionEntry> copyEntries(int64_t startIdx, int64_t endIdx);
    /// all threads
    static std::vector<ActionEntry> copyAllEntries();

private:
    ActionLabel(std::string const& name, std::string const& function, std::string const& file, int line, int idx);
52
    friend class ActionPackage;   
Philip Trettner's avatar
Philip Trettner committed
53
54
};
}