Skip to content

Commit

Permalink
remove all references to shared pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
carltimmer committed Aug 28, 2024
1 parent 9fb3304 commit 56b74d7
Show file tree
Hide file tree
Showing 64 changed files with 358 additions and 358 deletions.
2 changes: 1 addition & 1 deletion src/libsrc++/BankHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace evio {
* @param byteBuffer the byteBuffer to write to.
* @return the number of bytes written, which for a BankHeader is 8.
*/
size_t BankHeader::write(std::shared_ptr<ByteBuffer> & byteBuffer) {
size_t BankHeader::write(std::shared_ptr<ByteBuffer> byteBuffer) {
return write(*(byteBuffer.get()));
}

Expand Down
2 changes: 1 addition & 1 deletion src/libsrc++/BankHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace evio {
uint32_t getHeaderLength() override;
std::string toString() override;

size_t write(std::shared_ptr<ByteBuffer> & dest) override ;
size_t write(std::shared_ptr<ByteBuffer> dest) override ;
size_t write(ByteBuffer & dest) override;
size_t write(uint8_t *dest, ByteOrder const & order) override;
};
Expand Down
8 changes: 4 additions & 4 deletions src/libsrc++/BaseStructure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ namespace evio {
*
* @param structure BaseStructure from which to copy data.
*/
void BaseStructure::transform(std::shared_ptr<BaseStructure> const & structure) {
void BaseStructure::transform(std::shared_ptr<BaseStructure> const structure) {
DataType dataType = structure->getHeader()->getDataType();

copyData(structure);
Expand Down Expand Up @@ -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<BaseStructure> const & other) {
void BaseStructure::copyData(std::shared_ptr<BaseStructure> const other) {
// Copy over raw data
rawBytes = other->rawBytes;

Expand Down Expand Up @@ -367,7 +367,7 @@ namespace evio {
*
* @param newParent this node's new parent.
*/
void BaseStructure::setParent(const std::shared_ptr<BaseStructure> &newParent) {parent = newParent;}
void BaseStructure::setParent(const std::shared_ptr<BaseStructure> newParent) {parent = newParent;}


/**
Expand Down Expand Up @@ -837,7 +837,7 @@ namespace evio {
* specified node.
*/
std::vector<std::shared_ptr<BaseStructure>> BaseStructure::getPathToRoot (
const std::shared_ptr<BaseStructure> & aNode, int depth) const {
const std::shared_ptr<BaseStructure> 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.
Expand Down
8 changes: 4 additions & 4 deletions src/libsrc++/BaseStructure.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ namespace evio {

protected:

void setParent(const std::shared_ptr<BaseStructure> &newParent);
void setParent(const std::shared_ptr<BaseStructure> newParent);

public:

Expand Down Expand Up @@ -461,7 +461,7 @@ namespace evio {

protected:

std::vector<std::shared_ptr<BaseStructure>> getPathToRoot(const std::shared_ptr<BaseStructure> & aNode, int depth) const;
std::vector<std::shared_ptr<BaseStructure>> getPathToRoot(const std::shared_ptr<BaseStructure> aNode, int depth) const;

public:

Expand Down Expand Up @@ -622,7 +622,7 @@ namespace evio {

void clearData();
void copyData(BaseStructure const & other);
void copyData(std::shared_ptr<BaseStructure> const & other);
void copyData(std::shared_ptr<BaseStructure> const other);

protected:

Expand All @@ -637,7 +637,7 @@ namespace evio {

public:

void transform(std::shared_ptr<BaseStructure> const & structure);
void transform(std::shared_ptr<BaseStructure> const structure);

virtual StructureType getStructureType() const {return StructureType::STRUCT_UNKNOWN32;};

Expand Down
2 changes: 1 addition & 1 deletion src/libsrc++/BaseStructureHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<BaseStructureHeader> const & head) {
void BaseStructureHeader::copy(std::shared_ptr<BaseStructureHeader> const head) {
tag = head->tag;
dataType = head->dataType;
number = head->number;
Expand Down
4 changes: 2 additions & 2 deletions src/libsrc++/BaseStructureHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace evio {
protected:

void setPadding(uint8_t pad);
void copy(std::shared_ptr<BaseStructureHeader> const & head);
void copy(std::shared_ptr<BaseStructureHeader> const head);

public:

Expand Down Expand Up @@ -104,7 +104,7 @@ namespace evio {
virtual uint32_t getHeaderLength() {return 0;};
virtual std::string toString() {return "BaseStructureHeader";};

virtual size_t write(std::shared_ptr<ByteBuffer> & dest) {return 0;}
virtual size_t write(std::shared_ptr<ByteBuffer> dest) {return 0;}
virtual size_t write(ByteBuffer & dest) {return 0;};
virtual size_t write(uint8_t *dest, ByteOrder const & order) {return 0;};

Expand Down
4 changes: 2 additions & 2 deletions src/libsrc++/BlockHeaderV2.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ namespace evio {
* from another object of this class.
* @param blkHeader block header object to copy
*/
explicit BlockHeaderV2(std::shared_ptr<BlockHeaderV2> & blkHeader) {
explicit BlockHeaderV2(std::shared_ptr<BlockHeaderV2> blkHeader) {
copy(blkHeader);
}

Expand All @@ -174,7 +174,7 @@ namespace evio {
* This method copies another header's contents.
* @param blkHeader block header object to copy
*/
void copy(std::shared_ptr<BlockHeaderV2> & blkHeader) {
void copy(std::shared_ptr<BlockHeaderV2> blkHeader) {
size = blkHeader->size;
number = blkHeader->number;
headerLength = blkHeader->headerLength;
Expand Down
4 changes: 2 additions & 2 deletions src/libsrc++/BlockHeaderV4.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ namespace evio {
* from another object of this class.
* @param blkHeader block header object to copy
*/
explicit BlockHeaderV4(std::shared_ptr<BlockHeaderV4> & blkHeader) {
explicit BlockHeaderV4(std::shared_ptr<BlockHeaderV4> blkHeader) {
copy(blkHeader);
}

Expand All @@ -220,7 +220,7 @@ namespace evio {
* This method copies another header's contents.
* @param blkHeader block header object to copy
*/
void copy(std::shared_ptr<BlockHeaderV4> & blkHeader) {
void copy(std::shared_ptr<BlockHeaderV4> blkHeader) {
size = blkHeader->size;
number = blkHeader->number;
headerLength = blkHeader->headerLength;
Expand Down
12 changes: 6 additions & 6 deletions src/libsrc++/ByteBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const ByteBuffer> & srcBuf) {
void ByteBuffer::copy(const std::shared_ptr<const ByteBuffer> srcBuf) {
return copy(*(srcBuf.get()));
}

Expand All @@ -254,7 +254,7 @@ namespace evio {
* @param srcBuf ByteBuffer to copy.
* @return new ByteBuffer.
*/
std::shared_ptr<ByteBuffer> ByteBuffer::copyBuffer(const std::shared_ptr<const ByteBuffer> & srcBuf) {
std::shared_ptr<ByteBuffer> ByteBuffer::copyBuffer(const std::shared_ptr<const ByteBuffer> srcBuf) {

auto newBuf = std::make_shared<ByteBuffer>(srcBuf->totalSize);
newBuf->pos = srcBuf->pos;
Expand All @@ -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<const ByteBuffer> & srcBuf, size_t position, size_t limit) {
void ByteBuffer::copyData(const std::shared_ptr<const ByteBuffer> srcBuf, size_t position, size_t limit) {
// How many bytes do we copy?
size_t newSize = limit - position;

Expand Down Expand Up @@ -702,7 +702,7 @@ namespace evio {
* @param destBuf byte buffer to be made a duplicate of this one.
* @return the same byte buffer as passed in as the argument.
*/
std::shared_ptr<ByteBuffer> & ByteBuffer::duplicate(std::shared_ptr<ByteBuffer> & destBuf) {
std::shared_ptr<ByteBuffer> ByteBuffer::duplicate(std::shared_ptr<ByteBuffer> destBuf) {
auto & buff = *(destBuf.get());
duplicate(buff);
return destBuf;
Expand Down Expand Up @@ -842,7 +842,7 @@ namespace evio {
* @param destBuf byte buffer to be made a slice of this one.
* @return the same byte buffer as passed in as the argument.
*/
std::shared_ptr<ByteBuffer> & ByteBuffer::slice(std::shared_ptr<ByteBuffer> & destBuf) {
std::shared_ptr<ByteBuffer> ByteBuffer::slice(std::shared_ptr<ByteBuffer> destBuf) {
auto & buff = *(destBuf.get());
slice(buff);
return destBuf;
Expand Down Expand Up @@ -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<ByteBuffer> & src) {
ByteBuffer & ByteBuffer::put(const std::shared_ptr<ByteBuffer> src) {
return (put(*(src.get())));
}

Expand Down
12 changes: 6 additions & 6 deletions src/libsrc++/ByteBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ namespace evio {
ByteBuffer & compact();
ByteBuffer & zero();

static std::shared_ptr<ByteBuffer> copyBuffer(const std::shared_ptr<const ByteBuffer> & srcBuf);
void copyData(const std::shared_ptr<const ByteBuffer> & srcBuf, size_t pos, size_t limit);
static std::shared_ptr<ByteBuffer> copyBuffer(const std::shared_ptr<const ByteBuffer> srcBuf);
void copyData(const std::shared_ptr<const ByteBuffer> srcBuf, size_t pos, size_t limit);
void copy(const ByteBuffer & srcBuf);
void copy(const std::shared_ptr<const ByteBuffer> & srcBuf);
void copy(const std::shared_ptr<const ByteBuffer> srcBuf);
bool equals(const ByteBuffer & other);
void expand(size_t newSize);

Expand Down Expand Up @@ -139,10 +139,10 @@ namespace evio {

ByteBuffer & order(ByteOrder const & order);
ByteBuffer & duplicate(ByteBuffer & destBuf);
std::shared_ptr<ByteBuffer> & duplicate(std::shared_ptr<ByteBuffer> & destBuf);
std::shared_ptr<ByteBuffer> duplicate(std::shared_ptr<ByteBuffer> destBuf);
std::shared_ptr<ByteBuffer> duplicate();
ByteBuffer & slice(ByteBuffer & destBuf);
std::shared_ptr<ByteBuffer> & slice(std::shared_ptr<ByteBuffer> & destBuf);
std::shared_ptr<ByteBuffer> slice(std::shared_ptr<ByteBuffer> destBuf);
std::shared_ptr<ByteBuffer> slice();

// Read
Expand Down Expand Up @@ -181,7 +181,7 @@ namespace evio {

// Bulk byte writes
ByteBuffer & put(const ByteBuffer & src);
ByteBuffer & put(const std::shared_ptr<ByteBuffer> & src);
ByteBuffer & put(const std::shared_ptr<ByteBuffer> rc);
ByteBuffer & put(const uint8_t * src, size_t length);
ByteBuffer & put(const std::vector<uint8_t> & src, size_t offset, size_t length);

Expand Down
4 changes: 2 additions & 2 deletions src/libsrc++/CompactEventBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ namespace evio {
*
* @param node node whose header data must be written
*/
void CompactEventBuilder::writeHeader(std::shared_ptr<EvioNode> & node) {
void CompactEventBuilder::writeHeader(std::shared_ptr<EvioNode> node) {

DataType const & type = currentStructure->type;
bool isBigEndian = order.isBigEndian();
Expand Down Expand Up @@ -634,7 +634,7 @@ namespace evio {
* @param swapData do we swap the primitive data or not?
* @throws EvioException if data needs to, but cannot be swapped.
*/
void CompactEventBuilder::writeNode(std::shared_ptr<EvioNode> & node, bool swapData) {
void CompactEventBuilder::writeNode(std::shared_ptr<EvioNode> node, bool swapData) {

// Write header in endianness of buffer
writeHeader(node);
Expand Down
4 changes: 2 additions & 2 deletions src/libsrc++/CompactEventBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ namespace evio {
void setCurrentHeaderLength(uint32_t len);
void setCurrentHeaderPadding(uint32_t padding);

void writeHeader(std::shared_ptr<EvioNode> & node);
void writeNode(std::shared_ptr<EvioNode> & node, bool swapData);
void writeHeader(std::shared_ptr<EvioNode> node);
void writeNode(std::shared_ptr<EvioNode> node, bool swapData);

public:

Expand Down
10 changes: 5 additions & 5 deletions src/libsrc++/CompositeData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ namespace evio {
* @throws std::out_of_range if srcPos or len too large; if len too small.
* @throws EvioException if srcBuffer not in evio format;
*/
void CompositeData::swapAll(std::shared_ptr<ByteBuffer> & buf,
void CompositeData::swapAll(std::shared_ptr<ByteBuffer> buf,
uint32_t srcPos, uint32_t len) {
swapAll(*(buf.get()), srcPos, len);
}
Expand All @@ -1219,8 +1219,8 @@ namespace evio {
* if destBuffer too small;
* if bad values for srcPos/destPos/len args;
*/
void CompositeData::swapAll(std::shared_ptr<ByteBuffer> & srcBuf,
std::shared_ptr<ByteBuffer> & destBuf,
void CompositeData::swapAll(std::shared_ptr<ByteBuffer> srcBuf,
std::shared_ptr<ByteBuffer> destBuf,
uint32_t srcPos, uint32_t destPos, uint32_t len) {
swapAll(*(srcBuf.get()), *(destBuf.get()), srcPos, destPos, len);
}
Expand Down Expand Up @@ -1390,8 +1390,8 @@ namespace evio {
* srcBuf or destBuf limit/position combo too small;
* if src & dest not identical but overlap.
*/
void CompositeData::swapData(std::shared_ptr<ByteBuffer> & srcBuf,
std::shared_ptr<ByteBuffer> & destBuf,
void CompositeData::swapData(std::shared_ptr<ByteBuffer> srcBuf,
std::shared_ptr<ByteBuffer> destBuf,
size_t srcPos, size_t destPos, size_t nBytes,
const std::vector<uint16_t> & ifmt) {
swapData(*(srcBuf.get()), *(destBuf.get()), srcPos, destPos, nBytes, ifmt);
Expand Down
10 changes: 5 additions & 5 deletions src/libsrc++/CompositeData.h
Original file line number Diff line number Diff line change
Expand Up @@ -797,13 +797,13 @@ namespace evio {

// Swap in place
static void swapAll(ByteBuffer & buf, uint32_t srcPos, uint32_t len);
static void swapAll(std::shared_ptr<ByteBuffer> & buf, uint32_t srcPos, uint32_t len);
static void swapAll(std::shared_ptr<ByteBuffer> buf, uint32_t srcPos, uint32_t len);


// Swap elsewhere

static void swapAll(std::shared_ptr<ByteBuffer> & srcBuf,
std::shared_ptr<ByteBuffer> & destBuf,
static void swapAll(std::shared_ptr<ByteBuffer> srcBuf,
std::shared_ptr<ByteBuffer> destBuf,
uint32_t srcPos, uint32_t destPos, uint32_t len);
static void swapAll(ByteBuffer & srcBuffer, ByteBuffer & destBuffer,
uint32_t srcPos, uint32_t destPos, uint32_t len);
Expand All @@ -812,8 +812,8 @@ namespace evio {

static void swapData(ByteBuffer & srcBuf, ByteBuffer & destBuf,
size_t nBytes, const std::vector<uint16_t> & ifmt);
static void swapData(std::shared_ptr<ByteBuffer> & srcBuf,
std::shared_ptr<ByteBuffer> & destBuf,
static void swapData(std::shared_ptr<ByteBuffer> srcBuf,
std::shared_ptr<ByteBuffer> destBuf,
size_t srcPos, size_t destPos, size_t nBytes,
const std::vector<uint16_t> & ifmt);
static void swapData(ByteBuffer & srcBuf, ByteBuffer & destBuf,
Expand Down
4 changes: 2 additions & 2 deletions src/libsrc++/EventBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace evio {
* This is the constructor to use when you want to manipulate an existing event.
* @param ev the event to manipulate.
*/
EventBuilder::EventBuilder(std::shared_ptr<EvioEvent> & ev) : event(ev) {}
EventBuilder::EventBuilder(std::shared_ptr<EvioEvent> ev) : event(ev) {}


/**
Expand Down Expand Up @@ -778,7 +778,7 @@ namespace evio {
* the newly supplied event.
* @param ev the new underlying event.
*/
void EventBuilder::setEvent(std::shared_ptr<EvioEvent> & ev) {event = ev;}
void EventBuilder::setEvent(std::shared_ptr<EvioEvent> ev) {event = ev;}


//---------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/libsrc++/EventBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace evio {
public:

EventBuilder(uint16_t tag, DataType const & dataType, uint8_t num) ;
EventBuilder(std::shared_ptr<EvioEvent> & event);
EventBuilder(std::shared_ptr<EvioEvent> event);

void setAllHeaderLengths();
void clearData(std::shared_ptr<BaseStructure> structure);
Expand Down Expand Up @@ -88,7 +88,7 @@ namespace evio {
std::shared_ptr<CompositeData> *data, size_t count);

std::shared_ptr<EvioEvent> getEvent();
void setEvent(std::shared_ptr<EvioEvent> & ev);
void setEvent(std::shared_ptr<EvioEvent> ev);

static int main(int argc, char **argv);

Expand Down
Loading

0 comments on commit 56b74d7

Please sign in to comment.