Aggiunto costruttore con puntatore a file a TRecord_cache e TFile_cache
git-svn-id: svn://10.65.10.50/trunk@5369 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
eefb4851ac
commit
8cd6b12aaa
@ -399,6 +399,13 @@ int TRecord_array::remove() const
|
|||||||
// TFile_cache
|
// TFile_cache
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
TFile_cache::TFile_cache(TLocalisamfile *f , int key)
|
||||||
|
: _file(NULL), _key(key)
|
||||||
|
{
|
||||||
|
_code.format("%d", f->num());
|
||||||
|
init_file(f);
|
||||||
|
}
|
||||||
|
|
||||||
TFile_cache::TFile_cache(int num, int key)
|
TFile_cache::TFile_cache(int num, int key)
|
||||||
: _file(NULL), _key(key)
|
: _file(NULL), _key(key)
|
||||||
{
|
{
|
||||||
@ -417,22 +424,28 @@ TFile_cache::~TFile_cache()
|
|||||||
delete _file;
|
delete _file;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFile_cache::init_file()
|
void TFile_cache::init_file(TLocalisamfile* f)
|
||||||
{
|
{
|
||||||
CHECK(_file == NULL, "File already initialized");
|
CHECK(_file == NULL, "File already initialized");
|
||||||
|
|
||||||
int logicnum = atoi(_code);
|
if (f==NULL)
|
||||||
if (logicnum == 0)
|
|
||||||
{
|
{
|
||||||
_file = new TTable(_code);
|
int logicnum = atoi(_code);
|
||||||
logicnum = _file->num();
|
if (logicnum == 0)
|
||||||
}
|
{
|
||||||
else
|
_file = new TTable(_code);
|
||||||
_file = new TLocalisamfile(logicnum);
|
logicnum = _file->num();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_file = new TLocalisamfile(logicnum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_file = f;
|
||||||
|
|
||||||
TDir dir;
|
TDir dir;
|
||||||
dir.get(logicnum);
|
dir.get(_file->num());
|
||||||
|
|
||||||
// Se e' un file comune metti a -1, altrimenti alla ditta corrente
|
// Se e' un file comune metti a -1, altrimenti alla ditta corrente
|
||||||
_last_firm = dir.is_com() ? -1 : prefix().get_codditta();
|
_last_firm = dir.is_com() ? -1 : prefix().get_codditta();
|
||||||
}
|
}
|
||||||
@ -571,6 +584,10 @@ const TString& TDecoder::decode(long code)
|
|||||||
// TRecord_cache
|
// TRecord_cache
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
TRecord_cache::TRecord_cache(TLocalisamfile *f, int key )
|
||||||
|
: TFile_cache(f, key)
|
||||||
|
{ }
|
||||||
|
|
||||||
TRecord_cache::TRecord_cache(int num, int key)
|
TRecord_cache::TRecord_cache(int num, int key)
|
||||||
: TFile_cache(num, key)
|
: TFile_cache(num, key)
|
||||||
{ }
|
{ }
|
||||||
|
@ -155,7 +155,7 @@ protected:
|
|||||||
TAssoc_array _cache;
|
TAssoc_array _cache;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void init_file();
|
void init_file(TLocalisamfile* f=NULL);
|
||||||
void test_firm();
|
void test_firm();
|
||||||
|
|
||||||
const TObject& query(const char* chiave);
|
const TObject& query(const char* chiave);
|
||||||
@ -170,6 +170,7 @@ public:
|
|||||||
{return _cache.items();}
|
{return _cache.items();}
|
||||||
int fill();
|
int fill();
|
||||||
|
|
||||||
|
TFile_cache(TLocalisamfile *f,int key = 1);
|
||||||
TFile_cache(int num, int key = 1);
|
TFile_cache(int num, int key = 1);
|
||||||
TFile_cache(const char* table, int key = 1);
|
TFile_cache(const char* table, int key = 1);
|
||||||
virtual ~TFile_cache();
|
virtual ~TFile_cache();
|
||||||
@ -203,6 +204,7 @@ public:
|
|||||||
virtual const TRectype& get(const char* chiave);
|
virtual const TRectype& get(const char* chiave);
|
||||||
|
|
||||||
TRecord_cache(int num, int key = 1);
|
TRecord_cache(int num, int key = 1);
|
||||||
|
TRecord_cache(TLocalisamfile *f, int key = 1);
|
||||||
TRecord_cache(const char* table, int key = 1);
|
TRecord_cache(const char* table, int key = 1);
|
||||||
virtual ~TRecord_cache() { }
|
virtual ~TRecord_cache() { }
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user