00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "DaqReadoutFormat/DaqContainer.h"
00010
00011 #include "DaqReadoutFormat/ByteBuffer.h"
00012 #include "DaqReadoutFormat/RomData.h"
00013
00014 using DybDaq::ByteBuffer;
00015 using DybDaq::DaqBuffer;
00016 using DybDaq::DaqContainer;
00017 using DybDaq::RomData;
00018
00019 DaqContainer::DaqContainer() :
00020 DaqBuffer(((char*)0),
00021 *((const DaqTraits*)0)),
00022 m_expandable(0),
00023 m_begin(0),
00024 m_bufferSize(0) {
00025 }
00026
00027 DaqContainer::DaqContainer(const DaqContainer& container) :
00028 DaqBuffer(container),
00029 DaqExpandable(),
00030 m_expandable(0),
00031 m_begin(container.begin()),
00032 m_bufferSize(container.containerSize()) {
00033
00034 }
00035
00036 DaqContainer::DaqContainer(DaqExpandable& expandable) :
00037 DaqBuffer(((char*)0),
00038 *((const DaqTraits*)0)),
00039 m_expandable(&expandable),
00040 m_begin(0),
00041 m_bufferSize(0) {
00042 }
00043
00044
00045 DaqContainer::DaqContainer(const ByteBuffer& byteBuffer,
00046 const unsigned int bufferSize) :
00047 DaqBuffer(byteBuffer,
00048 *((DaqTraits*)0)),
00049 m_expandable(0),
00050 m_begin(byteBuffer.position()),
00051 m_bufferSize(bufferSize) {
00052 }
00053
00054 DaqContainer::DaqContainer(const ByteBuffer& byteBuffer,
00055 const DaqTraits& traits,
00056 const unsigned int bufferSize) :
00057 DaqBuffer(byteBuffer,
00058 traits),
00059 m_expandable(0),
00060 m_begin(byteBuffer.position()),
00061 m_bufferSize(bufferSize) {
00062 }
00063
00064 DaqContainer::~DaqContainer() {
00065 }
00066
00067 unsigned int DaqContainer::begin() const {
00068 return m_begin;
00069 }
00070
00071 unsigned int DaqContainer::gather(OutputBufferList& outputBuffers) const {
00072 return gatherComponents(outputBuffers);
00073 }
00074
00075 unsigned int DaqContainer::inspect(DaqBuffer::Bytes& inspectors) const {
00076 return inspectComponents(inspectors);
00077 }
00078
00079 unsigned int DaqContainer::containerSize() const {
00080 return m_bufferSize;
00081 }
00082
00083 bool DaqContainer::setExpandable(DaqExpandable& expandable) {
00084 if (0 != m_expandable) {
00085 return false;
00086 }
00087 m_expandable = &expandable;
00088 return true;
00089 }
00090
00091 void DaqContainer::notifyExpandable(const unsigned int size) {
00092 if (0 != m_expandable) {
00093 m_expandable->expanded(size);
00094 }
00095 }
00096
00097 bool DaqContainer::expandedByRomData(const RomData* romData) {
00098 return (const_cast<RomData*>(romData))->setRomExpandable(*this);
00099 }