Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
FileReader.cc
Go to the documentation of this file.
1
9#include "Api/PandoraApi.h"
10
12
13namespace pandora
14{
15
16FileReader::FileReader(const pandora::Pandora &pandora, const std::string &fileName) :
17 Persistency(pandora, fileName)
18{
19}
20
21//------------------------------------------------------------------------------------------------------------------------------------------
22
26
27//------------------------------------------------------------------------------------------------------------------------------------------
28
30{
32 {
33 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->GoToNextGeometry());
34 }
35
36 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->ReadHeader());
37
39 return STATUS_CODE_FAILURE;
40
41 try
42 {
43 while (STATUS_CODE_SUCCESS == this->ReadNextGeometryComponent())
44 continue;
45 }
46 catch (StatusCodeException &statusCodeException)
47 {
48 std::cout << " FileReader::ReadGeometry() encountered unrecognized object in file: " << statusCodeException.ToString() << std::endl;
49 }
50
52
53 return STATUS_CODE_SUCCESS;
54}
55
56//------------------------------------------------------------------------------------------------------------------------------------------
57
59{
61 {
62 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->GoToNextEvent());
63 }
64
65 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->ReadHeader());
66
67 try
68 {
69 while (STATUS_CODE_SUCCESS == this->ReadNextEventComponent())
70 continue;
71 }
72 catch (StatusCodeException &statusCodeException)
73 {
74 std::cout << " FileReader::ReadEvent() encountered unrecognized object in file: " << statusCodeException.ToString() << std::endl;
75 }
76
78
79 return STATUS_CODE_SUCCESS;
80}
81
82//------------------------------------------------------------------------------------------------------------------------------------------
83
85{
86 do
87 {
88 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->GoToNextContainer());
89 }
90 while (GEOMETRY_CONTAINER != this->GetNextContainerId());
91
92 return STATUS_CODE_SUCCESS;
93}
94
95//------------------------------------------------------------------------------------------------------------------------------------------
96
98{
99 do
100 {
101 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->GoToNextContainer());
102 }
103 while (EVENT_CONTAINER != this->GetNextContainerId());
104
105 return STATUS_CODE_SUCCESS;
106}
107
108} // namespace pandora
Header file for the file reader class.
Header file for the pandora api class.
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Definition StatusCodes.h:19
virtual StatusCode GoToNextContainer()=0
Skip to next container in the file.
FileReader(const pandora::Pandora &pandora, const std::string &fileName)
Constructor.
Definition FileReader.cc:16
virtual StatusCode ReadNextEventComponent()=0
Read the next pandora event component from the current position in the file, recreating the stored co...
StatusCode GoToNextGeometry()
Skip to next geometry container in the file.
Definition FileReader.cc:84
StatusCode ReadEvent()
Read an entire pandora event from the file, recreating the stored objects.
Definition FileReader.cc:58
StatusCode ReadGeometry()
Read the current geometry information from the file.
Definition FileReader.cc:29
virtual StatusCode ReadHeader()=0
Read the container header from the current position in the file, checking for properly written contai...
virtual ContainerId GetNextContainerId()=0
Get the id of the next container in the file without changing the current position in the file.
virtual ~FileReader()
Destructor.
Definition FileReader.cc:23
virtual StatusCode ReadNextGeometryComponent()=0
Read the next pandora geometry component from the current position in the file, recreating the stored...
StatusCode GoToNextEvent()
Skip to next event container in the file.
Definition FileReader.cc:97
Pandora class.
Definition Pandora.h:40
Persistency class.
Definition Persistency.h:26
ContainerId m_containerId
The type of container currently being written to file.
Definition Persistency.h:76
StatusCodeException class.
std::string ToString() const
Get status code as a string.
@ EVENT_CONTAINER
Definition PandoraIO.h:25
@ UNKNOWN_CONTAINER
Definition PandoraIO.h:27
@ GEOMETRY_CONTAINER
Definition PandoraIO.h:26
StatusCode
The StatusCode enum.