Logo coherent WaveBurst  
Library Reference Guide
Logo
SymmObjArray.hh
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Sergey Klimenko
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 
19 #ifndef SYMMOBJARRAY_HH
20 #define SYMMOBJARRAY_HH
21 
22 #include "stdio.h"
23 #include "TNamed.h"
24 
25 // guaranteed to work only with classes that implement the "persistent" interface (Read/Write)
26 
27 // a[-n], a[-n+1] a[-n+2] ... a[0] a[1] .... a[n]
28 
29 template <class T>
30 class SymmObjArray : public TNamed {
31 public:
32  explicit SymmObjArray(unsigned int n=0);
33  explicit SymmObjArray(const SymmObjArray&); //copy constructor
34  virtual ~SymmObjArray();
35  SymmObjArray& operator=(const SymmObjArray& other);
36  void Resize(unsigned int sz); // data is lost
37  void Write(FILE* f);
38  void Read(FILE* f);
39  T& operator[](int i){ return zero[i];}
40  unsigned int Last() {return Size/2;}
41 
42 protected:
43  void Resize0(unsigned int sz);
44  int Size;
45  T* rec; //!
46  T* zero; //!
47 
48  ClassDef(SymmObjArray,1)
49 };
50 
51 
52 #endif
unsigned int Last()
Definition: SymmObjArray.hh:40
int n
Definition: cwb_net.C:28
void Read(FILE *f)
Definition: SymmObjArray.cc:73
i drho i
cout<< "SNR "<< xsnr<< endl;wavearray< double > f
Definition: ComputeSNR.C:75
virtual ~SymmObjArray()
Definition: SymmObjArray.cc:49
void Resize(unsigned int sz)
Definition: SymmObjArray.cc:54
void Resize0(unsigned int sz)
Definition: SymmObjArray.cc:59
double T
Definition: testWDM_4.C:11
SymmObjArray(unsigned int n=0)
Definition: SymmObjArray.cc:27
SymmObjArray & operator=(const SymmObjArray &other)
Definition: SymmObjArray.cc:41
void Write(FILE *f)
Definition: SymmObjArray.cc:67
T & operator[](int i)
Definition: SymmObjArray.hh:39