Project

General

Profile

/**
*
* OOAS Compiler - C++ AST
*
* Copyright 2015, AIT Austrian Institute of Technology.
* All rights reserved.
*
* SEE THE "LICENSE" FILE FOR THE TERMS UNDER WHICH THIS FILE IS PROVIDED.
*
* If you modify the file please update the list of contributors below to in-
* clude your name. Please also stick to the coding convention of using TABs
* to do the basic (block-level) indentation and spaces for anything after
* that. (Enable the display of special chars and it should be pretty obvious
* what this means.) Also, remove all trailing whitespace.
*
* Contributors:
* Willibald Krenn (AIT)
* Stephan Zimmerer (AIT)
* Christoph Czurda (AIT)
*
*/



#pragma once

#include <deque>

namespace Ast {

class AstElement; // forward

enum class AstAnnotationEnum: std::uint8_t {
mutation, // one mutation
list // list of annotations
};

class AstAnnotation {
protected:
const AstAnnotationEnum m_annotationType;

AstAnnotation(AstAnnotationEnum annotationType):
m_annotationType(annotationType)
{}
public:
virtual ~AstAnnotation(){}
AstAnnotationEnum getAnnotationType() {return m_annotationType;}
};

class AstAnnotationList final: public AstAnnotation {
public:
std::deque<AstAnnotation> m_annotationList;
AstAnnotationList():
AstAnnotation(AstAnnotationEnum::list),
m_annotationList()
{}
};


class MutationAnnotation final: public AstAnnotation {
public:
const std::uint32_t m_mutationID; // all mutation annotations with the same number form one mutant-AST
const AstElement* m_replacement; // replacement AST, NOT owned
MutationAnnotation(std::uint32_t mutationID, AstElement* mutatedElement) :
AstAnnotation(AstAnnotationEnum::mutation),
m_mutationID (mutationID),
m_replacement(mutatedElement)
{}
};

} // namespace
(3-3/23)