57 lines
1.2 KiB
C
57 lines
1.2 KiB
C
|
|
/*********************************************
|
|||
|
|
*
|
|||
|
|
* Matrix data reading
|
|||
|
|
*
|
|||
|
|
* copyright Shanghai Baosight Software Co., Ltd.
|
|||
|
|
*
|
|||
|
|
* create zoufuzhou 20191001
|
|||
|
|
*
|
|||
|
|
************************************************/
|
|||
|
|
#ifndef _MATRIXFILE_H
|
|||
|
|
#define _MATRIXFILE_H
|
|||
|
|
/**
|
|||
|
|
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD>ȡ<EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
| column0 column1 column2 column3
|
|||
|
|
0 | abc 1000 ddd -
|
|||
|
|
1 | ccc 2000 ddd -
|
|||
|
|
2 | ddd 3000 ddd -
|
|||
|
|
<EFBFBD><EFBFBD><EFBFBD>ݹؼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MatrixFile(0,1) = 1000
|
|||
|
|
*/
|
|||
|
|
#include <string>
|
|||
|
|
#include <iostream>
|
|||
|
|
#include <vector>
|
|||
|
|
using namespace std;
|
|||
|
|
|
|||
|
|
namespace baosight
|
|||
|
|
{
|
|||
|
|
class MatrixFile{
|
|||
|
|
public:
|
|||
|
|
MatrixFile(const std::string& file,int startline = 1,const std::string& split = " ");
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|||
|
|
int reset(const std::string& file,int startline = 1,const std::string& split = " ");
|
|||
|
|
|
|||
|
|
//ȡָ<C8A1><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
string operator()(unsigned int row, unsigned int column);
|
|||
|
|
|
|||
|
|
//ȡָ<C8A1><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
string operator()( unsigned int row, const string& column);
|
|||
|
|
|
|||
|
|
//ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
unsigned int column(void);
|
|||
|
|
|
|||
|
|
//ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
unsigned int row(void);
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
int getColumn(const string& column);
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
std::vector<std::string> v_columns;
|
|||
|
|
std::vector<std::vector<std::string> > v_datarows;
|
|||
|
|
};
|
|||
|
|
};
|
|||
|
|
#endif
|
|||
|
|
|