Project

General

Profile

root / trunk / compiler / cppAst / ast / AstAnnotation.hpp @ 7

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 <deque>
28

    
29
namespace Ast {
30

    
31
class AstElement; // forward
32

    
33
enum class AstAnnotationEnum: std::uint8_t {
34
        mutation,  // one mutation
35
        list       // list of annotations
36
};
37

    
38
class AstAnnotation {
39
protected:
40
        const AstAnnotationEnum m_annotationType;
41

    
42
        AstAnnotation(AstAnnotationEnum annotationType):
43
                m_annotationType(annotationType)
44
        {}
45
public:
46
        virtual ~AstAnnotation(){}
47
        AstAnnotationEnum getAnnotationType() {return m_annotationType;}
48
};
49

    
50
class AstAnnotationList final: public AstAnnotation {
51
public:
52
        std::deque<AstAnnotation> m_annotationList;
53
        AstAnnotationList():
54
                AstAnnotation(AstAnnotationEnum::list),
55
                m_annotationList()
56
        {}
57
};
58

    
59

    
60
class MutationAnnotation final: public AstAnnotation {
61
public:
62
        const std::uint32_t m_mutationID;  // all mutation annotations with the same number form one mutant-AST
63
        const AstElement* m_replacement;   // replacement AST, NOT owned
64
        MutationAnnotation(std::uint32_t mutationID, AstElement* mutatedElement) :
65
                AstAnnotation(AstAnnotationEnum::mutation),
66
                m_mutationID (mutationID),
67
                m_replacement(mutatedElement)
68
        {}
69
};
70

    
71
} // namespace