CASToR  2.0
Tomographic Reconstruction (PET/SPECT/CT)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
vEvent.cc
Go to the documentation of this file.
1 /*
2 This file is part of CASToR.
3 
4  CASToR is free software: you can redistribute it and/or modify it under the
5  terms of the GNU General Public License as published by the Free Software
6  Foundation, either version 3 of the License, or (at your option) any later
7  version.
8 
9  CASToR is distributed in the hope that it will be useful, but WITHOUT ANY
10  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12  details.
13 
14  You should have received a copy of the GNU General Public License along with
15  CASToR (in file GNU_GPL.TXT). If not, see <http://www.gnu.org/licenses/>.
16 
17 Copyright 2017-2018 all CASToR contributors listed below:
18 
19  --> current contributors: Thibaut MERLIN, Simon STUTE, Didier BENOIT, Claude COMTAT, Marina FILIPOVIC, Mael MILLARDET
20  --> past contributors: Valentin VIELZEUF
21 
22 This is CASToR version 2.0.
23 */
24 
32 #include "vEvent.hh"
33 #include "vDataFile.hh"
34 #include "sOutputManager.hh"
35 
36 // =====================================================================
37 // ---------------------------------------------------------------------
38 // ---------------------------------------------------------------------
39 // =====================================================================
40 
42 {
43  m_timeInMs = 0;
44  m_nbLines = 0;
45  mp_ID1 = NULL;
46  mp_ID2 = NULL;
49  m_verbose = -1;
50  m_eventValue = 0.;
51 }
52 
53 // =====================================================================
54 // ---------------------------------------------------------------------
55 // ---------------------------------------------------------------------
56 // =====================================================================
57 
59 {
60  if (mp_ID1 != NULL) free(mp_ID1);
61  if (mp_ID1 != NULL) free(mp_ID2);
62 }
63 
64 // =====================================================================
65 // ---------------------------------------------------------------------
66 // ---------------------------------------------------------------------
67 // =====================================================================
68 
70 {
71  // Verbose
73  if (m_verbose>=VERBOSE_DETAIL) Cout("vEvent::AllocateID() -> Allocate buffers for indices" << endl);
74  // Check number of lines
75  if (m_nbLines<1)
76  {
77  Cerr("***** vEvent::AllocateID() -> Error, number of lines has not been initialized (<1) !" << endl);
78  return 1;
79  }
80  else
81  {
82  // Allocate buffer indices
83  mp_ID1 = (uint32_t*)malloc(m_nbLines*sizeof(uint32_t));
84  mp_ID2 = (uint32_t*)malloc(m_nbLines*sizeof(uint32_t));
85  }
86  // Call the pure virtual function implemented in child classes for the allocation of data specific to child classes
88  {
89  Cerr("***** vEvent::AllocateID() -> Error when trying to allocated specific data for the Event !" << endl);
90  return 1;
91  }
92  // End
93  return 0;
94 }
95 
96 // =====================================================================
97 // ---------------------------------------------------------------------
98 // ---------------------------------------------------------------------
99 // =====================================================================
#define TYPE_UNKNOWN
Definition: vDataFile.hh:72
int m_verbose
Definition: vEvent.hh:233
uint32_t * mp_ID2
Definition: vEvent.hh:228
#define VERBOSE_DETAIL
int m_dataType
Definition: vEvent.hh:230
#define Cerr(MESSAGE)
#define VERBOSE_DEBUG_LIGHT
uint32_t * mp_ID1
Definition: vEvent.hh:227
Declaration of class vDataFile.
FLTNB m_eventValue
Definition: vEvent.hh:229
Declaration of class vEvent.
vEvent()
vEvent constructor. Initialize the member variables to their default values.
Definition: vEvent.cc:41
int AllocateID()
Instantiate the mp_ID1 and mp_ID2 indices arrays.
Definition: vEvent.cc:69
int m_dataMode
Definition: vEvent.hh:231
virtual int AllocateSpecificData()=0
Pure virtual function implemented in the child classes, dedicated to the allocation of specific data ...
Declaration of class sOutputManager.
#define MODE_UNKNOWN
Definition: vDataFile.hh:55
#define DEBUG_VERBOSE(IGNORED1, IGNORED2)
#define Cout(MESSAGE)
uint16_t m_nbLines
Definition: vEvent.hh:226
uint32_t m_timeInMs
Definition: vEvent.hh:225
virtual ~vEvent()
vEvent destructor
Definition: vEvent.cc:58