This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtppmatrix.h
91 lines (74 loc) · 2.03 KB
/
tppmatrix.h
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
/* tppmatrix.h
*
* TPPMatrix class defination.
*
* @author Tim Heier
* @version 1.0, 2/05/00
*
* @author Joel Freedman
* @verson 2.0, 5/03/07
*/
#include "cubeio.h"
#include <iostream>
#include <string>
//#include <dir>
using namespace std;
#define CREATE_FILE 1
#define MAX_DLL_ATTEMPTS 5
#define MAX_TABLES 500
#define HCHAR char
#define BYTE unsigned char
#define UCHAR unsigned char
#define USHORT unsigned short
#define ULONG unsigned long
#define SHORT short
#define LONG long
#define INT int
#define UINT unsigned int
#define WORD unsigned short
#define DWORD unsigned long
#define SL sizeof(LONG)
#define SS sizeof(SHORT)
#define SD sizeof(double)
#define SI sizeof(INT)
//--------------------------------------------------------------------
//TP+ Matrix Class Definition
class TPPMatrix
{
//--------------------------------------------------------------------
public:
TPPMatrix();
virtual ~TPPMatrix();
//Existing file operations
void openFile(char *fileName);
int getZones();
int getTables();
void getRow (int table, int row, double *rowptr);
double getValue(int table, int row, int j);
char* getTableName(int table);
//New file operations
void createFile(int tables, int zones, const char** matName,
const char* fileName);
void writeRow(int table, int row, double *rowptr);
void closeFile();
//Helper methods
double* allocateRowBuffer();
//Nested exception classes
class FileOpenException { };
class MatrixReadException { };
class InvalidOperationException { };
//--------------------------------------------------------------------
private:
//Data
MATLIST* _matlist ;
int _nZones;
int _nTables;
int _mode;
bool _fileOpen;
double* _rowptr;
char* _tableName[MAX_TABLES+1];
DWORD* _rowPos[MAX_TABLES+1];
//Methods
void readTableNames();
void printErrorCode(int error);
};