iterative-solver 0.0
molpro::linalg::array::util::DistrFlags::Proxy Class Reference

Proxy for accessing the stored flags. The flag on a given rank is locked on construction and unlocked on destruction. More...

#include <DistrFlags.h>

Detailed Description

Proxy for accessing the stored flags. The flag on a given rank is locked on construction and unlocked on destruction.

Warning
The overlying DistrFlags object must be alive and allocated for Proxy to work. If it is destroyed or only default constructed, than any access functions will throw a logic error.

Public Member Functions

 Proxy (MPI_Comm comm, MPI_Win win, int rank, std::shared_ptr< int > counter)
 Construct Proxy using contents of an active DistrFlags object. More...
 
 ~Proxy ()
 
int get () const
 get value of the flag More...
 
int replace (int val)
 replace value of flag More...
 
int rank () const
 Which rank the proxy has access to. More...
 

Protected Attributes

MPI_Comm m_comm = {}
 mpi communicator More...
 
MPI_Win m_win = MPI_WIN_NULL
 
int m_rank
 empty window handle More...
 
std::shared_ptr< int > m_counter
 counter of proxy objects created by overlying DistrFlags object. More...
 

Constructor & Destructor Documentation

◆ Proxy()

molpro::linalg::array::util::DistrFlags::Proxy::Proxy ( MPI_Comm  comm,
MPI_Win  win,
int  rank,
std::shared_ptr< int >  counter 
)

Construct Proxy using contents of an active DistrFlags object.

Passing contents of DistrFlags object instead of a reference, allows movement of the overlying object without invalidating the Proxy.

Parameters
commcommunicator
winMPI window
rankrank of processor to access
counternumber of proxies with this window

◆ ~Proxy()

molpro::linalg::array::util::DistrFlags::Proxy::~Proxy ( )

Member Function Documentation

◆ get()

int molpro::linalg::array::util::DistrFlags::Proxy::get ( ) const

get value of the flag

◆ rank()

int molpro::linalg::array::util::DistrFlags::Proxy::rank ( ) const
inline

Which rank the proxy has access to.

◆ replace()

int molpro::linalg::array::util::DistrFlags::Proxy::replace ( int  val)

replace value of flag

Returns
original value

Member Data Documentation

◆ m_comm

MPI_Comm molpro::linalg::array::util::DistrFlags::Proxy::m_comm = {}
protected

mpi communicator

◆ m_counter

std::shared_ptr<int> molpro::linalg::array::util::DistrFlags::Proxy::m_counter
protected

counter of proxy objects created by overlying DistrFlags object.

◆ m_rank

int molpro::linalg::array::util::DistrFlags::Proxy::m_rank
protected

empty window handle

rank of process to lock

◆ m_win

MPI_Win molpro::linalg::array::util::DistrFlags::Proxy::m_win = MPI_WIN_NULL
protected