ICG 2
Electric Boogaloo
PrimitiveDataType.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Type/DataType.hpp"
4 #include "Value/IntegerValue.hpp"
6 
7 #include <stdlib.h>
8 #include <iostream>
9 
12 class PrimitiveDataType : public DataType {
13 
14 public:
15 
21 
22  /* ==================================================================== */
23  /* VIRTUAL INTERFACE */
24  /* ==================================================================== */
25 
26  // Most of the DataTypeInterface is abstract here, will be defined by SpecifiedPrimitiveType
27 
28  bool accept (DataTypeVisitor* visitor) const override {
29  return visitor->visitPrimitiveDataType(std::static_pointer_cast<const PrimitiveDataType>(shared_from_this()));
30  }
31 
32 
33  /* ==================================================================== */
34  /* CLASS SPECIFIC INTERFACE */
35  /* ==================================================================== */
36 
43  virtual bool isFloatingPoint() const = 0;
44 
52  virtual bool isSigned() const = 0;
53 
60  virtual bool isVoid() const = 0;
61 
66  virtual void clearValue(void * address) const = 0;
67 
73  virtual bool assignValue(void * address, Value * value) const = 0;
74 
79  virtual Value * getValue(void *address) const = 0;
80 
84  virtual void printValue(std::ostream &s, void *address ) const = 0;
85 
86 
87 };
Abstract base class for a DataTypeVisitor.
Definition: DataTypeVisitor.hpp:20
virtual bool visitPrimitiveDataType(std::shared_ptr< const PrimitiveDataType > node)=0
Abstract base class for DataTypes.
Definition: DataType.hpp:11
Definition: PrimitiveDataType.hpp:12
virtual bool assignValue(void *address, Value *value) const =0
Assign a value to the variable at the given address.
virtual bool isFloatingPoint() const =0
Determine whether this is an integer type or floating point type.
virtual void clearValue(void *address) const =0
Clear the variable at the given address.
bool accept(DataTypeVisitor *visitor) const override
Definition: PrimitiveDataType.hpp:28
virtual Value * getValue(void *address) const =0
Creates a Value object for the variable at the given address.
virtual void printValue(std::ostream &s, void *address) const =0
Print an ascii representation of the value at the given address to the stream.
virtual bool isSigned() const =0
Determine whether type is signed.
~PrimitiveDataType()
Definition: PrimitiveDataType.hpp:20
PrimitiveDataType()
Definition: PrimitiveDataType.hpp:19
virtual bool isVoid() const =0
Is the type void?
Value is an abstract base-class that represents a value on the right-hand-side of an assignment.
Definition: Value.hpp:9