|
#ifndef FBASE_H |
|
#define FBASE_H |
|
|
|
#include <iostream> |
|
#include <fstream> |
|
|
|
using namespace std; |
|
namespace iret { |
|
|
|
typedef char *pChr; |
|
|
|
class FBase { |
|
public: |
|
FBase(const char *tp,const char *nm); |
|
FBase(const char *tp,int tn,const char *nm); |
|
|
|
FBase(const char *tp,const char *nm,const char *pt); |
|
|
|
|
|
|
|
~FBase(); |
|
void set_type_num(int tn); |
|
|
|
void set_name_num(int nn); |
|
|
|
void change_type(const char *nm); |
|
void change_name(const char *nm); |
|
void set_name(const char *nm); |
|
|
|
void subname(const char *tph,const char *tpl,const char *nm); |
|
|
|
|
|
void set_path_internal(const char *pt); |
|
|
|
|
|
void set_path_name(const char *pa); |
|
|
|
void map_down(FBase *pFb); |
|
void map_down_sub(FBase *pFb,const char *subtype); |
|
|
|
|
|
|
|
void get_pathx(char *cn,const char *a); |
|
|
|
|
|
|
|
void get_pathx(char *cn,long n,const char *a); |
|
char *add_num(const char *ptr,long n,char *buf); |
|
|
|
|
|
|
|
char *cat_num(const char *ptr,long n,char *buf); |
|
|
|
|
|
|
|
|
|
|
|
ifstream *get_Istr(const char *a,ios::openmode m=ios::in); |
|
|
|
ofstream *get_Ostr(const char *a,ios::openmode m=ios::out); |
|
|
|
fstream *get_Fstr(const char *a,ios::openmode m=ios::in|ios::out); |
|
|
|
ifstream *get_Istr(long n,const char *a,ios::openmode m=ios::in); |
|
ofstream *get_Ostr(long n,const char *a,ios::openmode m=ios::out); |
|
fstream *get_Fstr(long n,const char *a,ios::openmode m=ios::in|ios::out); |
|
void dst_Istr(ifstream *pfin); |
|
void dst_Ostr(ofstream *pfout); |
|
void dst_Fstr(fstream *pfstr); |
|
|
|
|
|
long get_Fsiz(const char *a); |
|
long get_Fsiz(long n,const char *a); |
|
|
|
|
|
int Exists(const char *a); |
|
int Exists(long n,const char *a); |
|
|
|
|
|
char *get_Read(const char *a); |
|
|
|
char *get_Read(long n,const char *a); |
|
|
|
|
|
char *get_Mmap(const char *a); |
|
|
|
char *get_Mmap(long n,const char *a); |
|
char *get_Wmap(const char *a); |
|
|
|
|
|
char *get_Wmap(long n,const char *a); |
|
|
|
void dst_Mmap(const char *a,char *ptr); |
|
|
|
void dst_Mmap(long n,const char *a,char *ptr); |
|
|
|
|
|
void bin_Writ(const char *a,long nm,char *ptr); |
|
|
|
void bin_Writ(long n,const char *a,long nm,char *ptr); |
|
|
|
|
|
template <typename X> |
|
void get_Nnum(const char *a,X &m1); |
|
template <typename X,typename Y> |
|
void get_Nnum(const char *a,X &m1,Y &m2); |
|
template <typename X,typename Y,typename Z> |
|
void get_Nnum(const char *a,X &m1,Y &m2,Z &m3); |
|
template <typename X> |
|
void get_Nnum(long n,const char *a,X &m1); |
|
template <typename X,typename Y> |
|
void get_Nnum(long n,const char *a,X &m1,Y &m2); |
|
template <typename X,typename Y,typename Z> |
|
void get_Nnum(long n,const char *a,X &m1,Y &m2,Z &m3); |
|
template <typename X> |
|
void put_Nnum(const char *a,X &m1); |
|
template <typename X,typename Y> |
|
void put_Nnum(const char *a,X &m1,Y &m2); |
|
template <typename X,typename Y,typename Z> |
|
void put_Nnum(const char *a,X &m1,Y &m2,Z &m3); |
|
template <typename X> |
|
void put_Nnum(long n,const char *a,X &m1); |
|
template <typename X,typename Y> |
|
void put_Nnum(long n,const char *a,X &m1,Y &m2); |
|
template <typename X,typename Y,typename Z> |
|
void put_Nnum(long n,const char *a,X &m1,Y &m2,Z &m3); |
|
|
|
|
|
int Gcom(int sflag); |
|
|
|
|
|
int Rcom(int sflag); |
|
|
|
|
|
void mark(long,int,const char*); |
|
|
|
|
|
|
|
|
|
int cflag; |
|
int oflag; |
|
int open1; |
|
int open2; |
|
int open3; |
|
int open4; |
|
int open5; |
|
char *type; |
|
int tpnm; |
|
|
|
char *name; |
|
int nmnm; |
|
|
|
int pflag; |
|
|
|
int eflag; |
|
|
|
char *path; |
|
char *pnam; |
|
}; |
|
|
|
|
|
|
|
template <typename X> |
|
void FBase::get_Nnum(const char *a,X &m1){ |
|
ifstream *pfin=get_Istr(a,ios::in); |
|
*pfin >> m1; |
|
dst_Istr(pfin); |
|
} |
|
|
|
template <typename X,typename Y> |
|
void FBase::get_Nnum(const char *a,X &m1,Y &m2){ |
|
ifstream *pfin=get_Istr(a,ios::in); |
|
*pfin >> m1 >> m2; |
|
dst_Istr(pfin); |
|
} |
|
|
|
template <typename X,typename Y,typename Z> |
|
void FBase::get_Nnum(const char *a,X &m1,Y &m2,Z &m3){ |
|
ifstream *pfin=get_Istr(a,ios::in); |
|
*pfin >> m1 >> m2 >> m3; |
|
dst_Istr(pfin); |
|
} |
|
|
|
template <typename X> |
|
void FBase::get_Nnum(long n,const char *a,X &m1){ |
|
ifstream *pfin=get_Istr(n,a,ios::in); |
|
*pfin >> m1; |
|
dst_Istr(pfin); |
|
} |
|
|
|
template <typename X,typename Y> |
|
void FBase::get_Nnum(long n,const char *a,X &m1,Y &m2){ |
|
ifstream *pfin=get_Istr(n,a,ios::in); |
|
*pfin >> m1 >> m2; |
|
dst_Istr(pfin); |
|
} |
|
|
|
template <typename X,typename Y,typename Z> |
|
void FBase::get_Nnum(long n,const char *a,X &m1,Y &m2,Z &m3){ |
|
ifstream *pfin=get_Istr(n,a,ios::in); |
|
*pfin >> m1 >> m2 >> m3; |
|
dst_Istr(pfin); |
|
} |
|
|
|
template <typename X> |
|
void FBase::put_Nnum(const char *a,X &m1){ |
|
ofstream *pfout=get_Ostr(a,ios::out); |
|
*pfout << m1 << endl; |
|
dst_Ostr(pfout); |
|
} |
|
|
|
template <typename X,typename Y> |
|
void FBase::put_Nnum(const char *a,X &m1,Y &m2){ |
|
ofstream *pfout=get_Ostr(a,ios::out); |
|
*pfout << m1 << " " << m2 << endl; |
|
dst_Ostr(pfout); |
|
} |
|
|
|
template <typename X,typename Y,typename Z> |
|
void FBase::put_Nnum(const char *a,X &m1,Y &m2,Z &m3){ |
|
ofstream *pfout=get_Ostr(a,ios::out); |
|
*pfout << m1 << " " << m2 << " " << m3 << endl; |
|
dst_Ostr(pfout); |
|
} |
|
|
|
template <typename X> |
|
void FBase::put_Nnum(long n,const char *a,X &m1){ |
|
ofstream *pfout=get_Ostr(n,a,ios::out); |
|
*pfout << m1 << endl; |
|
dst_Ostr(pfout); |
|
} |
|
|
|
template <typename X,typename Y> |
|
void FBase::put_Nnum(long n,const char *a,X &m1,Y &m2){ |
|
ofstream *pfout=get_Ostr(n,a,ios::out); |
|
*pfout << m1 << " " << m2 << endl; |
|
dst_Ostr(pfout); |
|
} |
|
|
|
template <typename X,typename Y,typename Z> |
|
void FBase::put_Nnum(long n,const char *a,X &m1,Y &m2,Z &m3){ |
|
ofstream *pfout=get_Ostr(n,a,ios::out); |
|
*pfout << m1 << " " << m2 << " " << m3 << endl; |
|
dst_Ostr(pfout); |
|
} |
|
|
|
} |
|
#endif |
|
|