1 : // Copyright 2015 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 :
15 : #ifndef SYZYGY_REFINERY_PROCESS_STATE_RECORD_TRAITS_H_
16 : #define SYZYGY_REFINERY_PROCESS_STATE_RECORD_TRAITS_H_
17 :
18 : #include "syzygy/refinery/process_state/refinery.pb.h"
19 :
20 m : namespace refinery {
21 :
22 m : enum class RecordId {
23 m : BYTES,
24 m : STACK,
25 m : STACK_FRAME,
26 m : TYPED_BLOCK,
27 m : MODULE,
28 m : HEAP_METADATA,
29 m : HEAP_ALLOCATION,
30 m : };
31 :
32 m : template <typename T>
33 m : class RecordTraits;
34 :
35 m : template<>
36 m : class RecordTraits<Bytes> {
37 m : public:
38 m : static const RecordId ID = RecordId::BYTES;
39 m : };
40 :
41 m : template<>
42 m : class RecordTraits<Stack> {
43 m : public:
44 m : static const RecordId ID = RecordId::STACK;
45 m : };
46 :
47 m : template<>
48 m : class RecordTraits<StackFrame> {
49 m : public:
50 m : static const RecordId ID = RecordId::STACK_FRAME;
51 m : };
52 :
53 m : template<>
54 m : class RecordTraits<TypedBlock> {
55 m : public:
56 m : static const RecordId ID = RecordId::TYPED_BLOCK;
57 m : };
58 :
59 m : template<>
60 m : class RecordTraits<Module> {
61 m : public:
62 m : static const RecordId ID = RecordId::MODULE;
63 m : };
64 :
65 m : template <>
66 m : class RecordTraits<HeapMetadata> {
67 m : public:
68 m : static const RecordId ID = RecordId::HEAP_METADATA;
69 m : };
70 :
71 m : template <>
72 m : class RecordTraits<HeapAllocation> {
73 m : public:
74 m : static const RecordId ID = RecordId::HEAP_ALLOCATION;
75 m : };
76 :
77 m : } // namespace refinery
78 :
79 : #endif // SYZYGY_REFINERY_PROCESS_STATE_RECORD_TRAITS_H_
|