source: liacs/coco/assignment4/MStatement.h@ 372

Last change on this file since 372 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 1.5 KB
RevLine 
[2]1/*
2 * File: MStatement.h
3 * Author: rick
4 *
5 * Created on November 19, 2008, 1:14 AM
6 */
7
8#ifndef _MSTATEMENT_H
9#define _MSTATEMENT_H
10
11#include "MOperator.h"
12#include "MOperand.h"
13#include "Symbol.h"
14#include <string>
15
16using namespace std;
17
18class MStatement {
19public:
20 // Constructors/destructor
21
22 /* No operators */
23 MStatement(MOperator op, const char *comment = NULL);
24 /* One operator */
25 MStatement(MOperator op, MOperand *opnd1, const char *comment = NULL);
26 /* Two operators */
27 MStatement(MOperator op, MOperand *opnd1, MOperand *opnd2,
28 const char * comment = NULL);
29 /* Tree operators */
30 MStatement(MOperator op, MOperand *opnd1, MOperand *opnd2,
31 MOperand *opnd3, const char *comment = NULL);
32 ~MStatement();
33
34 // Get/Set operator
35 MOperator GetOperator() const;
36 void SetOperator(MOperator op);
37
38 // Get operand 1
39 MOperand *GetOperand1() const;
40 void SetOperand1(MOperand *operand);
41
42 // Get/Set operand 2
43 MOperand *GetOperand2() const;
44 void SetOperand2(MOperand *operand);
45
46 // Get/Set operand 3
47 MOperand *GetOperand3() const;
48 void SetOperand3(MOperand *operand);
49
50 // Dump
51 void Dump(FILE *file, int indent);
52
53 // Comment handler
54 void SetComment(const char *value);
55 const char *GetComment() const;
56
57 string GetLabel() const;
58 void SetLabel(string value);
59
60private:
61 MOperator moperator;
62 MOperand *operand1;
63 MOperand *operand2;
64 MOperand *operand3;
65 const char *comment;
66 string label;
67};
68
69#endif /* _MSTATEMENT_H */
70
Note: See TracBrowser for help on using the repository browser.