10 #include "EventStorage/DataWriter.h"
14 void versionException(
int version) {
15 std::string
msg =
"Unexpected version number in ByteStreamDataWriter::makeWriter: " +
17 throw std::invalid_argument(
msg);
26 ByteStreamDataWriterCurrent(
const std::string& writingPath,
27 const std::string& fileNameCore,
28 const EventStorage::run_parameters_record& rPar,
29 const std::vector<std::string>& fmdStrings,
30 unsigned int maxFileNE,
31 unsigned int maxFileMB,
32 unsigned int startIndex,
34 unsigned int compLevel);
36 ByteStreamDataWriterCurrent(
const std::string& writingPath,
37 boost::shared_ptr<EventStorage::FileNameCallback> theFNCB,
38 const EventStorage::run_parameters_record& rPar,
43 unsigned int lumiBlockNumber,
44 const std::string& applicationName,
45 const std::vector<std::string>& fmdStrings,
46 unsigned int maxFileNE,
47 unsigned int maxFileMB,
49 unsigned int compLevel);
51 virtual ~ByteStreamDataWriterCurrent() {}
54 ByteStreamDataWriterCurrent(
const ByteStreamDataWriterCurrent&) =
delete;
55 ByteStreamDataWriterCurrent&
operator=(
const ByteStreamDataWriterCurrent&) =
delete;
59 virtual bool good()
const override;
63 std::unique_ptr<EventStorage::DataWriter> m_writer;
68 std::unique_ptr<ByteStreamDataWriter>
70 const std::string& writingPath,
71 const std::string& fileNameCore,
72 const EventStorage::run_parameters_record& rPar,
73 const std::vector<std::string>& fmdStrings,
74 unsigned int maxFileNE,
75 unsigned int maxFileMB,
76 unsigned int startIndex,
78 unsigned int compLevel)
83 res =
new ByteStreamDataWriterCurrent(writingPath,
108 return std::unique_ptr<ByteStreamDataWriter>(
res);
111 std::unique_ptr<ByteStreamDataWriter>
113 const std::string& writingPath,
114 boost::shared_ptr<EventStorage::FileNameCallback> theFNCB,
115 const EventStorage::run_parameters_record& rPar,
119 const std::string&
stream,
120 unsigned int lumiBlockNumber,
121 const std::string& applicationName,
122 const std::vector<std::string>& fmdStrings,
123 unsigned int maxFileNE,
124 unsigned int maxFileMB,
126 unsigned int compLevel)
131 res =
new ByteStreamDataWriterCurrent(writingPath,
166 return std::unique_ptr<ByteStreamDataWriter>(
res);
169 std::unique_ptr<ByteStreamDataWriter>
206 ByteStreamDataWriterCurrent::ByteStreamDataWriterCurrent(
const std::string& writingPath,
207 const std::string& fileNameCore,
208 const EventStorage::run_parameters_record& rPar,
209 const std::vector<std::string>& fmdStrings,
210 unsigned int maxFileNE,
211 unsigned int maxFileMB,
212 unsigned int startIndex,
214 unsigned int compLevel)
216 m_writer.reset(
new EventStorage::DataWriter(writingPath,
223 m_writer->setMaxFileNE(maxFileNE);
224 m_writer->setMaxFileMB(maxFileMB);
227 ByteStreamDataWriterCurrent::ByteStreamDataWriterCurrent(
const std::string& writingPath,
228 boost::shared_ptr<EventStorage::FileNameCallback> theFNCB,
229 const EventStorage::run_parameters_record& rPar,
233 const std::string&
stream,
234 unsigned int lumiBlockNumber,
235 const std::string& applicationName,
236 const std::vector<std::string>& fmdStrings,
237 unsigned int maxFileNE,
238 unsigned int maxFileMB,
240 unsigned int compLevel)
242 m_writer.reset(
new EventStorage::DataWriter(writingPath,
254 m_writer->setMaxFileNE(maxFileNE);
255 m_writer->setMaxFileMB(maxFileMB);
258 EventStorage::DWError
259 ByteStreamDataWriterCurrent::putData(
unsigned int dataSize,
const void *
data)
267 return m_writer->good();