GCSIM
Public Member Functions | Public Attributes | List of all members
segment Struct Reference

represents a single segment on the heap. More...

#include <segment.hpp>

Public Member Functions

 segment ()
 creates an instance of the segment.
 
 ~segment ()
 deletes the segment.
 
 segment (const segment &)=delete
 deleted copy constructor.
 
segmentoperator= (const segment &)=delete
 deleted assignment operator.
 
 segment (segment &&other) noexcept
 constructs new segment from an existing one.
 
segmentoperator= (segment &&other) noexcept
 constructs new segment by assigning it an existing one.
 
void initialize ()
 initializes the free memory and sets initial header.
 

Public Attributes

uint8_t * segment_memory
 pointer to the segment's memory block.
 
uint32_t free_memory
 number of bytes that are free in segment.
 

Detailed Description

represents a single segment on the heap.

Constructor & Destructor Documentation

◆ segment() [1/3]

segment::segment ( )

creates an instance of the segment.

allocates SEGMENT_SIZE bytes of memory.

Exceptions
std::bad_allocwhen memory allocation fails.

◆ ~segment()

segment::~segment ( )

deletes the segment.

frees the allocated memory.

◆ segment() [2/3]

segment::segment ( const segment )
delete

deleted copy constructor.

◆ segment() [3/3]

segment::segment ( segment &&  other)
noexcept

constructs new segment from an existing one.

Parameters
other- rvalue of the existing segment.

moves ownership of the data from other to this.

Member Function Documentation

◆ initialize()

void segment::initialize ( )

initializes the free memory and sets initial header.

◆ operator=() [1/2]

segment & segment::operator= ( const segment )
delete

deleted assignment operator.

◆ operator=() [2/2]

segment & segment::operator= ( segment &&  other)
noexcept

constructs new segment by assigning it an existing one.

Parameters
other- rvalue of the existing segment.

moves ownership of the data from other to this.

Member Data Documentation

◆ free_memory

uint32_t segment::free_memory

number of bytes that are free in segment.

◆ segment_memory

uint8_t* segment::segment_memory

pointer to the segment's memory block.


The documentation for this struct was generated from the following files: