17#ifndef OFFLINE_EVENTSTORAGE_V5_DATAWRITER_H
18#define OFFLINE_EVENTSTORAGE_V5_DATAWRITER_H
25#include <boost/shared_ptr.hpp>
26#include <boost/utility.hpp>
28#include "EventStorage/DWError.h"
30#include "EventStorage/FileNameCallback.h"
31#include "EventStorage/RawFileName.h"
35 class DataWriterCallBack;
60 const std::string& fileNameCore,
62 const std::vector<std::string>& fmdStrings,
63 const unsigned int startIndex = 1,
65 const unsigned int compLevel = 1);
70 boost::shared_ptr<EventStorage::FileNameCallback> theFNCB,
73 const std::string& streamType,
74 const std::string& streamName,
75 const std::string& stream,
76 const unsigned int lumiBlockNumber,
77 const std::string& applicationName,
78 const std::vector<std::string>& fmdStrings,
80 const unsigned int compLevel = 1);
83 const std::string& fileNameCore,
86 const std::string& streamType,
87 const std::string& streamName,
88 const std::string& stream,
89 const unsigned int lumiBlockNumber,
90 const std::string& applicationName,
91 const std::vector<std::string>& fmdStrings,
93 const unsigned int compLevel = 1);
100 void initDW(
const std::string& writingPath,
101 boost::shared_ptr<EventStorage::FileNameCallback> theFNCB,
104 const std::string& streamType,
105 const std::string& streamName,
106 const std::string& stream,
107 const unsigned int lumiBlockNumber,
108 const std::string& applicationName,
109 const std::vector<std::string>& fmdStrings,
111 const unsigned int compLevel);
116 uint32_t& sizeToDisk,
117 bool precompressed =
false);
129 EventStorage::DWError
setMaxFileNE(
const unsigned int& maxFileNE);
134 EventStorage::DWError
setMaxFileMB(
const unsigned int& maxFileMB);
150 void cd(
const std::string& writingPath);
166 EventStorage::DWError
putData(
const unsigned int& dataSize,
const void *event);
206 EventStorage::DWError
putData(
const unsigned int&
entries,
const struct iovec* my_iovec);
217 EventStorage::DWError
putData(
const unsigned int& dataSize,
const void *event, uint32_t& sizeToDisk);
229 uint32_t& sizeToDisk);
283 bool fileExists(
const std::string& name)
const;
292 std::string
getAppName(
const std::string& fileNameCore)
const;
294 const std::string& element)
const;
295 uint64_t
getFileSize(
const std::string& fileNameCore)
const;
T_ResultType project(ParameterMapping::type< N > parameter_map, const T_Matrix &matrix)
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
DataWriter(const std::string &writingPath, const std::string &fileNameCore, const run_parameters_record &rPar, const std::vector< std::string > &fmdStrings, const unsigned int startIndex=1, const CompressionType compression=NONE, const unsigned int compLevel=1)
constructor with metadata strings
freeMetaDataStrings m_fmdStrings
void date_timeAsInt(uint32_t &getDate, uint32_t &getTime) const
void initDW(const std::string &writingPath, boost::shared_ptr< EventStorage::FileNameCallback > theFNCB, const run_parameters_record &rPar, const std::string &project, const std::string &streamType, const std::string &streamName, const std::string &stream, const unsigned int lumiBlockNumber, const std::string &applicationName, const std::vector< std::string > &fmdStrings, const CompressionType compression, const unsigned int compLevel)
EventStorage::DWError putPrecompressedData(const unsigned int &dataSize, const void *event)
Write a single block of data already compressed.
EventStorage::DWError setMaxFileMB(const unsigned int &maxFileMB)
max size of 1 file in MB.
EventStorage::DWError putData_implementation(const unsigned int &entries, const iovec_const *my_iovec, uint32_t &sizeToDisk, bool precompressed=false)
void registerCallBack(EventStorage::DataWriterCallBack *pUserCBclass)
If you want to define actions to be taken when a file is open or closed register your call-back class...
internal_run_parameters_record m_internal_run_parameters_record
void file_record(void *ri, const void *pi)
std::string nameFile(const FileStatus &fs) const
get the name of the current file
file_name_strings m_file_name_strings
std::string getElement(const std::string &fileNameCore, const std::string &element) const
EventStorage::DataWriterCallBack * m_callBack
EventStorage::DWError closeFile()
Close the currently open file.
offline_EventStorage_v5::iovec_const iovec_const
unsigned int m_lumiBlockNumber
file_end_record m_file_end_record
~DataWriter()
destructor, the way to close the sequence of files
unsigned int dataMB_InFileSequence() const
number of mega bytes written to the file sequence
void setGUID(const std::string &GUID)
Set the GUID for the next file in this sequence.
bool fileExists(const std::string &name) const
file_start_record m_file_start_record
void cd(const std::string &writingPath)
set another writing path
std::string getAppName(const std::string &fileNameCore) const
bool good() const
feedback to user
EventStorage::DWError setMaxFileNE(const unsigned int &maxFileNE)
max size of 1 file in number of data blocks (or events) 1 putData call is one block
DataWriter(const std::string &writingPath, boost::shared_ptr< EventStorage::FileNameCallback > theFNCB, const run_parameters_record &rPar, const std::string &project, const std::string &streamType, const std::string &streamName, const std::string &stream, const unsigned int lumiBlockNumber, const std::string &applicationName, const std::vector< std::string > &fmdStrings, const CompressionType compression=NONE, const unsigned int compLevel=1)
uint64_t getFileSize(const std::string &fileNameCore) const
DataBuffer * m_compressed
std::string m_nextWritePath
unsigned int dataMB_InFile() const
number of mega bytes written to the current file
unsigned int eventsInFileSequence() const
number of events written to the file sequence
int64_t getPosition() const
get the offset of the latest written event; one should call it AFTER putData(...)
void setGuid(const std::string &Guid)
Externally set the GUID for the next file in this sequence.
boost::shared_ptr< EventStorage::FileNameCallback > m_filenamecallback
void setRunParamsRecord(const run_parameters_record &rPar)
CompressionType getCompression() const
Returns the compression type for this file.
bool inTransition() const
The file currently open is not closed immediately after cd() this method will return true if we are i...
std::string m_fileNameCore
EventStorage::DWError putData(const unsigned int &dataSize, const void *event)
Write a single block of data.
CompressionType m_compression
std::string m_applicationName
EventStorage::DWError nextFile()
close the file and open next one immediately
unsigned int eventsInFile() const
number of events written to the currently open file
std::vector< std::string > freeMetaDataStrings