From 72034fd98a243e9779e5d3d5e374759240d67c73 Mon Sep 17 00:00:00 2001 From: carltimmer Date: Thu, 29 Aug 2024 13:06:50 -0400 Subject: [PATCH] remove const when used with shared_ptr since it did not prevent from the object being pointed to from being changed (only pointer encapsulated by shared_ptr itself) --- src/libsrc++/BaseStructure.cpp | 22 ++++++++-------- src/libsrc++/BaseStructure.h | 24 +++++++++--------- src/libsrc++/BaseStructureHeader.cpp | 2 +- src/libsrc++/BaseStructureHeader.h | 2 +- src/libsrc++/ByteBuffer.cpp | 8 +++--- src/libsrc++/ByteBuffer.h | 8 +++--- src/libsrc++/EventParser.cpp | 24 +++++++++--------- src/libsrc++/EventParser.h | 22 ++++++++-------- src/libsrc++/EventWriter.cpp | 6 ++--- src/libsrc++/EventWriter.h | 6 ++--- src/libsrc++/EvioBank.h | 4 +-- src/libsrc++/EvioCompactReaderV4.cpp | 2 +- src/libsrc++/EvioEvent.h | 4 +-- src/libsrc++/EvioNode.cpp | 2 +- src/libsrc++/EvioNode.h | 2 +- src/libsrc++/EvioReaderV4.cpp | 3 +-- src/libsrc++/EvioSegment.h | 4 +-- src/libsrc++/EvioTagSegment.h | 4 +-- src/libsrc++/Reader.cpp | 2 +- src/libsrc++/RecordHeader.cpp | 10 ++++---- src/libsrc++/RecordHeader.h | 10 ++++---- src/libsrc++/RecordOutput.cpp | 2 +- src/libsrc++/RecordOutput.h | 2 +- src/libsrc++/StructureTransformer.h | 38 ++++++++++++++-------------- src/libsrc++/Util.h | 2 +- 25 files changed, 107 insertions(+), 108 deletions(-) diff --git a/src/libsrc++/BaseStructure.cpp b/src/libsrc++/BaseStructure.cpp index 872370ae1..d6e0611d9 100644 --- a/src/libsrc++/BaseStructure.cpp +++ b/src/libsrc++/BaseStructure.cpp @@ -162,7 +162,7 @@ namespace evio { * * @param structure BaseStructure from which to copy data. */ - void BaseStructure::transform(std::shared_ptr const structure) { + void BaseStructure::transform(std::shared_ptr structure) { DataType dataType = structure->getHeader()->getDataType(); copyData(structure); @@ -269,7 +269,7 @@ namespace evio { * Copy just the data of another structure. * @param other structure to copy data from. */ - void BaseStructure::copyData(std::shared_ptr const other) { + void BaseStructure::copyData(std::shared_ptr other) { // Copy over raw data rawBytes = other->rawBytes; @@ -385,7 +385,7 @@ namespace evio { * or this node does not allow children. * @see #isNodeDescendant */ - void BaseStructure::insert(const std::shared_ptr newChild, size_t childIndex) { + void BaseStructure::insert(std::shared_ptr newChild, size_t childIndex) { if (!allowsChildren) { throw EvioException("node does not allow children"); } @@ -488,7 +488,7 @@ namespace evio { * array, or -1 if the specified node is a not * a child of this node. */ - ssize_t BaseStructure::getIndex(const std::shared_ptr aChild) { + ssize_t BaseStructure::getIndex(std::shared_ptr aChild) { if (aChild == nullptr) { throw EvioException("argument is null"); } @@ -587,7 +587,7 @@ namespace evio { * @param aChild a child of this node to remove * @throws EvioException if aChild is not a child of this node */ - void BaseStructure::remove(const std::shared_ptr aChild) { + void BaseStructure::remove(std::shared_ptr aChild) { if (!isNodeChild(aChild)) { throw EvioException("argument is not a child"); } @@ -643,7 +643,7 @@ namespace evio { * @param anotherNode node to test as an ancestor of this node * @return true if this node is a descendant of anotherNode */ - bool BaseStructure::isNodeAncestor(const std::shared_ptr anotherNode) const { + bool BaseStructure::isNodeAncestor(std::shared_ptr anotherNode) const { if (anotherNode == nullptr) { return false; } @@ -837,7 +837,7 @@ namespace evio { * specified node. */ std::vector> BaseStructure::getPathToRoot ( - const std::shared_ptr aNode, int depth) const { + std::shared_ptr aNode, int depth) const { // Check for null, in case someone passed in a null node, or // they passed in an element that isn't rooted at root. @@ -977,7 +977,7 @@ namespace evio { * @return true if aNode is a child of this node; false if * aNode is null. */ - bool BaseStructure::isNodeChild(const std::shared_ptr aNode) const { + bool BaseStructure::isNodeChild(std::shared_ptr aNode) const { bool retval; if (aNode == nullptr) { @@ -1044,7 +1044,7 @@ namespace evio { * @return the child of this node that immediately follows * aChild. */ - std::shared_ptr BaseStructure::getChildAfter(const std::shared_ptr aChild) { + std::shared_ptr BaseStructure::getChildAfter(std::shared_ptr aChild) { if (aChild == nullptr) { throw EvioException("argument is null"); } @@ -1077,7 +1077,7 @@ namespace evio { * is not a child of this node. * @return the child of this node that immediately precedes aChild. */ - std::shared_ptr BaseStructure::getChildBefore(const std::shared_ptr aChild) { + std::shared_ptr BaseStructure::getChildBefore(std::shared_ptr aChild) { if (aChild == nullptr) { throw EvioException("argument is null"); } @@ -1112,7 +1112,7 @@ namespace evio { * @throws EvioException if sibling has different parent. * @return true if anotherNode is a sibling of this node. */ - bool BaseStructure::isNodeSibling(const std::shared_ptr anotherNode) const { + bool BaseStructure::isNodeSibling(std::shared_ptr anotherNode) const { bool retval; if (anotherNode == nullptr) { diff --git a/src/libsrc++/BaseStructure.h b/src/libsrc++/BaseStructure.h index 7d7c5041e..6e0048d74 100644 --- a/src/libsrc++/BaseStructure.h +++ b/src/libsrc++/BaseStructure.h @@ -419,11 +419,11 @@ namespace evio { protected: - void setParent(const std::shared_ptr newParent); + void setParent(std::shared_ptr newParent); public: - void insert(const std::shared_ptr newChild, size_t childIndex); + void insert(std::shared_ptr newChild, size_t childIndex); void remove(size_t childIndex); std::shared_ptr getParent() const; @@ -431,7 +431,7 @@ namespace evio { std::shared_ptr getChildAt(size_t index) const; size_t getChildCount() const; - ssize_t getIndex(const std::shared_ptr aChild); + ssize_t getIndex(std::shared_ptr aChild); std::vector>::iterator childrenBegin(); std::vector>::iterator childrenEnd(); @@ -443,7 +443,7 @@ namespace evio { // void removeFromParent(); - void remove(const std::shared_ptr aChild); + void remove(std::shared_ptr aChild); void removeAllChildren(); void add(std::shared_ptr newChild); @@ -451,7 +451,7 @@ namespace evio { // Tree Queries // - bool isNodeAncestor(const std::shared_ptr anotherNode) const; + bool isNodeAncestor(std::shared_ptr anotherNode) const; bool isNodeDescendant(std::shared_ptr anotherNode); std::shared_ptr getSharedAncestor(std::shared_ptr aNode); bool isNodeRelated(std::shared_ptr aNode); @@ -461,7 +461,7 @@ namespace evio { protected: - std::vector> getPathToRoot(const std::shared_ptr aNode, int depth) const; + std::vector> getPathToRoot(std::shared_ptr aNode, int depth) const; public: @@ -474,17 +474,17 @@ namespace evio { // Child Queries // - bool isNodeChild(const std::shared_ptr aNode) const; + bool isNodeChild(std::shared_ptr aNode) const; std::shared_ptr getFirstChild() const; std::shared_ptr getLastChild() const; - std::shared_ptr getChildAfter(const std::shared_ptr aChild); - std::shared_ptr getChildBefore(const std::shared_ptr aChild); + std::shared_ptr getChildAfter(std::shared_ptr aChild); + std::shared_ptr getChildBefore(std::shared_ptr aChild); // // Sibling Queries // - bool isNodeSibling(const std::shared_ptr anotherNode) const; + bool isNodeSibling(std::shared_ptr anotherNode) const; size_t getSiblingCount() const; std::shared_ptr getNextSibling(); std::shared_ptr getPreviousSibling(); @@ -622,7 +622,7 @@ namespace evio { void clearData(); void copyData(BaseStructure const & other); - void copyData(std::shared_ptr const other); + void copyData(std::shared_ptr other); protected: @@ -637,7 +637,7 @@ namespace evio { public: - void transform(std::shared_ptr const structure); + void transform(std::shared_ptr structure); virtual StructureType getStructureType() const {return StructureType::STRUCT_UNKNOWN32;}; diff --git a/src/libsrc++/BaseStructureHeader.cpp b/src/libsrc++/BaseStructureHeader.cpp index 43196ccc0..b783ee60f 100644 --- a/src/libsrc++/BaseStructureHeader.cpp +++ b/src/libsrc++/BaseStructureHeader.cpp @@ -30,7 +30,7 @@ namespace evio { * Method to copy data from the fiven header to this one. * @param head header to copy data from (source). */ - void BaseStructureHeader::copy(std::shared_ptr const head) { + void BaseStructureHeader::copy(std::shared_ptr head) { tag = head->tag; dataType = head->dataType; number = head->number; diff --git a/src/libsrc++/BaseStructureHeader.h b/src/libsrc++/BaseStructureHeader.h index afecf79cc..bd464d917 100644 --- a/src/libsrc++/BaseStructureHeader.h +++ b/src/libsrc++/BaseStructureHeader.h @@ -75,7 +75,7 @@ namespace evio { protected: void setPadding(uint8_t pad); - void copy(std::shared_ptr const head); + void copy(std::shared_ptr head); public: diff --git a/src/libsrc++/ByteBuffer.cpp b/src/libsrc++/ByteBuffer.cpp index dacd16948..2f61dd73d 100644 --- a/src/libsrc++/ByteBuffer.cpp +++ b/src/libsrc++/ByteBuffer.cpp @@ -244,7 +244,7 @@ namespace evio { * Copy data and everything else from arg. * @param srcBuf ByteBuffer to copy. */ - void ByteBuffer::copy(const std::shared_ptr srcBuf) { + void ByteBuffer::copy(std::shared_ptr srcBuf) { return copy(*(srcBuf.get())); } @@ -254,7 +254,7 @@ namespace evio { * @param srcBuf ByteBuffer to copy. * @return new ByteBuffer. */ - std::shared_ptr ByteBuffer::copyBuffer(const std::shared_ptr srcBuf) { + std::shared_ptr ByteBuffer::copyBuffer(std::shared_ptr srcBuf) { auto newBuf = std::make_shared(srcBuf->totalSize); newBuf->pos = srcBuf->pos; @@ -280,7 +280,7 @@ namespace evio { * @param position position in srcByf to start from. * @param limit position in srcByf to end at. */ - void ByteBuffer::copyData(const std::shared_ptr srcBuf, size_t position, size_t limit) { + void ByteBuffer::copyData(std::shared_ptr srcBuf, size_t position, size_t limit) { // How many bytes do we copy? size_t newSize = limit - position; @@ -1361,7 +1361,7 @@ namespace evio { * @throws overflow_error if insufficient space in this buffer * for the remaining bytes in the source buffer. */ - ByteBuffer & ByteBuffer::put(const std::shared_ptr src) { + ByteBuffer & ByteBuffer::put(std::shared_ptr src) { return (put(*(src.get()))); } diff --git a/src/libsrc++/ByteBuffer.h b/src/libsrc++/ByteBuffer.h index b6605640e..043bdb5b8 100644 --- a/src/libsrc++/ByteBuffer.h +++ b/src/libsrc++/ByteBuffer.h @@ -108,10 +108,10 @@ namespace evio { ByteBuffer & compact(); ByteBuffer & zero(); - static std::shared_ptr copyBuffer(const std::shared_ptr srcBuf); - void copyData(const std::shared_ptr srcBuf, size_t pos, size_t limit); + static std::shared_ptr copyBuffer(std::shared_ptr srcBuf); + void copyData(std::shared_ptr srcBuf, size_t pos, size_t limit); void copy(const ByteBuffer & srcBuf); - void copy(const std::shared_ptr srcBuf); + void copy(std::shared_ptr srcBuf); bool equals(const ByteBuffer & other); void expand(size_t newSize); @@ -181,7 +181,7 @@ namespace evio { // Bulk byte writes ByteBuffer & put(const ByteBuffer & src); - ByteBuffer & put(const std::shared_ptr rc); + ByteBuffer & put(std::shared_ptr rc); ByteBuffer & put(const uint8_t * src, size_t length); ByteBuffer & put(const std::vector & src, size_t offset, size_t length); diff --git a/src/libsrc++/EventParser.cpp b/src/libsrc++/EventParser.cpp index 2344dfcea..528ca8973 100644 --- a/src/libsrc++/EventParser.cpp +++ b/src/libsrc++/EventParser.cpp @@ -461,8 +461,8 @@ namespace evio { * @param structure the structure to start scanning. * @param listener an listener to notify as each structure is visited. */ - void EventParser::vistAllStructures(std::shared_ptr const structure, - std::shared_ptr const listener) { + void EventParser::vistAllStructures(std::shared_ptr structure, + std::shared_ptr listener) { visitAllDescendants(structure, structure, listener, nullptr); } @@ -478,9 +478,9 @@ namespace evio { * structures are passed. In this way, specific types of * structures can be captured. */ - void EventParser::vistAllStructures(std::shared_ptr const structure, - std::shared_ptr const listener, - std::shared_ptr const filter) { + void EventParser::vistAllStructures(std::shared_ptr structure, + std::shared_ptr listener, + std::shared_ptr filter) { visitAllDescendants(structure, structure, listener, filter); } @@ -497,10 +497,10 @@ namespace evio { * structures are passed. In this way, specific types of * structures can be captured. */ - void EventParser::visitAllDescendants(std::shared_ptr const topLevelStruct, - std::shared_ptr const structure, - std::shared_ptr const listener, - std::shared_ptr const filter) { + void EventParser::visitAllDescendants(std::shared_ptr topLevelStruct, + std::shared_ptr structure, + std::shared_ptr listener, + std::shared_ptr filter) { if (listener != nullptr) { bool accept = true; if (filter != nullptr) { @@ -513,7 +513,7 @@ namespace evio { } if (!(structure->isLeaf())) { - for (auto const child : structure->children) { + for (auto child : structure->children) { visitAllDescendants(topLevelStruct, child, listener, filter); } } @@ -528,8 +528,8 @@ namespace evio { * this will return all the structures. * @param structs vector to be filled with all structures that are accepted by filter. */ - void EventParser::getMatchingStructures(std::shared_ptr const structure, - std::shared_ptr const filter, + void EventParser::getMatchingStructures(std::shared_ptr structure, + std::shared_ptr filter, std::vector> & structs) { structs.clear(); structs.reserve(25); diff --git a/src/libsrc++/EventParser.h b/src/libsrc++/EventParser.h index 77709986c..59f44a519 100644 --- a/src/libsrc++/EventParser.h +++ b/src/libsrc++/EventParser.h @@ -103,20 +103,20 @@ namespace evio { // Scanning structures that have already been parsed - static void vistAllStructures(std::shared_ptr const structure, - std::shared_ptr const listener); - static void vistAllStructures(std::shared_ptr const structure, - std::shared_ptr const listener, - std::shared_ptr const filter); - static void getMatchingStructures(std::shared_ptr const structure, - std::shared_ptr const filter, + static void vistAllStructures(std::shared_ptr structure, + std::shared_ptr listener); + static void vistAllStructures(std::shared_ptr structure, + std::shared_ptr listener, + std::shared_ptr filter); + static void getMatchingStructures(std::shared_ptr structure, + std::shared_ptr filter, std::vector> & structs); private: - static void visitAllDescendants(std::shared_ptr const topLevelStruct, - std::shared_ptr const structure, - std::shared_ptr const listener, - std::shared_ptr const filter); + static void visitAllDescendants(std::shared_ptr topLevelStruct, + std::shared_ptr structure, + std::shared_ptr listener, + std::shared_ptr filter); }; diff --git a/src/libsrc++/EventWriter.cpp b/src/libsrc++/EventWriter.cpp index 17dc35546..a566af4cd 100644 --- a/src/libsrc++/EventWriter.cpp +++ b/src/libsrc++/EventWriter.cpp @@ -1143,9 +1143,9 @@ namespace evio { * @throws EvioException if dictionary is in improper format */ void EventWriter::createCommonRecord(const std::string & xmlDict, - std::shared_ptr const firstBank, - std::shared_ptr const firstNode, - std::shared_ptr const firstBuf) { + std::shared_ptr firstBank, + std::shared_ptr firstNode, + std::shared_ptr firstBuf) { // Create record if necessary, else clear it if (commonRecord == nullptr) { diff --git a/src/libsrc++/EventWriter.h b/src/libsrc++/EventWriter.h index d5f0a0d8d..89cb3bf1a 100644 --- a/src/libsrc++/EventWriter.h +++ b/src/libsrc++/EventWriter.h @@ -725,9 +725,9 @@ namespace evio { private: void createCommonRecord(const std::string & xmlDict, - std::shared_ptr const firstBank, - std::shared_ptr const firstNode, - std::shared_ptr const firstBuf); + std::shared_ptr firstBank, + std::shared_ptr firstNode, + std::shared_ptr firstBuf); void writeFileHeader() ; diff --git a/src/libsrc++/EvioBank.h b/src/libsrc++/EvioBank.h index d441d0c5b..28aa2fa99 100644 --- a/src/libsrc++/EvioBank.h +++ b/src/libsrc++/EvioBank.h @@ -45,7 +45,7 @@ namespace evio { * Constructor. * @param head bank header. */ - explicit EvioBank(std::shared_ptr const head) : BaseStructure(head) {} + explicit EvioBank(std::shared_ptr head) : BaseStructure(head) {} public: @@ -64,7 +64,7 @@ namespace evio { * @param head bank header. * @return shared pointer to new EvioBank. */ - static std::shared_ptr getInstance(std::shared_ptr const head) { + static std::shared_ptr getInstance(std::shared_ptr head) { std::shared_ptr pNode(new EvioBank(head)); return pNode; } diff --git a/src/libsrc++/EvioCompactReaderV4.cpp b/src/libsrc++/EvioCompactReaderV4.cpp index e35448fd8..6d06c7e67 100644 --- a/src/libsrc++/EvioCompactReaderV4.cpp +++ b/src/libsrc++/EvioCompactReaderV4.cpp @@ -803,7 +803,7 @@ namespace evio { int level = 0; nodeList = eventNodes[i]->getAllNodes(); - for (std::shared_ptr const n : nodeList) { + for (std::shared_ptr n : nodeList) { // For events that come after, move all contained nodes if (i > place) { n->pos -= removeDataLen; diff --git a/src/libsrc++/EvioEvent.h b/src/libsrc++/EvioEvent.h index 630baf101..cd346b27a 100644 --- a/src/libsrc++/EvioEvent.h +++ b/src/libsrc++/EvioEvent.h @@ -47,7 +47,7 @@ namespace evio { * Constructor. * @param head bank header. */ - explicit EvioEvent(std::shared_ptr const head) : EvioBank(head) {} + explicit EvioEvent(std::shared_ptr head) : EvioBank(head) {} public: @@ -66,7 +66,7 @@ namespace evio { * @param head bank header. * @return shared pointer to new EvioEvent. */ - static std::shared_ptr getInstance(std::shared_ptr const head) { + static std::shared_ptr getInstance(std::shared_ptr head) { std::shared_ptr pNode(new EvioEvent(head)); return pNode; } diff --git a/src/libsrc++/EvioNode.cpp b/src/libsrc++/EvioNode.cpp index 0a90c5ae2..507ea6b00 100644 --- a/src/libsrc++/EvioNode.cpp +++ b/src/libsrc++/EvioNode.cpp @@ -46,7 +46,7 @@ namespace evio { /** Copy constructor. */ - EvioNode::EvioNode(const std::shared_ptr src) { + EvioNode::EvioNode(std::shared_ptr src) { copy(*(src.get())); //id = staticId++; } diff --git a/src/libsrc++/EvioNode.h b/src/libsrc++/EvioNode.h index c3ebc6cc1..556acf256 100644 --- a/src/libsrc++/EvioNode.h +++ b/src/libsrc++/EvioNode.h @@ -161,7 +161,7 @@ namespace evio { EvioNode(); EvioNode(const EvioNode & firstNode); - explicit EvioNode(const std::shared_ptr src); + explicit EvioNode(std::shared_ptr src); EvioNode(EvioNode && src) noexcept; EvioNode(size_t pos, uint32_t place, std::shared_ptr buffer, RecordNode & blockNode); EvioNode(size_t pos, uint32_t place, size_t recordPos, std::shared_ptr buffer); diff --git a/src/libsrc++/EvioReaderV4.cpp b/src/libsrc++/EvioReaderV4.cpp index 31009cb15..25d160ed5 100644 --- a/src/libsrc++/EvioReaderV4.cpp +++ b/src/libsrc++/EvioReaderV4.cpp @@ -735,8 +735,6 @@ namespace evio { } if (swap) blkSize = SWAP_32(blkSize); - std::cout << "block size = " << std::to_string(blkSize) << std::endl; - // Change to bytes uint32_t blkBytes = 4 * blkSize; @@ -1123,6 +1121,7 @@ namespace evio { // Last (perhaps only) read byteBuffer->getBytes(bytes + offset, bytesToGo); +std::cout << "nextEvent: eventDataSizeByte = " << eventDataSizeBytes << std::endl; event->setRawBytes(bytes, eventDataSizeBytes); event->setByteOrder(byteOrder); // add this to track endianness, timmer // Don't worry about dictionaries here as version must be 1-3 diff --git a/src/libsrc++/EvioSegment.h b/src/libsrc++/EvioSegment.h index 1a8e059a9..bf6dc9ff6 100644 --- a/src/libsrc++/EvioSegment.h +++ b/src/libsrc++/EvioSegment.h @@ -42,7 +42,7 @@ namespace evio { * Constructor. * @param head segment header. */ - explicit EvioSegment(std::shared_ptr const head) : BaseStructure(head) {} + explicit EvioSegment(std::shared_ptr head) : BaseStructure(head) {} public: @@ -51,7 +51,7 @@ namespace evio { * @param head segment header. * @return shared pointer to new EvioSegment. */ - static std::shared_ptr getInstance(std::shared_ptr const head) { + static std::shared_ptr getInstance(std::shared_ptr head) { std::shared_ptr pNode(new EvioSegment(head)); return pNode; } diff --git a/src/libsrc++/EvioTagSegment.h b/src/libsrc++/EvioTagSegment.h index 6cc940fa4..96d330c9d 100644 --- a/src/libsrc++/EvioTagSegment.h +++ b/src/libsrc++/EvioTagSegment.h @@ -41,7 +41,7 @@ namespace evio { * Constructor. * @param head tagsegment header. */ - explicit EvioTagSegment(std::shared_ptr const head) : BaseStructure(head) {} + explicit EvioTagSegment(std::shared_ptr head) : BaseStructure(head) {} public: @@ -50,7 +50,7 @@ namespace evio { * @param head tagsegment header. * @return shared pointer to new EvioTagSegment. */ - static std::shared_ptr getInstance(std::shared_ptr const head) { + static std::shared_ptr getInstance(std::shared_ptr head) { std::shared_ptr pNode(new EvioTagSegment(head)); return pNode; } diff --git a/src/libsrc++/Reader.cpp b/src/libsrc++/Reader.cpp index a7d0fbdff..c84618b72 100644 --- a/src/libsrc++/Reader.cpp +++ b/src/libsrc++/Reader.cpp @@ -1745,7 +1745,7 @@ std::cout << "findRecInfo: buf cap = " << buf.capacity() << ", offset = " << off break; } - for (std::shared_ptr const nd : ev->getAllNodes()) { + for (std::shared_ptr nd : ev->getAllNodes()) { // The first node in allNodes is the event node if (removeNode == nd) { foundNode = true; diff --git a/src/libsrc++/RecordHeader.cpp b/src/libsrc++/RecordHeader.cpp index e5cbde365..19cdac30a 100644 --- a/src/libsrc++/RecordHeader.cpp +++ b/src/libsrc++/RecordHeader.cpp @@ -139,7 +139,7 @@ namespace evio { * Copy method. * @param head header to copy. */ - void RecordHeader::copy(std::shared_ptr const head) { + void RecordHeader::copy(std::shared_ptr head) { if (this != head.get()) { position = head->position; @@ -1070,7 +1070,7 @@ namespace evio { */ int RecordHeader::writeTrailer(uint8_t* array, size_t arrayLen, uint32_t recordNum, const ByteOrder & order, - const std::shared_ptr> recordLengths) { + std::shared_ptr> recordLengths) { uint32_t indexLen = 0; uint32_t wholeLen = HEADER_SIZE_BYTES; @@ -1127,7 +1127,7 @@ namespace evio { */ int RecordHeader::writeTrailer(std::vector & array, size_t off, uint32_t recordNum, const ByteOrder & order, - const std::shared_ptr> recordLengths) { + std::shared_ptr> recordLengths) { uint32_t indexLen = 0; uint32_t wholeLen = HEADER_SIZE_BYTES; @@ -1180,7 +1180,7 @@ namespace evio { * @throws EvioException if buf too small to hold trailer + index. */ int RecordHeader::writeTrailer(ByteBuffer & buf, size_t off, uint32_t recordNum, - const std::shared_ptr> recordLengths) { + std::shared_ptr> recordLengths) { uint32_t indexLen = 0; uint32_t wholeLen = HEADER_SIZE_BYTES; @@ -1244,7 +1244,7 @@ namespace evio { * @throws EvioException if buf too small to hold trailer + index. */ int RecordHeader::writeTrailer(std::shared_ptr buf, size_t off, uint32_t recordNum, - const std::shared_ptr> recordLengths) { + std::shared_ptr> recordLengths) { return writeTrailer(*(buf.get()), off, recordNum, recordLengths); } diff --git a/src/libsrc++/RecordHeader.h b/src/libsrc++/RecordHeader.h index 0f9b1db27..157fe5511 100644 --- a/src/libsrc++/RecordHeader.h +++ b/src/libsrc++/RecordHeader.h @@ -363,7 +363,7 @@ namespace evio { public: - void copy(std::shared_ptr const head); + void copy(std::shared_ptr head); void reset(); static uint32_t getWords(uint32_t length); @@ -459,17 +459,17 @@ namespace evio { static int writeTrailer(uint8_t* array, size_t arrayLen, uint32_t recordNum, const ByteOrder & order, - const std::shared_ptr> recordLengths = nullptr); + std::shared_ptr> recordLengths = nullptr); static int writeTrailer(std::vector & array, size_t off, uint32_t recordNum, const ByteOrder & order, - const std::shared_ptr> recordLengths = nullptr); + std::shared_ptr> recordLengths = nullptr); static int writeTrailer(ByteBuffer & buf, size_t off, uint32_t recordNum, - const std::shared_ptr> recordLengths = nullptr); + std::shared_ptr> recordLengths = nullptr); static int writeTrailer(std::shared_ptr buf, size_t off, uint32_t recordNum, - const std::shared_ptr> recordLengths = nullptr); + std::shared_ptr> recordLengths = nullptr); static bool isCompressed(ByteBuffer & buffer, size_t offset); diff --git a/src/libsrc++/RecordOutput.cpp b/src/libsrc++/RecordOutput.cpp index 93c48cef4..9f0b66890 100644 --- a/src/libsrc++/RecordOutput.cpp +++ b/src/libsrc++/RecordOutput.cpp @@ -630,7 +630,7 @@ namespace evio { * count limit would be exceeded or the buffer is full and cannot be * expanded since it's user-provided. */ - bool RecordOutput::addEvent(const std::shared_ptr event, uint32_t extraDataLen) { + bool RecordOutput::addEvent(std::shared_ptr event, uint32_t extraDataLen) { return addEvent(*(event.get()), extraDataLen); } diff --git a/src/libsrc++/RecordOutput.h b/src/libsrc++/RecordOutput.h index 4af3c253e..4cbdf093f 100644 --- a/src/libsrc++/RecordOutput.h +++ b/src/libsrc++/RecordOutput.h @@ -233,7 +233,7 @@ namespace evio { bool addEvent(const std::vector & event, size_t offset, uint32_t eventLen, uint32_t extraDataLen = 0); bool addEvent(const ByteBuffer & event, uint32_t extraDataLen = 0); - bool addEvent(const std::shared_ptr event, uint32_t extraDataLen = 0); + bool addEvent(std::shared_ptr event, uint32_t extraDataLen = 0); bool addEvent(EvioNode & node, uint32_t extraDataLen = 0); bool addEvent(std::shared_ptr node, uint32_t extraDataLen = 0); diff --git a/src/libsrc++/StructureTransformer.h b/src/libsrc++/StructureTransformer.h index 2fe039f20..14e078430 100644 --- a/src/libsrc++/StructureTransformer.h +++ b/src/libsrc++/StructureTransformer.h @@ -51,7 +51,7 @@ namespace evio { * @param num num of the created EvioBank. * @return the created EvioBank. */ - static std::shared_ptr transform(std::shared_ptr const segment, uint8_t num) { + static std::shared_ptr transform(std::shared_ptr segment, uint8_t num) { // Copy over header & create new EvioBank auto const segHeader = segment->getHeader(); auto bank = EvioBank::getInstance(segHeader->getTag(), segHeader->getDataType(), num); @@ -73,8 +73,8 @@ namespace evio { * @param segment EvioSegment object to copy. * @param num num of the EvioBank. */ - static void copy(std::shared_ptr const bank, - std::shared_ptr const segment, + static void copy(std::shared_ptr bank, + std::shared_ptr segment, uint8_t num) { // Copy over header @@ -104,7 +104,7 @@ namespace evio { * @param num num of the created EvioBank. * @return the created EvioBank. */ - static std::shared_ptr transform(std::shared_ptr const tagsegment, uint8_t num) { + static std::shared_ptr transform(std::shared_ptr tagsegment, uint8_t num) { auto const tagsegHeader = tagsegment->getHeader(); auto bank = EvioBank::getInstance(tagsegHeader->getTag(), tagsegHeader->getDataType(), num); auto bankHeader = bank->getHeader(); @@ -126,8 +126,8 @@ namespace evio { * @param tagsegment EvioTagSegment object to copy. * @param num num of the EvioBank. */ - static void copy(std::shared_ptr const bank, - std::shared_ptr const tagsegment, + static void copy(std::shared_ptr bank, + std::shared_ptr tagsegment, uint8_t num) { auto const tagsegHeader = tagsegment->getHeader(); @@ -155,7 +155,7 @@ namespace evio { * @param segment EvioSegment object to transform. * @return the created EvioTagSegment. */ - static std::shared_ptr transform(std::shared_ptr const segment) { + static std::shared_ptr transform(std::shared_ptr segment) { auto const segHeader = segment->getHeader(); auto ts = EvioTagSegment::getInstance(segHeader->getTag(), segHeader->getDataType()); auto tsHeader = ts->getHeader(); @@ -189,8 +189,8 @@ namespace evio { * @param tagsegment EvioTagSegment object to copy into. * @param segment EvioSegment object to copy. */ - static void copy(std::shared_ptr const tagsegment, - std::shared_ptr const segment) { + static void copy(std::shared_ptr tagsegment, + std::shared_ptr segment) { auto const segHeader = segment->getHeader(); auto tsHeader = tagsegment->getHeader(); @@ -225,7 +225,7 @@ namespace evio { * @param tagsegment EvioTagSegment object to transform. * @return the created EvioSegment. */ - static std::shared_ptr transform(std::shared_ptr const tagsegment) { + static std::shared_ptr transform(std::shared_ptr tagsegment) { auto const tsHeader = tagsegment->getHeader(); auto seg = EvioSegment::getInstance(tsHeader->getTag(), tsHeader->getDataType()); auto segHeader = seg->getHeader(); @@ -249,8 +249,8 @@ namespace evio { * @param segment EvioSegment object to copy into. * @param tagsegment EvioTagSegment object to copy. */ - static void copy(std::shared_ptr const segment, - std::shared_ptr const tagsegment) { + static void copy(std::shared_ptr segment, + std::shared_ptr tagsegment) { auto const tsHeader = tagsegment->getHeader(); auto segHeader = segment->getHeader(); @@ -281,7 +281,7 @@ namespace evio { * @return the created EvioSegment. * @throws EvioException if the bank is too long to change into a segment */ - static std::shared_ptr transform(std::shared_ptr const bank) { + static std::shared_ptr transform(std::shared_ptr bank) { auto const bankHeader = bank->getHeader(); size_t bankLen = bankHeader->getLength(); if (bankLen > 65535) { @@ -318,8 +318,8 @@ namespace evio { * @param bank EvioBank object to copy. * @throws EvioException if the bank is too long to change into a segment */ - static void copy(std::shared_ptr const segment, - std::shared_ptr const bank) { + static void copy(std::shared_ptr segment, + std::shared_ptr bank) { auto const bankHeader = bank->getHeader(); size_t bankLen = bankHeader->getLength(); @@ -357,11 +357,11 @@ namespace evio { * serializes 4, only 4 bits are needed to contain the equivalent type data.

* * @param bank EvioBank object to transform. - * @param dummy only used to distinguish this method from {@link #transform(std::shared_ptr const)}. + * @param dummy only used to distinguish this method from {@link #transform(std::shared_ptr)}. * @return the created EvioTagSegment. * @throws EvioException if the bank is too long to change into a tagsegment */ - static std::shared_ptr transform(std::shared_ptr const bank, + static std::shared_ptr transform(std::shared_ptr bank, int dummy) { auto const bankHeader = bank->getHeader(); if (bankHeader->getLength() > 65535) { @@ -406,8 +406,8 @@ namespace evio { * @param bank EvioBank object to copy. * @throws EvioException if the bank is too long to change into a segment */ - static void copy(std::shared_ptr const tagsegment, - std::shared_ptr const bank) { + static void copy(std::shared_ptr tagsegment, + std::shared_ptr bank) { auto const bankHeader = bank->getHeader(); size_t bankLen = bankHeader->getLength(); diff --git a/src/libsrc++/Util.h b/src/libsrc++/Util.h index d4ef8f323..cd2a0ed95 100644 --- a/src/libsrc++/Util.h +++ b/src/libsrc++/Util.h @@ -455,7 +455,7 @@ namespace evio { * @param bytes number of bytes to print in hex * @param label a label to print as header */ - static void printBytes(const std::shared_ptr buf, uint32_t position, uint32_t bytes, + static void printBytes(std::shared_ptr buf, uint32_t position, uint32_t bytes, const std::string & label) { printBytes(*(buf.get()), position, bytes, label); }