VirtualC64
v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
Inspectable.h
1
// -----------------------------------------------------------------------------
2
// This file is part of VirtualC64
3
//
4
// Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de
5
// This FILE is dual-licensed. You are free to choose between:
6
//
7
// - The GNU General Public License v3 (or any later version)
8
// - The Mozilla Public License v2
9
//
10
// SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0
11
// -----------------------------------------------------------------------------
12
13
#pragma once
14
15
#include "Dumpable.h"
16
#include <iostream>
17
18
namespace
vc64
{
19
20
struct
Void { };
21
31
template
<
typename
T1,
typename
T2 = Vo
id
>
32
class
Inspectable
{
33
34
protected
:
35
36
mutable
T1 info;
37
mutable
T2 stats;
38
39
public
:
40
41
Inspectable
() { }
42
virtual
~Inspectable
() =
default
;
43
44
T1 &getInfo()
const
{
45
46
cacheInfo(info);
47
return
info;
48
}
49
50
T1 &getCachedInfo()
const
{
51
52
return
info;
53
}
54
55
T2 &getStats()
const
{
56
57
cacheStats(stats);
58
return
stats;
59
}
60
61
T2 &getCachedStats()
const
{
62
63
return
stats;
64
}
65
66
virtual
void
clearStats() {
67
68
memset(&stats, 0,
sizeof
(stats));
69
}
70
71
virtual
void
record()
const
{
72
73
cacheInfo(info);
74
cacheStats(stats);
75
}
76
77
private
:
78
79
virtual
void
cacheInfo(T1 &result)
const
{ };
80
virtual
void
cacheStats(T2 &result)
const
{ };
81
};
82
83
}
vc64::Inspectable
Inspection interface.
Definition
Inspectable.h:32
vc64
VirtualC64 project namespace.
Definition
CmdQueue.cpp:16
Emulator
Base
Inspectable.h
Generated by
1.10.0