g4tools  5.4.0
Public Member Functions | Protected Attributes | List of all members
tools::wroot::free_seg Class Reference

Public Member Functions

 free_seg (std::ostream &a_out, seek a_first, seek a_last)
 
virtual ~free_seg ()
 
 free_seg (const free_seg &a_from)
 
free_segoperator= (const free_seg &a_from)
 
std::ostream & out () const
 
seek first () const
 
seek last () const
 
void set_first (seek a_v)
 
void set_last (seek a_v)
 
unsigned int record_size () const
 
bool fill_buffer (wbuf &a_wb)
 

Protected Attributes

std::ostream & m_out
 
seek m_first
 
seek m_last
 

Detailed Description

Definition at line 16 of file free_seg.

Constructor & Destructor Documentation

◆ free_seg() [1/2]

tools::wroot::free_seg::free_seg ( std::ostream &  a_out,
seek  a_first,
seek  a_last 
)
inline

Definition at line 18 of file free_seg.

19  :m_out(a_out),m_first(a_first),m_last(a_last){}

◆ ~free_seg()

virtual tools::wroot::free_seg::~free_seg ( )
inlinevirtual

Definition at line 20 of file free_seg.

20 {}

◆ free_seg() [2/2]

tools::wroot::free_seg::free_seg ( const free_seg a_from)
inline

Definition at line 22 of file free_seg.

23  :m_out(a_from.m_out),m_first(a_from.m_first),m_last(a_from.m_last)
24  {}

Member Function Documentation

◆ fill_buffer()

bool tools::wroot::free_seg::fill_buffer ( wbuf a_wb)
inline

Definition at line 49 of file free_seg.

49  {
50  short version = 1;
51 
52  //GB if(fLast>START_BIG_FILE()) version += big_file_version_tag();
53  if((m_first>START_BIG_FILE())||
55 
56  if(!a_wb.write(version)) return false;
57 
58  if(version>(short)big_file_version_tag()) {
59  if(!a_wb.write(m_first)) return false;
60  if(!a_wb.write(m_last)) return false;
61  } else {
62  if(m_first>START_BIG_FILE()) { //GB
63  m_out << "tools::wroot::free_seg::fill_buffer :"
64  << " attempt to write big Seek "
65  << m_first << " on 32 bits."
66  << std::endl;
67  return false;
68  }
69  if(!a_wb.write((seek32)m_first)) return false;
70  if(m_last>START_BIG_FILE()) { //GB
71  m_out << "tools::wroot::free_seg::fill_buffer :"
72  << " attempt to write big seek "
73  << m_last << " on 32 bits."
74  << std::endl;
75  return false;
76  }
77  if(!a_wb.write((seek32)m_last)) return false;
78  }
79 
80  return true;
81  }

◆ first()

seek tools::wroot::free_seg::first ( ) const
inline

Definition at line 33 of file free_seg.

33 {return m_first;}

◆ last()

seek tools::wroot::free_seg::last ( ) const
inline

Definition at line 34 of file free_seg.

34 {return m_last;}

◆ operator=()

free_seg& tools::wroot::free_seg::operator= ( const free_seg a_from)
inline

Definition at line 25 of file free_seg.

25  {
26  m_first = a_from.m_first;
27  m_last = a_from.m_last;
28  return *this;
29  }

◆ out()

std::ostream& tools::wroot::free_seg::out ( ) const
inline

Definition at line 31 of file free_seg.

31 {return m_out;}

◆ record_size()

unsigned int tools::wroot::free_seg::record_size ( ) const
inline

Definition at line 39 of file free_seg.

39  {
40  //GB if(fLast>RIO_START_BIG_FILE) {
41  if((m_first>START_BIG_FILE())|| //GB
42  (m_last>START_BIG_FILE()) ){
43  return sizeof(short) + 2 * sizeof(seek);
44  } else {
45  return sizeof(short) + 2 * sizeof(seek32);
46  }
47  }

◆ set_first()

void tools::wroot::free_seg::set_first ( seek  a_v)
inline

Definition at line 36 of file free_seg.

36 {m_first = a_v;}

◆ set_last()

void tools::wroot::free_seg::set_last ( seek  a_v)
inline

Definition at line 37 of file free_seg.

37 {m_last = a_v;}

Member Data Documentation

◆ m_first

seek tools::wroot::free_seg::m_first
protected

Definition at line 85 of file free_seg.

◆ m_last

seek tools::wroot::free_seg::m_last
protected

Definition at line 86 of file free_seg.

◆ m_out

std::ostream& tools::wroot::free_seg::m_out
protected

Definition at line 84 of file free_seg.


The documentation for this class was generated from the following file:
tools::wroot::seek
int64 seek
Definition: seek:16
tools::wroot::free_seg::m_last
seek m_last
Definition: free_seg:86
tools::wroot::seek32
int seek32
Definition: seek:17
tools::wroot::big_file_version_tag
uint32 big_file_version_tag()
Definition: seek:21
tools::wroot::free_seg::m_out
std::ostream & m_out
Definition: free_seg:84
tools::version
unsigned int version()
Definition: version:14
tools::wroot::START_BIG_FILE
uint32 START_BIG_FILE()
Definition: seek:19
tools::wroot::free_seg::m_first
seek m_first
Definition: free_seg:85