diff --git a/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/ATLAS_CHECK_THREAD_SAFETY b/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..dbac30c32c93e16d5307b1ad170ea52496ea75d9 --- /dev/null +++ b/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Event/ByteStreamCnvSvcLegacy diff --git a/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/offline_EventStorage/v5_DataWriter.h b/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/offline_EventStorage/v5_DataWriter.h index 705d5240f931832a34eb9734062a2d9aa7bde89a..0d11bd1199cbfb093892309431a9f5ddabd875f7 100644 --- a/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/offline_EventStorage/v5_DataWriter.h +++ b/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/offline_EventStorage/v5_DataWriter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -44,7 +44,8 @@ namespace offline_EventStorage_v5 { class DataWriter : boost::noncopyable { public: - + using iovec_const = offline_EventStorage_v5::iovec_const; + /** constructor with metadata strings \param writingPath directory where to write data @@ -111,7 +112,7 @@ private: EventStorage::DWError putData_implementation(const unsigned int& entries, - const struct iovec * my_iovec, + const iovec_const * my_iovec, uint32_t& sizeToDisk, bool precompressed = false); @@ -191,7 +192,7 @@ public: \param locations of the data chunks */ EventStorage::DWError putPrecompressedData(const unsigned int& entries, - const struct iovec* my_iovec); + const iovec_const* my_iovec); /** @@ -224,7 +225,7 @@ public: \param my_iovec locations of the data chunks \param &sizeToDisk will be update with the actual chunck size on disk */ - EventStorage::DWError putData(const unsigned int& entries, const struct iovec* my_iovec, + EventStorage::DWError putData(const unsigned int& entries, const iovec_const* my_iovec, uint32_t& sizeToDisk); diff --git a/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/offline_EventStorage/v5_EventStorageRecords.h b/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/offline_EventStorage/v5_EventStorageRecords.h index fcb50b7ee9eccc6d7a93e80ac181b1eb850b5972..98b13ba81dacfdb9df4ebe834284f7e3877154a7 100644 --- a/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/offline_EventStorage/v5_EventStorageRecords.h +++ b/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/offline_EventStorage/v5_EventStorageRecords.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -32,6 +32,12 @@ namespace offline_EventStorage_v5 { + struct iovec_const + { + const void* iov_base; + size_t iov_len; + }; + enum CompressionType { NONE, RESERVED, UNKNOWN, ZLIB}; struct file_start_record diff --git a/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/offline_eformat/old/util.h b/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/offline_eformat/old/util.h index 439acee834e739f14b24ade740f9d3e4ebc915dc..721f501b3f99fa1d2ade59c3f6ca71ef41c96e1c 100644 --- a/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/offline_eformat/old/util.h +++ b/Event/ByteStreamCnvSvcLegacy/ByteStreamCnvSvcLegacy/offline_eformat/old/util.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef BYTESTREAMCNVSVC_OFFLINE_EFORMAT_OLD_UTIL_H @@ -39,7 +39,6 @@ namespace old { uint32_t convert_to_40(const uint32_t* src, uint32_t* dest, uint32_t max, eformat::CheckSum event_checksum = eformat::NO_CHECKSUM, eformat::CheckSum rob_checksum = eformat::NO_CHECKSUM); - }} // namespace offline_eformat::old #endif // BYTESTREAMCNVSVC_OFFLINE_EFORMAT_OLD_UTIL_H diff --git a/Event/ByteStreamCnvSvcLegacy/CMakeLists.txt b/Event/ByteStreamCnvSvcLegacy/CMakeLists.txt index 775000f22bbc8684cd26e7e4c3efdf39aeb1cc04..3c7f6ba094eedf0ed7ffca554aeb454c8799046e 100644 --- a/Event/ByteStreamCnvSvcLegacy/CMakeLists.txt +++ b/Event/ByteStreamCnvSvcLegacy/CMakeLists.txt @@ -19,5 +19,5 @@ atlas_add_library( ByteStreamCnvSvcLegacy INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${UUID_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/src/offline_EventStorage - LINK_LIBRARIES ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} + LINK_LIBRARIES CxxUtils ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} PRIVATE_LINK_LIBRARIES ${UUID_LIBRARIES} ${ZLIB_LIBRARIES} ) diff --git a/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_DataWriter.cxx b/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_DataWriter.cxx index a0c4d613be0d4d4ef8cb1cf336353010cf41d721..7fbbf10362e668adc55fc4f74700a6da4f8368d1 100644 --- a/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_DataWriter.cxx +++ b/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_DataWriter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include <time.h> @@ -214,16 +214,16 @@ void DataWriter::date_timeAsInt(uint32_t &getDate, uint32_t &getTime) const long a_time; time(&a_time); - struct tm* t; - t = localtime( &a_time); + struct tm t; + localtime_r( &a_time, &t); - getDate= 1000000*t->tm_mday+ - 10000*(1+t->tm_mon)+ - 1900+t->tm_year; + getDate= 1000000*t.tm_mday+ + 10000*(1+t.tm_mon)+ + 1900+t.tm_year; - getTime= 10000*t->tm_hour+ - 100*t->tm_min+ - t->tm_sec ; + getTime= 10000*t.tm_hour+ + 100*t.tm_min+ + t.tm_sec ; } @@ -278,8 +278,8 @@ DWError DataWriter::putData(const unsigned int& dataSize, const void *event) { uint32_t todisk; - struct iovec iov; - iov.iov_base = const_cast<void *>(event); + iovec_const iov; + iov.iov_base = event; iov.iov_len = dataSize; return this->putData(1, &iov, todisk); } @@ -293,13 +293,13 @@ DWError DataWriter::putData(const unsigned int& entries, const struct iovec * my DWError DataWriter::putData(const unsigned int& dataSize, const void *event, uint32_t& sizeToDisk){ - struct iovec iov; - iov.iov_base = const_cast<void *>(event); + iovec_const iov; + iov.iov_base = event; iov.iov_len = dataSize; return this->putData(1, &iov, sizeToDisk); } -DWError DataWriter::putData(const unsigned int& entries, const struct iovec * my_iovec, uint32_t& sizeToDisk){ +DWError DataWriter::putData(const unsigned int& entries, const iovec_const * my_iovec, uint32_t& sizeToDisk){ return this->putData_implementation(entries, my_iovec, sizeToDisk); } @@ -307,22 +307,22 @@ DWError DataWriter::putData(const unsigned int& entries, const struct iovec * my DWError DataWriter::putPrecompressedData(const unsigned int& dataSize, const void *event){ - struct iovec iov; - iov.iov_base = const_cast<void *>(event); + iovec_const iov; + iov.iov_base = event; iov.iov_len = dataSize; return this->putPrecompressedData(1, &iov); } DWError DataWriter::putPrecompressedData(const unsigned int& entries, - const struct iovec* my_iovec){ + const iovec_const* my_iovec){ uint32_t todisk; return this->putData_implementation(entries, my_iovec, todisk, true); } -DWError DataWriter::putData_implementation(const unsigned int& entries, const struct iovec * my_iovec, uint32_t& sizeToDisk, bool precompressed){ +DWError DataWriter::putData_implementation(const unsigned int& entries, const iovec_const * my_iovec, uint32_t& sizeToDisk, bool precompressed){ ERS_DEBUG(3,"DataWriter::putData called for an iovec."); if(!m_cFileOpen) openNextFile(); @@ -644,8 +644,8 @@ bool DataWriter::inTransition() const { void DataWriter::file_record(void *ri, const void *pi) { - uint32_t *record = (uint32_t *)ri; - uint32_t *pattern = (uint32_t *)pi; + uint32_t *record = reinterpret_cast<uint32_t *>(ri); + const uint32_t *pattern = reinterpret_cast<const uint32_t *>(pi); int size=pattern[1]; for(int i=0; i<size; i++) { diff --git a/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_ESCompression.cxx b/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_ESCompression.cxx index 0f7e42007c46a6253628eb4f13015ed1c750433c..244d1e61470642d4914213504ff36900d722b403 100644 --- a/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_ESCompression.cxx +++ b/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_ESCompression.cxx @@ -1,8 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +#define ZLIB_CONST #include "v5_ESCompression.h" #include "zlib.h" #include <string.h> @@ -62,7 +63,7 @@ namespace offline_EventStorage_v5{ void offline_EventStorage_v5::zlibcompress(offline_EventStorage_v5::CompressionBuffer& compressed, uint32_t& compressedsize, const uint32_t& entries, - const struct iovec* iov, + const struct iovec_const* iov, const uint32_t& totalsize, const uint32_t& level){ @@ -89,7 +90,7 @@ void offline_EventStorage_v5::zlibcompress(offline_EventStorage_v5::CompressionB for (unsigned int i=0; i < entries; ++i) { - strm.next_in = static_cast<Bytef*>(iov[i].iov_base); + strm.next_in = static_cast<const Bytef*>(iov[i].iov_base); strm.avail_in = iov[i].iov_len; int flush = ((i+1)==entries) ? Z_FINISH : Z_NO_FLUSH; diff --git a/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_ESCompression.h b/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_ESCompression.h index b544cc48b6cd9b44526d55d7c3e028ab27040c0d..36d8eb17e7108a2b7e9628b8621258a0620d45af 100644 --- a/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_ESCompression.h +++ b/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_ESCompression.h @@ -1,7 +1,7 @@ //Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -43,6 +43,8 @@ namespace offline_EventStorage_v5 { class CompressionBuffer{ public: + using iovec_const = offline_EventStorage_v5::iovec_const; + virtual ~CompressionBuffer() {}; /** @@ -103,7 +105,7 @@ namespace offline_EventStorage_v5 { void zlibcompress(CompressionBuffer& compressed, uint32_t& compressedsize, const uint32_t& entries, - const struct iovec* iov, + const struct iovec_const* iov, const uint32_t& totalsize, const uint32_t& level); diff --git a/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_EventStorageRecords.cxx b/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_EventStorageRecords.cxx index dcda26234279d54e08000813f8cc14cbd2124c68..da491b0215d1680f785ded77e51cca844562012e 100644 --- a/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_EventStorageRecords.cxx +++ b/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_EventStorageRecords.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // @@ -14,8 +14,8 @@ std::string offline_EventStorage_v5::string_record(void *ri, const void *pi) { std::ostringstream s; - uint32_t *record = (uint32_t *)ri; - uint32_t *pattern = (uint32_t *)pi; + uint32_t *record = reinterpret_cast<uint32_t *>(ri); + const uint32_t *pattern = reinterpret_cast<const uint32_t *>(pi); int size=pattern[1]; for(int i=0; i<size; i++) { @@ -55,8 +55,8 @@ std::string offline_EventStorage_v5::string_record(offline_EventStorage_v5::file void offline_EventStorage_v5::reset_record(void *ri, const void *pi) { - uint32_t *record = (uint32_t *)ri; - uint32_t *pattern = (uint32_t *)pi; + uint32_t *record = reinterpret_cast<uint32_t *>(ri); + const uint32_t *pattern = reinterpret_cast<const uint32_t *>(pi); int size=pattern[1]; for(int i=0; i<size; i++) record[i] = pattern[i]; diff --git a/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_Guid.cxx b/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_Guid.cxx index 57a29e3d6090f3a2b2a77b8cb13c770aa84cb7d7..8b4e4c8077521c93ce3014b6bb566742bf0eb685 100644 --- a/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_Guid.cxx +++ b/Event/ByteStreamCnvSvcLegacy/src/offline_EventStorage/v5_Guid.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ==================================================================== @@ -21,7 +21,7 @@ #include "uuid/uuid.h" -static const char* fmt_Guid = +static const char* const fmt_Guid = "%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX"; //{ 0x0,0x0,0x0,{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}}; @@ -50,7 +50,8 @@ void offline_poolCopy_v5::Guid::create(Guid& guid) { const std::string offline_poolCopy_v5::Guid::toString() const { char text[128]; ::snprintf(text, 128, fmt_Guid, - Data1, Data2, Data3, + static_cast<long unsigned int>(Data1), + Data2, Data3, Data4[0], Data4[1], Data4[2], Data4[3], Data4[4], Data4[5], Data4[6], Data4[7]); return text; @@ -62,8 +63,10 @@ const offline_poolCopy_v5::Guid& offline_poolCopy_v5::Guid::fromString(const std // integer or short. Hence one has to reserve a bit more space // otherwise the stack gets corrupted. unsigned char d[8]; - ::sscanf( source.c_str(), fmt_Guid, &Data1, &Data2, &Data3, + long unsigned int xData1; + ::sscanf( source.c_str(), fmt_Guid, &xData1, &Data2, &Data3, &Data4[0], &Data4[1], &Data4[2], &Data4[3], &d[0], &d[1], &d[2], &d[3]); + Data1 = xData1; //*(int*)&Data4[4] = *(int*)d; ::memcpy(Data4+4, d, 4); return *this; diff --git a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/util.cxx b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/util.cxx index d6a8bc68474127d9c5191fa25c24af6ab2c545a9..2240c1fe95217379321008491ae8062749c34c90 100644 --- a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/util.cxx +++ b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/util.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "ByteStreamCnvSvcLegacy/offline_eformat/old/util.h" diff --git a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_FullEventFragment.cxx b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_FullEventFragment.cxx index cbdbac2115a011e2b28650df2dd14e1b4cc9a925..d1de0cdb539c6e98f23a3dcc3064a4b69429e2e5 100644 --- a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_FullEventFragment.cxx +++ b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_FullEventFragment.cxx @@ -1,7 +1,7 @@ //Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -111,45 +111,10 @@ offline_eformat::v40_write::FullEventFragment::FullEventFragment () initialize(); } -offline_eformat::v40_write::FullEventFragment::FullEventFragment - (const offline_eformat::v40_write::FullEventFragment& other) -{ - *this = other; -} - offline_eformat::v40_write::FullEventFragment::~FullEventFragment() { } -offline_eformat::v40_write::FullEventFragment& - offline_eformat::v40_write::FullEventFragment::operator= -(const offline_eformat::v40_write::FullEventFragment& other) -{ - if (this != &other) { - initialize(); - copy_header(other); - //copy extra payload attached - if (other.m_node[10].size_word) { - m_node[9].next = &m_node[10]; - set(m_node[10], other.m_node[10].base, other.m_node[10].size_word, 0); - } - //copy the ROBFragments attached - for (const v40_write::ROBFragment* - it = other.m_child; it; it = it->next()) - append(const_cast<v40_write::ROBFragment*>(it)); - //get the unchecked ROB fragments attached - if (m_n_unchecked) { - m_n_unchecked = other.m_n_unchecked; - for (uint32_t i=0; i < m_n_unchecked; ++i) { - set(m_unchecked[i], other.m_unchecked[i].base, - other.m_unchecked[i].size_word, &m_unchecked[i+1]); - } - m_unchecked[m_n_unchecked-1].next = 0; - } - } - return *this; -} - void offline_eformat::v40_write::FullEventFragment::copy_header(const uint32_t* other) { v40::FullEventFragment read(other); @@ -210,7 +175,10 @@ void offline_eformat::v40_write::FullEventFragment::status m_node[1].size_word = m_node[0].base[5] = n; //set new values m_node[0].base[1] += n; m_node[0].base[2] += n; - m_node[1].base = const_cast<uint32_t*>(status); + // FIXME: I'm assuming that these are ok. + // Probably can't avoid this as long as we're using node_t from eformat. + uint32_t* status_nc ATLAS_THREAD_SAFE = const_cast<uint32_t*>(status); + m_node[1].base = status_nc; } void offline_eformat::v40_write::FullEventFragment::lvl1_trigger_info @@ -221,7 +189,10 @@ void offline_eformat::v40_write::FullEventFragment::lvl1_trigger_info m_node[3].size_word = m_node[2].base[10] = n; //set new values m_node[0].base[1] += n; //fragment size m_node[0].base[2] += n; //header size - m_node[3].base = const_cast<uint32_t*>(data); + // FIXME: I'm assuming that these are ok. + // Probably can't avoid this as long as we're using node_t from eformat. + uint32_t* data_nc ATLAS_THREAD_SAFE = const_cast<uint32_t*>(data); + m_node[3].base = data_nc; } void offline_eformat::v40_write::FullEventFragment::lvl2_trigger_info @@ -232,7 +203,10 @@ void offline_eformat::v40_write::FullEventFragment::lvl1_trigger_info m_node[5].size_word = m_node[4].base[0] = n; //set new values m_node[0].base[1] += n; //fragment size m_node[0].base[2] += n; //header size - m_node[5].base = const_cast<uint32_t*>(data); + // FIXME: I'm assuming that these are ok. + // Probably can't avoid this as long as we're using node_t from eformat. + uint32_t* data_nc ATLAS_THREAD_SAFE = const_cast<uint32_t*>(data); + m_node[5].base = data_nc; } void offline_eformat::v40_write::FullEventFragment::event_filter_info @@ -243,7 +217,10 @@ void offline_eformat::v40_write::FullEventFragment::event_filter_info m_node[7].size_word = m_node[6].base[0] = n; //set new values m_node[0].base[1] += n; //fragment size m_node[0].base[2] += n; //header size - m_node[7].base = const_cast<uint32_t*>(data); + // FIXME: I'm assuming that these are ok. + // Probably can't avoid this as long as we're using node_t from eformat. + uint32_t* data_nc ATLAS_THREAD_SAFE = const_cast<uint32_t*>(data); + m_node[7].base = data_nc; } void offline_eformat::v40_write::FullEventFragment::stream_tag @@ -254,7 +231,10 @@ void offline_eformat::v40_write::FullEventFragment::stream_tag m_node[9].size_word = m_node[8].base[0] = n; //set new values m_node[0].base[1] += n; //fragment size m_node[0].base[2] += n; //header size - m_node[9].base = const_cast<uint32_t*>(data); + // FIXME: I'm assuming that these are ok. + // Probably can't avoid this as long as we're using node_t from eformat. + uint32_t* data_nc ATLAS_THREAD_SAFE = const_cast<uint32_t*>(data); + m_node[9].base = data_nc; } void offline_eformat::v40_write::FullEventFragment::append @@ -299,9 +279,8 @@ offline_eformat::v40_write::FullEventFragment::bind (void) last->next = 0; //potentially remove old checksum //iterate over the attached children - for (v40_write::ROBFragment* curr = m_child; curr; - curr = const_cast<v40_write::ROBFragment*>(curr->next())) { - last->next = const_cast<eformat::write::node_t*>(curr->bind()); + for (v40_write::ROBFragment* curr = m_child; curr; curr = curr->next()) { + last->next = curr->bind(); while (last->next) last = last->next; //advance until end } diff --git a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_FullEventFragment.h b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_FullEventFragment.h index 000dc21952061601d5e83192c93cda395360c3b4..f7ffa3d0595cb3534b3dce16d478dc9f4b392bca 100644 --- a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_FullEventFragment.h +++ b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_FullEventFragment.h @@ -1,7 +1,7 @@ //Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -19,6 +19,7 @@ #define OFFLINE_EFORMAT_V40_WRITE_FULLEVENTFRAGMENT_H #include "v40_write_ROBFragment.h" +#include "CxxUtils/checker_macros.h" #include <cstring> namespace offline_eformat { @@ -34,8 +35,8 @@ namespace offline_eformat { /** * Defines a helper class to aid the creation of FullEvent fragments. */ - class FullEventFragment { - + class FullEventFragment + { public: /** @@ -74,37 +75,14 @@ namespace offline_eformat { */ FullEventFragment (); - /** - * Copy constructor. This will only copy the meta data, not the fragment - * relationships and block-data (children and status block) contained in - * the to-be-copied fragment. If you wish this fragment to have the same - * children of the copied fragment, you have to do this operation - * manually, after copying. If you wish to make a copy of the status as - * well, do it manually and then assign it to this fragment using the - * status() method. - * - * @param other The other fragment to take the meta data from. - */ - FullEventFragment (const FullEventFragment& other); + FullEventFragment (const FullEventFragment& other) = delete; + FullEventFragment& operator= (const FullEventFragment& other) = delete; /** * Base destructor */ virtual ~FullEventFragment (); - /** - * Assigment operator. This will only copy the meta data, not the - * fragment relationships and block-data (children and parent and status - * block) contained in the to-be-copied fragment. If you wish this - * fragment has the same parents, and children of the copied fragment, - * you have to do this operation manually, after copying. If you wish to - * make a copy of the status as well, do it manually and then assign it - * to this fragment using the status() method. - * - * @param other The other fragment to take the meta data from. - */ - FullEventFragment& operator= (const FullEventFragment& other); - /** * Copies the header (meta data information) from another existing * FullEvent Fragment. Please note that this will not copy any specificy diff --git a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_ROBFragment.cxx b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_ROBFragment.cxx index b6b9fc783593d6966eff2110be3e4e328fb93c70..e0c7ddca6fa1c738f3c49da02f0f161b96faf95d 100644 --- a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_ROBFragment.cxx +++ b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_ROBFragment.cxx @@ -1,7 +1,7 @@ //Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -22,6 +22,7 @@ #include "eformat/Status.h" #include "eformat/Issue.h" #include "eformat/checksum.h" +#include "CxxUtils/checker_macros.h" #include <cstring> static const unsigned int ROB_HEADER = 0; @@ -279,7 +280,10 @@ void offline_eformat::v40_write::ROBFragment::status (uint32_t n, const uint32_t m_node[ROB_STATUS].size_word = m_node[ROB_HEADER].base[5] = n; //set new values m_node[ROB_HEADER].base[1] += n; m_node[ROB_HEADER].base[2] += n; - m_node[ROB_STATUS].base = const_cast<uint32_t*>(status); + // FIXME: I'm assuming that these are ok. + // Probably can't avoid this as long as we're using node_t from eformat. + uint32_t* status_nc ATLAS_THREAD_SAFE = const_cast<uint32_t*>(status); + m_node[ROB_STATUS].base = status_nc; } void offline_eformat::v40_write::ROBFragment::rod_status (uint32_t n, @@ -290,7 +294,10 @@ void offline_eformat::v40_write::ROBFragment::rod_status (uint32_t n, m_node[ROB_HEADER].base[1] -= m_node[ROD_TRAILER].base[0]; //remove count from previous status m_node[ROD_STATUS].size_word = m_node[ROD_TRAILER].base[0] = n; //set new values m_node[ROB_HEADER].base[1] += n; //set ROB header's total fragment size - m_node[ROD_STATUS].base = const_cast<uint32_t*>(status); + // FIXME: I'm assuming that these are ok. + // Probably can't avoid this as long as we're using node_t from eformat. + uint32_t* status_nc ATLAS_THREAD_SAFE = const_cast<uint32_t*>(status); + m_node[ROD_STATUS].base = status_nc; } void offline_eformat::v40_write::ROBFragment::status_position (uint32_t v) @@ -318,7 +325,10 @@ void offline_eformat::v40_write::ROBFragment::rod_data (uint32_t n, const uint32 m_node[ROB_HEADER].base[1] -= m_node[ROD_TRAILER].base[1]; m_node[ROD_DATA].size_word = m_node[ROD_TRAILER].base[1] = n; //set new values m_node[ROB_HEADER].base[1] += n; //set ROB header's total fragment size back - m_node[ROD_DATA].base = const_cast<uint32_t*>(data); + // FIXME: I'm assuming that these are ok. + // Probably can't avoid this as long as we're using node_t from eformat. + uint32_t* data_nc ATLAS_THREAD_SAFE = const_cast<uint32_t*>(data); + m_node[ROD_DATA].base = data_nc; } void offline_eformat::v40_write::ROBFragment::checksum_type(uint32_t s) @@ -345,7 +355,7 @@ const eformat::write::node_t* offline_eformat::v40_write::ROBFragment::rod_bind( return &m_node[ROD_HEADER]; } -const eformat::write::node_t* offline_eformat::v40_write::ROBFragment::bind(void) +eformat::write::node_t* offline_eformat::v40_write::ROBFragment::bind(void) { m_node[ROD_TRAILER].next = 0; //cuts off the checksum word m_node[ROB_CHECKSUM].next = 0; //cuts off relation ships with other fragments diff --git a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_ROBFragment.h b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_ROBFragment.h index e23d51443ec231b85621587bf78493a94f753cfb..5cf633233123fc1cfe36617d73f3dd229df53fde 100644 --- a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_ROBFragment.h +++ b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v40_write_ROBFragment.h @@ -1,7 +1,7 @@ //Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -20,6 +20,7 @@ #include "eformat/write/node.h" #include "eformat/Version.h" +#include "CxxUtils/checker_macros.h" namespace offline_eformat { @@ -30,8 +31,8 @@ namespace offline_eformat { /** * Defines a helper class to aid the creation of ROB fragments. */ - class ROBFragment { - + class ROBFragment + { public: /** @@ -477,7 +478,7 @@ namespace offline_eformat { * Outputs a concatenation of eformat::write::node making up a list with * the contents of this ROB fragment. */ - const eformat::write::node_t* bind (void); + eformat::write::node_t* bind (void); /** * Outputs a concatenation of eformat::write::node making up a list with @@ -503,12 +504,13 @@ namespace offline_eformat { * * @param n The sibling following this fragment */ - inline void next (const ROBFragment* n) { m_next = n; } + inline void next (ROBFragment* n) { m_next = n; } /** * Returns the next sibling */ inline const ROBFragment* next (void) const { return m_next; } + inline ROBFragment* next (void) { return m_next; } private: //to make the code simpler @@ -526,7 +528,7 @@ namespace offline_eformat { uint32_t m_checksum; ///< The ROB trailer eformat::write::node_t m_node[8]; ///< Node representation v40_write::FullEventFragment* m_parent; ///< My parent - const v40_write::ROBFragment* m_next; ///< Next sibling + v40_write::ROBFragment* m_next; ///< Next sibling }; diff --git a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v50_util.cxx b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v50_util.cxx index 3c6ae7953469c04d156e5ddc002389371c278d69..11415ac1352f61971f66c8e8fa14564f5b1e7559 100644 --- a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v50_util.cxx +++ b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v50_util.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include <algorithm> @@ -42,6 +42,7 @@ namespace v50 { uint32_t convert_to_40(const uint32_t* src, uint32_t* dest, uint32_t max, eformat::CheckSum event_checksum, eformat::CheckSum rob_checksum) + { // this has to do the opposite of what eformat::v40::convert // is doing (for current = v50). diff --git a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v50_util.h b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v50_util.h index 7ee6868f802f3e83953255d30596d17c982ea129..8520b5c050c68f8374a95f90601921f911413cf0 100644 --- a/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v50_util.h +++ b/Event/ByteStreamCnvSvcLegacy/src/offline_eformat/old/v50_util.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef BYTESTREAMCNVSVC_OFFLINE_EFORMAT_OLD_V50_UTIL_H @@ -22,7 +22,6 @@ namespace v50 { uint32_t convert_to_40(const uint32_t* src, uint32_t* dest, uint32_t max, eformat::CheckSum event_checksum=eformat::NO_CHECKSUM, eformat::CheckSum rob_checksum=eformat::NO_CHECKSUM); - }} // namespace offline_eformat::V50 #endif // BYTESTREAMCNVSVC_EFORMAT_OLD_V50_UTIL_H