ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
TrigAccel::DataExportBuffer Struct Reference

#include <DataExportBuffer.h>

Collaboration diagram for TrigAccel::DataExportBuffer:

Public Member Functions

 DataExportBuffer ()
 
 DataExportBuffer (size_t s)
 
 ~DataExportBuffer ()
 
 DataExportBuffer (const DataExportBuffer &)=delete
 
DataExportBufferoperator= (const DataExportBuffer &)=delete
 
bool fit (size_t s)
 
void reallocate (size_t s)
 
void save (const std::string &name) const
 
size_t load (const std::string &name)
 

Public Attributes

size_t m_size
 
char * m_buffer
 

Detailed Description

Definition at line 14 of file DataExportBuffer.h.

Constructor & Destructor Documentation

◆ DataExportBuffer() [1/3]

TrigAccel::DataExportBuffer::DataExportBuffer ( )
inline

Definition at line 16 of file DataExportBuffer.h.

16 : m_size(0), m_buffer(0) {};

◆ DataExportBuffer() [2/3]

TrigAccel::DataExportBuffer::DataExportBuffer ( size_t  s)
inline

Definition at line 17 of file DataExportBuffer.h.

17  : m_size(s) {
18  m_buffer = new char[s];
19  }

◆ ~DataExportBuffer()

TrigAccel::DataExportBuffer::~DataExportBuffer ( )
inline

Definition at line 20 of file DataExportBuffer.h.

20 {delete[] m_buffer;}

◆ DataExportBuffer() [3/3]

TrigAccel::DataExportBuffer::DataExportBuffer ( const DataExportBuffer )
delete

Member Function Documentation

◆ fit()

bool TrigAccel::DataExportBuffer::fit ( size_t  s)
inline

Definition at line 26 of file DataExportBuffer.h.

26  {
27  return s<=m_size;
28  }

◆ load()

size_t TrigAccel::DataExportBuffer::load ( const std::string &  name)
inline

Definition at line 42 of file DataExportBuffer.h.

42  {
43  std::ifstream binFile(name, std::ios::binary);
44  if (!binFile) {
45  return 0;
46  }
47  binFile.seekg(0, binFile.end);
48  size_t fileSize = binFile.tellg();
49  binFile.seekg (0, binFile.beg);
50  reallocate(fileSize);
51  binFile.read(m_buffer, m_size);
52  binFile.close();
53  return fileSize;
54  }

◆ operator=()

DataExportBuffer& TrigAccel::DataExportBuffer::operator= ( const DataExportBuffer )
delete

◆ reallocate()

void TrigAccel::DataExportBuffer::reallocate ( size_t  s)
inline

Definition at line 30 of file DataExportBuffer.h.

30  {
31  delete[] m_buffer;
32  m_buffer = new char[s];
33  m_size = s;
34  }

◆ save()

void TrigAccel::DataExportBuffer::save ( const std::string &  name) const
inline

Definition at line 36 of file DataExportBuffer.h.

36  {
37  std::ofstream binFile(name, std::ios::binary);
38  binFile.write(m_buffer, m_size);
39  binFile.close();
40  }

Member Data Documentation

◆ m_buffer

char* TrigAccel::DataExportBuffer::m_buffer

Definition at line 57 of file DataExportBuffer.h.

◆ m_size

size_t TrigAccel::DataExportBuffer::m_size

Definition at line 56 of file DataExportBuffer.h.


The documentation for this struct was generated from the following file:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TrigAccel::DataExportBuffer::reallocate
void reallocate(size_t s)
Definition: DataExportBuffer.h:30
TrigAccel::DataExportBuffer::m_size
size_t m_size
Definition: DataExportBuffer.h:56
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigAccel::DataExportBuffer::m_buffer
char * m_buffer
Definition: DataExportBuffer.h:57