#ifndef __RELATION_H #include #endif class TEffetto:public TRectype { TRecord_array _righe,_cess; protected: // ritorna la prossima chiave long get_next_key(const long codcf) const; int read(TLocalisamfile& f, const TRectype& rec); public: // rinumera le chiavi long renum(long numeff = 0); // ritorna la testata dell'effetto const TRectype& head() const { return *this; } // ritorna la testata dell'effetto TRectype& head() { return *this; } TRecord_array& righe() {return _righe;} TRecord_array& cess() {return _cess;} // ritorna la riga i_esima dei cessionari TRectype& row_c(int i, bool create=FALSE) { return _cess.row(i,create); } // ritorna la riga i delle righe TRectype& row_r(int i, bool create=FALSE) { return _righe.row(i,create); } // ritorna il numero delle righe presenti nelle righe effetto int rows_r() const { return _righe.rows(); } // ritorna il numero delle righe presenti nei cessionari int rows_c() const { return _cess.rows(); } // elimina l'elemento riga nella posizione n nelle righe effetto bool destroy_row_r(int n, bool pack = FALSE) { return _righe.destroy_row(n, pack); } // elimina tutti gli elementi riga nelle righe effetto void destroy_rows_r() { _righe.destroy_rows(); } // elimina l'elemento riga nella posizione n nei cessionari bool destroy_row_c(int n, bool pack = FALSE) { return _cess.destroy_row(n, pack); } // elimina tutti gli elementi riga nei cessionari void destroy_rows_c() { _cess.destroy_rows(); } int read(const TRectype& rec); int read(char tipodist, long ndist, long nrigadist); int write(bool force=FALSE); int rewrite() { return write(TRUE); } int remove()const; long numero() const { return get_long("NPROGTR"); } long codicec() const { return get_long("CODCF"); } TDate datasc() const { return get_date("DATASCAD"); } char tipodist() const { return get_char("TIPODIST"); } long ndist() const { return get_long("NDIST"); } long nrgdist() const { return get_long("NRIGADIST"); } //setta i campi per la quarta chiave del file void put_key(TRectype& rec,char tipodist, long ndist, long nrigadist = 0); //setta i campi per la prima chiave del file void put_key(TRectype& rec,long numeff) const; TEffetto(); TEffetto(TRectype& rec); virtual ~TEffetto() {} };