Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##ArrayHelper.h
- #ifndef ARRAYHELPER_H
- #define ARRAYHELPER_H
- #include <iostream>
- #include <queue>
- #include <string>
- #include "TypeHelper.h"
- #include "../IdentTypes/ArrayType.h"
- using namespace std;
- class ArrayHelper : public TypeHelper {
- public:
- ArrayHelper(const string& type_name);
- ~ArrayHelper();
- bool setTypePtr(IdentRecord* type); //problematic function
- bool sendToSt(STObject* st);
- private:
- struct Range {
- int low;
- int high;
- };
- queue<Range*> ranges;
- bool validate(void);
- IdentRecord* typePtr;
- };
- #endif
- ##ArrayHelper.cpp
- ArrayHelper::ArrayHelper(const string& type_name) : TypeHelper(type_name) {
- typePtr = NULL;
- }
- bool ArrayHelper::setTypePtr(IdentRecord* type) {
- if (typePtr != NULL) { //Segfaults here
- clean = false;
- cout << "Error: type already set." << endl;
- return false;
- } else if (type == NULL) {
- clean = false;
- cout << "Error: cannot set NULL typePtr." << endl;
- return false;
- } else {
- cout << "DEBUG: type successfully set for " << typeName << endl;
- typePtr = type;
- return true;
- }
- }
Add Comment
Please, Sign In to add comment