root / trunk / compiler / cppAst / ast / serialize / ProtoBufAstTraversal.hpp @ 5
1 |
/**
|
---|---|
2 |
*
|
3 |
* OOAS Compiler - C++ AST
|
4 |
*
|
5 |
* Copyright 2015, AIT Austrian Institute of Technology.
|
6 |
* All rights reserved.
|
7 |
*
|
8 |
* SEE THE "LICENSE" FILE FOR THE TERMS UNDER WHICH THIS FILE IS PROVIDED.
|
9 |
*
|
10 |
* If you modify the file please update the list of contributors below to in-
|
11 |
* clude your name. Please also stick to the coding convention of using TABs
|
12 |
* to do the basic (block-level) indentation and spaces for anything after
|
13 |
* that. (Enable the display of special chars and it should be pretty obvious
|
14 |
* what this means.) Also, remove all trailing whitespace.
|
15 |
*
|
16 |
* Contributors:
|
17 |
* Willibald Krenn (AIT)
|
18 |
* Stephan Zimmerer (AIT)
|
19 |
* Christoph Czurda (AIT)
|
20 |
*
|
21 |
*/
|
22 |
|
23 |
|
24 |
|
25 |
#pragma once
|
26 |
|
27 |
#include <CallContext.hpp> |
28 |
#include <unordered_map> |
29 |
#include <ast/serialize/gen/Record.pb.h> |
30 |
#include <ast/serialize/gen/FunctionNames.pb.h> |
31 |
|
32 |
namespace Ast {
|
33 |
|
34 |
class ProtoBufAstTraversal { |
35 |
protected:
|
36 |
CallContext* m_context; |
37 |
std::unordered_map<std::uint64_t, void*> m_objects;
|
38 |
|
39 |
void allocate(const serialize::PBFunctionCall& call); |
40 |
void add(const serialize::PBFunctionCall& call); |
41 |
void identifier(const serialize::PBFunctionCall& call); |
42 |
void type(const serialize::PBFunctionCall& call); |
43 |
void statement(const serialize::PBFunctionCall& call); |
44 |
void expression(const serialize::PBFunctionCall& call); |
45 |
|
46 |
void* doDeserialize(serialize::PBAstTraversal & traversal);
|
47 |
|
48 |
public:
|
49 |
ProtoBufAstTraversal(CallContext* context); |
50 |
~ProtoBufAstTraversal(); |
51 |
|
52 |
void* deserialize();
|
53 |
void* deserialize(const std::uint8_t * buffer, std::uint32_t size); |
54 |
}; |
55 |
|
56 |
} |