Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Mantid::TestMemory::MockMemory Struct Reference

Mock the availMem function with RAII. More...

#include <MockMemory.h>

Public Member Functions

 MockMemory (MockMemory &&)=delete
 
 MockMemory (MockMemory const &)=delete
 
 MockMemory (std::size_t value=g_default_value)
 Patch the available memory while in scope.
 
std::size_t numberOfFloats () const
 
MockMemoryoperator= (MockMemory &&)=delete
 
MockMemoryoperator= (MockMemory const &)=delete
 
 ~MockMemory ()
 

Private Attributes

std::size_t m_value {g_default_value}
 

Detailed Description

Mock the availMem function with RAII.

Construct an operation within a scope for the availMem function to return a fixed value within that scope. Will reset on exit.

Note
on Windows or other deficient OSes, this will not perform the patch, but will just provide the numberOfFloats method to return a very large number expected to always exceed available memory

Definition at line 25 of file MockMemory.h.

Constructor & Destructor Documentation

◆ MockMemory() [1/3]

Mantid::TestMemory::MockMemory::MockMemory ( std::size_t  value = g_default_value)
inline

Patch the available memory while in scope.

Parameters
valueThe amount of available memory, in kiB, that will be reported. Default 12 kiB.

Definition at line 28 of file MockMemory.h.

References Mantid::TestMemory::enable_mem_override(), and m_value.

◆ ~MockMemory()

Mantid::TestMemory::MockMemory::~MockMemory ( )
inline

Definition at line 29 of file MockMemory.h.

References Mantid::TestMemory::disable_mem_override().

◆ MockMemory() [2/3]

Mantid::TestMemory::MockMemory::MockMemory ( MockMemory const &  )
delete

◆ MockMemory() [3/3]

Mantid::TestMemory::MockMemory::MockMemory ( MockMemory &&  )
delete

Member Function Documentation

◆ numberOfFloats()

std::size_t Mantid::TestMemory::MockMemory::numberOfFloats ( ) const
inline

Definition at line 41 of file MockMemory.h.

References Mantid::TestMemory::g_fallback_bin_count.

◆ operator=() [1/2]

MockMemory & Mantid::TestMemory::MockMemory::operator= ( MockMemory &&  )
delete

References m_value.

◆ operator=() [2/2]

MockMemory & Mantid::TestMemory::MockMemory::operator= ( MockMemory const &  )
delete

Member Data Documentation

◆ m_value

std::size_t Mantid::TestMemory::MockMemory::m_value {g_default_value}
private

Definition at line 44 of file MockMemory.h.

Referenced by MockMemory(), and operator=().


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