FEDRA emulsion software from the OPERA Collaboration
TBaseMatrix Class Referenceabstract

#include <basematrix.h>

Inheritance diagram for TBaseMatrix:
Collaboration diagram for TBaseMatrix:

Public Member Functions

void Adopt (unsigned char *mas, long rows, long columns)
 
virtual int GetElement (int type, long i, long j)=0
 
long GetSize (long *ix_size=NULL, long *iy_size=NULL)
 
void Init (long ix_size, long iy_size)
 
void MoveMatrix (long ud, long lr)
 
TBaseMatrixoperator= (TBaseMatrix &T)
 
void Print (int type)
 
void ResetShift (void)
 
 TBaseMatrix ()
 
 TBaseMatrix (long ix_size, long iy_size)
 
 TBaseMatrix (TBaseMatrix &iT)
 
virtual ~TBaseMatrix ()
 

Protected Member Functions

const unsigned char * GetPointer (void)
 

Protected Attributes

long byteSize
 
unsigned char * mas
 
long shiftX
 
long shiftY
 
long xSize
 
long ySize
 

Constructor & Destructor Documentation

◆ TBaseMatrix() [1/3]

TBaseMatrix::TBaseMatrix ( )
26 {
27  xSize=0;
28  ySize=0;
29  byteSize=0;
30  mas = NULL;
31  shiftX=0;
32  shiftY=0;
33 // position = 0;
34 // NonZeroPoints = new TObjArray();
35 
36 /* cxSize=0;
37  cySize=0;
38  cbyteSize=0;
39  cmas = NULL;
40 */
41 }
long shiftX
Definition: basematrix.h:36
long ySize
Definition: basematrix.h:23
long shiftY
Definition: basematrix.h:37
long xSize
Definition: basematrix.h:22
unsigned char * mas
Definition: basematrix.h:30
long byteSize
Definition: basematrix.h:24
#define NULL
Definition: nidaqmx.h:84

◆ TBaseMatrix() [2/3]

TBaseMatrix::TBaseMatrix ( long  ix_size,
long  iy_size 
)
44 {
45  mas=NULL;
46  Init(ix_size,iy_size);
47 }
void Init(long ix_size, long iy_size)
Definition: basematrix.cxx:108

◆ TBaseMatrix() [3/3]

TBaseMatrix::TBaseMatrix ( TBaseMatrix iT)
51 {
52  mas=NULL;
53  long ixs,iys;
54  iT.GetSize(&ixs,&iys);
55  Init(ixs,iys);
56 // *this = T;
57 }
long GetSize(long *ix_size=NULL, long *iy_size=NULL)
Definition: basematrix.cxx:190

◆ ~TBaseMatrix()

TBaseMatrix::~TBaseMatrix ( )
virtual
71  {
72  if (mas) {
73  free(mas);
74  mas = NULL;
75  }
76 /* if (cmas) {
77  free(cmas);
78  cmas = NULL;
79  }
80 */ xSize=0;
81  ySize=0;
82  byteSize=0;
83  shiftX=0;
84  shiftY=0;
85 /* if (NonZeroPoints) {
86  NonZeroPoints->Delete();
87  delete NonZeroPoints;
88  }
89 */
90 /* cxSize=0;
91  cySize=0;
92  cbyteSize=0;
93 */
94 }

Member Function Documentation

◆ Adopt()

void TBaseMatrix::Adopt ( unsigned char *  mas,
long  rows,
long  columns 
)
145 {
146  Init(columns,rows);
147  memcpy((void *)mas,(void *)m,rows*columns);
148 // Synchronize();
149 }

◆ GetElement()

virtual int TBaseMatrix::GetElement ( int  type,
long  i,
long  j 
)
pure virtual

Implemented in TByteMatrix, and TBitMatrix.

◆ GetPointer()

const unsigned char* TBaseMatrix::GetPointer ( void  )
inlineprotected
33 {return mas;}

◆ GetSize()

long TBaseMatrix::GetSize ( long ix_size = NULL,
long iy_size = NULL 
)
191 {
192  if (x) *x = xSize;
193  if (y) *y = ySize;
194  return byteSize;
195 }

◆ Init()

void TBaseMatrix::Init ( long  ix_size,
long  iy_size 
)
108  {
109  if (mas) free(mas);
110 // if (cmas) free(cmas);
111  xSize = x;
112  ySize = y;
113 // long bitSize = xSize*ySize;
114  byteSize = xSize*ySize;
115  mas = (unsigned char *)calloc(byteSize,sizeof(unsigned char));
116 // cmas = (unsigned char *)calloc(cbyteSize,sizeof(unsigned char));
117  shiftX=0;
118  shiftY=0;
119 /* if (NonZeroPoints) {
120  NonZeroPoints->Delete();
121  delete NonZeroPoints;
122  }
123  NonZeroPoints = new TObjArray();
124  position = 0;
125 */
126 // TByteMatrix(x,y);
127 }

◆ MoveMatrix()

void TBaseMatrix::MoveMatrix ( long  ud,
long  lr 
)
314 {
315 /* if ((ud==0)&&(lr==0)) Synchronize();
316  else if ((ud>=0)&&(lr>=0)) MoveMatrix2Right_Down(ud,lr);
317  else if ((ud>=0)&&(lr<0)) MoveMatrix2Left_Down(ud,-lr);
318  else if ((ud<0)&&(lr>=0)) MoveMatrix2Right_Up(-ud,lr);
319  else if ((ud<0)&&(lr<0)) MoveMatrix2Left_Up(-ud,-lr);
320 */
321  shiftX=lr;
322  shiftY=ud;
323 }

◆ operator=()

TBaseMatrix & TBaseMatrix::operator= ( TBaseMatrix T)
326  {
327  long x,y;
328  T.GetSize(&x,&y);
329  Init(x,y);
330  memcpy((void *)mas,(void *)T.GetPointer(),T.GetSize());
331 /* if (NonZeroPoints) {
332  NonZeroPoints->Delete();
333  delete NonZeroPoints;
334  }
335  NonZeroPoints = new TObjArray(*T.GetP()); */
336 // Synchronize();
337  return *this;
338 }
const unsigned char * GetPointer(void)
Definition: basematrix.h:33

◆ Print()

void TBaseMatrix::Print ( int  type)
208 {
209  long xs,ys;
210  GetSize(&xs,&ys);
211  if (type==0) {cout<<"=========initial mas================"<<endl;}
212  else if (type == 1) {cout<<"=========current mas================"<<endl;}
213  for (long j=0; j<ys; j++) {
214  for (long i=0; i<xs; i++) {
215  cout<<GetElement(type,i,j)<<" ";
216  }
217  cout<<endl;
218  }
219  cout<<"===================================="<<endl;
220 }
virtual int GetElement(int type, long i, long j)=0
Int_t type
Definition: testBGReduction_By_ANN.C:15

◆ ResetShift()

void TBaseMatrix::ResetShift ( void  )
131 {
132 /* if (cmas) free(cmas);
133  cxSize = ixSize;
134  cySize = iySize;
135  cbyteSize = ibyteSize;
136  cmas = (unsigned char *)calloc(cbyteSize,sizeof(unsigned char));
137  memcpy((void *)cmas,(void *)imas,ibyteSize);
138 */
139  shiftX=0;
140  shiftY=0;
141 }

Member Data Documentation

◆ byteSize

long TBaseMatrix::byteSize
protected

◆ mas

unsigned char* TBaseMatrix::mas
protected

◆ shiftX

long TBaseMatrix::shiftX
protected

◆ shiftY

long TBaseMatrix::shiftY
protected

◆ xSize

long TBaseMatrix::xSize
protected

◆ ySize

long TBaseMatrix::ySize
protected

The documentation for this class was generated from the following files: