ATLAS Offline Software
Public Member Functions | Static Public Member Functions | List of all members
ByteStreamDataWriter Class Referenceabstract

This class defines abstract interface for data writing. More...

#include <ByteStreamDataWriter.h>

Inheritance diagram for ByteStreamDataWriter:
Collaboration diagram for ByteStreamDataWriter:

Public Member Functions

 ByteStreamDataWriter ()
 
virtual ~ByteStreamDataWriter ()
 
 ByteStreamDataWriter (const ByteStreamDataWriter &)=delete
 
ByteStreamDataWriteroperator= (const ByteStreamDataWriter &)=delete
 
virtual EventStorage::DWError putData (unsigned int dataSize, const void *data)=0
 Write a single block of data. More...
 
virtual bool good () const =0
 Feedback to user, check if open and last write went OK. More...
 

Static Public Member Functions

static std::unique_ptr< ByteStreamDataWritermakeWriter (int version, const std::string &writingPath, const std::string &fileNameCore, const EventStorage::run_parameters_record &rPar, const std::vector< std::string > &fmdStrings, unsigned int maxFileNE=0, unsigned int maxFileMB=0, unsigned int startIndex=1, EventStorage::CompressionType compression=EventStorage::NONE, unsigned int compLevel=1)
 Factory method returning data writer instance for specified version. More...
 
static std::unique_ptr< ByteStreamDataWritermakeWriter (int version, const std::string &writingPath, boost::shared_ptr< EventStorage::FileNameCallback > theFNCB, const EventStorage::run_parameters_record &rPar, const std::string &project, const std::string &streamType, const std::string &streamName, const std::string &stream, unsigned int lumiBlockNumber, const std::string &applicationName, const std::vector< std::string > &fmdStrings, unsigned int maxFileNE=0, unsigned int maxFileMB=0, EventStorage::CompressionType compression=EventStorage::NONE, unsigned int compLevel=1)
 Factory method returning data writer instance for specified version. More...
 
static std::unique_ptr< ByteStreamDataWritermakeWriter (const DataWriterParameters &parameters)
 Factory method returning data writer instance for specified version. More...
 

Detailed Description

This class defines abstract interface for data writing.

Main purpose of this class is to provide interface for writing different versions of output ByteStream files. This interface will be implemented on top of the EventStorage/DataWriter (from tdaq-common) and it will only provide few methods relevant to this package. The interface is defined in terms of data structures of the current version of the EventStorage, implementations for older versions will need to translate those structures into their version-specific data.

In addition to abstract methods this class defines few factory methods which return instances implementing this interface.

Definition at line 41 of file ByteStreamDataWriter.h.

Constructor & Destructor Documentation

◆ ByteStreamDataWriter() [1/2]

ByteStreamDataWriter::ByteStreamDataWriter ( )
inline

Definition at line 123 of file ByteStreamDataWriter.h.

123 {}

◆ ~ByteStreamDataWriter()

virtual ByteStreamDataWriter::~ByteStreamDataWriter ( )
inlinevirtual

Definition at line 124 of file ByteStreamDataWriter.h.

124 {}

◆ ByteStreamDataWriter() [2/2]

ByteStreamDataWriter::ByteStreamDataWriter ( const ByteStreamDataWriter )
delete

Member Function Documentation

◆ good()

virtual bool ByteStreamDataWriter::good ( ) const
pure virtual

Feedback to user, check if open and last write went OK.

Implemented in ByteStreamDataWriterV5.

◆ makeWriter() [1/3]

std::unique_ptr< ByteStreamDataWriter > ByteStreamDataWriter::makeWriter ( const DataWriterParameters parameters)
static

Factory method returning data writer instance for specified version.

Throws exception in case of problems, never returns zero pointer.

Parameters
parametersset of parameters needed to initiate DataWriter
Exceptions
std::exception(or sub-class) is thrown in case of problems.

Definition at line 170 of file ByteStreamDataWriter.cxx.

170  {
171  // initiate with production file name
172  if (parameters.theFNCB == nullptr)
173  return makeWriter(
174  parameters.version,
175  parameters.writingPath,
176  parameters.fileNameCore,
177  parameters.rPar,
178  parameters.fmdStrings,
179  parameters.maxFileNE,
180  parameters.maxFileMB,
181  parameters.startIndex,
182  parameters.compression,
183  parameters.compLevel);
184 
185  // initiate for user-defined file name
186  return makeWriter(
187  parameters.version,
188  parameters.writingPath,
189  parameters.theFNCB,
190  parameters.rPar,
191  parameters.project,
192  parameters.streamType,
193  parameters.streamName,
194  parameters.stream,
195  parameters.lumiBlockNumber,
196  parameters.applicationName,
197  parameters.fmdStrings,
198  parameters.maxFileNE,
199  parameters.maxFileMB,
200  parameters.compression,
201  parameters.compLevel);
202 }

◆ makeWriter() [2/3]

std::unique_ptr< ByteStreamDataWriter > ByteStreamDataWriter::makeWriter ( int  version,
const std::string &  writingPath,
boost::shared_ptr< EventStorage::FileNameCallback >  theFNCB,
const EventStorage::run_parameters_record &  rPar,
const std::string &  project,
const std::string &  streamType,
const std::string &  streamName,
const std::string &  stream,
unsigned int  lumiBlockNumber,
const std::string &  applicationName,
const std::vector< std::string > &  fmdStrings,
unsigned int  maxFileNE = 0,
unsigned int  maxFileMB = 0,
EventStorage::CompressionType  compression = EventStorage::NONE,
unsigned int  compLevel = 1 
)
static

Factory method returning data writer instance for specified version.

Throws exception in case of problems, never returns zero pointer.

Parameters
versionwriter version to instantiate, 0 for most current version, other supported values: 5 for run1-compatible output. Exception is thrown is version is not supported.
writingPathdirectory where to write data
theFNCBcallback method for generating file names
rParother parameters from IS including the run number
fmdStringsoptional vector of strings containing metadata
maxFileNEmax size of a file in number of data blocks (or events)
maxFileMBmax size of a file in MB. The file is closed before this limit is overrun.
startIndexinitial file sequence index
compressionCompression type
compLevelCompression level
Exceptions
std::exception(or sub-class) is thrown in case of problems.

Definition at line 112 of file ByteStreamDataWriter.cxx.

127 {
128  ByteStreamDataWriter* res = nullptr;
129  if (version == 0 or version == FILE_FORMAT_VERSION) {
130  // Use current version
131  res = new ByteStreamDataWriterCurrent(writingPath,
132  theFNCB,
133  rPar,
134  project,
135  streamType,
136  streamName,
137  stream,
138  lumiBlockNumber,
139  applicationName,
140  fmdStrings,
141  maxFileNE,
142  maxFileMB,
143  compression,
144  compLevel);
145  } else if (version == 5) {
146  // Run1 version
147  res = new ByteStreamDataWriterV5(writingPath,
148  theFNCB,
149  rPar,
150  project,
151  streamType,
152  streamName,
153  stream,
154  lumiBlockNumber,
155  applicationName,
156  fmdStrings,
157  maxFileNE,
158  maxFileMB,
159  compression,
160  compLevel);
161  } else {
162  // Unexpected something
163  versionException(version);
164  }
165 
166  return std::unique_ptr<ByteStreamDataWriter>(res);
167 }

◆ makeWriter() [3/3]

std::unique_ptr< ByteStreamDataWriter > ByteStreamDataWriter::makeWriter ( int  version,
const std::string &  writingPath,
const std::string &  fileNameCore,
const EventStorage::run_parameters_record &  rPar,
const std::vector< std::string > &  fmdStrings,
unsigned int  maxFileNE = 0,
unsigned int  maxFileMB = 0,
unsigned int  startIndex = 1,
EventStorage::CompressionType  compression = EventStorage::NONE,
unsigned int  compLevel = 1 
)
static

Factory method returning data writer instance for specified version.

Throws exception in case of problems, never returns zero pointer.

Parameters
versionwriter version to instantiate, 0 for most current version, other supported values: 5 for run1-compatible output. Exception is thrown if version is not supported.
writingPathdirectory where to write data
fileNameCorefile name not including the ending "._NNNN.data"
rParother parameters from IS including the run number
fmdStringsoptional vector of strings containing metadata
maxFileNEmax size of a file in number of data blocks (or events)
maxFileMBmax size of a file in MB. The file is closed before this limit is overrun.
startIndexinitial file sequence index
compressionCompression type
compLevelCompression level
Exceptions
std::exception(or sub-class) is thrown in case of problems.

Definition at line 69 of file ByteStreamDataWriter.cxx.

79 {
80  ByteStreamDataWriter* res = nullptr;
81  if (version == 0 or version == FILE_FORMAT_VERSION) {
82  // Use current version
83  res = new ByteStreamDataWriterCurrent(writingPath,
84  fileNameCore,
85  rPar,
86  fmdStrings,
87  maxFileNE,
88  maxFileMB,
89  startIndex,
91  compLevel);
92  } else if (version == 5) {
93  // Run1 version
94  res = new ByteStreamDataWriterV5(writingPath,
95  fileNameCore,
96  rPar,
97  fmdStrings,
98  maxFileNE,
99  maxFileMB,
100  startIndex,
101  compression,
102  compLevel);
103  } else {
104  // Unexpected something
105  versionException(version);
106  }
107 
108  return std::unique_ptr<ByteStreamDataWriter>(res);
109 }

◆ operator=()

ByteStreamDataWriter& ByteStreamDataWriter::operator= ( const ByteStreamDataWriter )
delete

◆ putData()

virtual EventStorage::DWError ByteStreamDataWriter::putData ( unsigned int  dataSize,
const void *  data 
)
pure virtual

Write a single block of data.

If one of the size limits would be exceeded, the current file will be closed and another one will be opened automatically.

Parameters
dataSizesize of the data block in bytes
datastart of the event data in memory

Implemented in ByteStreamDataWriterV5.


The documentation for this class was generated from the following files:
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
ByteStreamDataWriter::makeWriter
static std::unique_ptr< ByteStreamDataWriter > makeWriter(int version, const std::string &writingPath, const std::string &fileNameCore, const EventStorage::run_parameters_record &rPar, const std::vector< std::string > &fmdStrings, unsigned int maxFileNE=0, unsigned int maxFileMB=0, unsigned int startIndex=1, EventStorage::CompressionType compression=EventStorage::NONE, unsigned int compLevel=1)
Factory method returning data writer instance for specified version.
Definition: ByteStreamDataWriter.cxx:69
ByteStreamDataWriterV5
Implementation of ByteStreamDataWriter for version 5 (run1) of EventStorage.
Definition: ByteStreamDataWriterV5.h:24
project
T_ResultType project(ParameterMapping::type< N > parameter_map, const T_Matrix &matrix)
Definition: MeasurementSelector.h:142
get_generator_info.version
version
Definition: get_generator_info.py:33
AthenaPoolExample_Copy.streamName
string streamName
Definition: AthenaPoolExample_Copy.py:39
RunTileMonitoring.streamType
streamType
Definition: RunTileMonitoring.py:158
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
python.BeamSpotUpdate.compression
compression
Definition: BeamSpotUpdate.py:188
ByteStreamDataWriter
This class defines abstract interface for data writing.
Definition: ByteStreamDataWriter.h:41