-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataElement.h
More file actions
93 lines (70 loc) · 1.89 KB
/
DataElement.h
File metadata and controls
93 lines (70 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#pragma once
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cmath>
#include <limits>
#include <QString>
#include "Error.h"
#include "BasicTypes.h"
// the DataElement.h and DataElements.cpp define a class that is
// used in stack and variable to store single element of data and the
// definitions of the various types of values that may be stored
// we will pass a pointer to a DataElement to the functions of the
// Convert class for all output
#define MAXARRAYSIZE 1048576
class DataElement;
class DataElementArray
{
public:
int xdim;
int ydim;
std::vector<DataElement*> data;
};
class DataElementMap
{
public:
std::map<std::string, DataElement*> data;
};
class DataElement
{
public:
int type; // type from BasicTypes.h
QString stringval;
double floatval;
long intval;
int level;
DataElementArray *arr;
DataElementMap *map;
DataElement();
~DataElement();
DataElement(QString);
DataElement(double);
DataElement(long);
DataElement(unsigned int);
DataElement(int);
DataElement(DataElement *);
QString debug();
void copy(DataElement *);
void clear();
void arrayDim(const int, const int, const bool);
DataElement* arrayGetData(const int, const int);
void arraySetData(const int, const int, DataElement *);
void arrayUnassign(const int, const int);
int arrayRows();
int arrayCols();
void mapDim();
DataElement* mapGetData(QString);
void mapSetData(QString, DataElement *);
void mapSetData(std::string, DataElement *);
void mapUnassign(QString);
int mapLength();
bool mapKey(QString);
static int getError();
static int getError(int);
static int getType(DataElement*);
private:
static int e; // error number thrown - will be 0 if no error
void init();
};