Skip to content

Commit

Permalink
update license header; add method to write to shared pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
carltimmer committed Jul 21, 2020
1 parent 9573b2e commit 34056bd
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
13 changes: 8 additions & 5 deletions src/hipo/BaseStructureHeader.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
//
// Copyright (c) 2020, Jefferson Science Associates
// Copyright 2020, Jefferson Science Associates, LLC.
// Subject to the terms in the LICENSE file found in the top-level directory.
//
// Thomas Jefferson National Accelerator Facility
// EPSCI Group
//
// Thomas Jefferson National Accelerator Facility
// 12000, Jefferson Ave, Newport News, VA 23606
// Phone : (757)-269-7100
//
// (757)-269-7100


#ifndef EVIO_6_0_BASESTRUCTUREHEADER_H
#define EVIO_6_0_BASESTRUCTUREHEADER_H


#include <vector>
#include <cstring>
#include <cstdint>
#include <sstream>


#include "Util.h"
#include "ByteOrder.h"
#include "DataType.h"
Expand Down Expand Up @@ -101,6 +103,7 @@ namespace evio {
virtual uint32_t getHeaderLength() {return 0;};
virtual string toString() {return "BaseStructureHeader";};

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
24 changes: 19 additions & 5 deletions src/hipo/TagSegmentHeader.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
//
// Copyright (c) 2020, Jefferson Science Associates
// Copyright 2020, Jefferson Science Associates, LLC.
// Subject to the terms in the LICENSE file found in the top-level directory.
//
// Thomas Jefferson National Accelerator Facility
// EPSCI Group
//
// Thomas Jefferson National Accelerator Facility
// 12000, Jefferson Ave, Newport News, VA 23606
// Phone : (757)-269-7100
//
// (757)-269-7100


#include "TagSegmentHeader.h"


namespace evio {

/**
Expand Down Expand Up @@ -64,6 +65,19 @@ namespace evio {
return 4;
}


/**
* Write myself out a byte buffer.
* This write is relative - i.e., it uses the current position of the buffer.
*
* @param byteBuffer the byteBuffer to write to.
* @return the number of bytes written, which for a TagSegmentHeader is 4.
*/
size_t TagSegmentHeader::write(std::shared_ptr<ByteBuffer> & byteBuffer) {
return write(*(byteBuffer.get()));
}


/**
* Write myself out a byte buffer.
* This write is relative - i.e., it uses the current position of the buffer.
Expand Down
16 changes: 11 additions & 5 deletions src/hipo/TagSegmentHeader.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
//
// Copyright (c) 2020, Jefferson Science Associates
// Copyright 2020, Jefferson Science Associates, LLC.
// Subject to the terms in the LICENSE file found in the top-level directory.
//
// Thomas Jefferson National Accelerator Facility
// EPSCI Group
//
// Thomas Jefferson National Accelerator Facility
// 12000, Jefferson Ave, Newport News, VA 23606
// Phone : (757)-269-7100
//
// (757)-269-7100


#ifndef EVIO_6_0_TAGSEGMENTHEADER_H
#define EVIO_6_0_TAGSEGMENTHEADER_H


#include <memory>


#include "Util.h"
#include "DataType.h"
#include "ByteOrder.h"
#include "ByteBuffer.h"
#include "BaseStructureHeader.h"


namespace evio {

/**
Expand All @@ -39,6 +44,7 @@ namespace evio {
uint32_t getHeaderLength() override;
string toString() override;

size_t write(std::shared_ptr<ByteBuffer> & dest);
size_t write(ByteBuffer & dest) override;
size_t write(uint8_t *dest, ByteOrder const & order) override;
};
Expand Down

0 comments on commit 34056bd

Please sign in to comment.