lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::Fabrics::LocalIOVec Class Reference

Growable array of struct iovec entries plus one memory-region descriptor per entry, for vectored libfabric calls. More...

#include <Endpoint.hh>

Public Member Functions

 LocalIOVec (size_t count=1)
 Construct an empty vector (count() is 0) with capacity for count entries.
 
 LocalIOVec (LocalAddress *local_addrs, size_t count)
 Construct from an array of count LocalAddress objects, copying each iovec and, where a MemoryRegion is set, its descriptor.
 
 LocalIOVec (const std::vector< LocalAddress * > &local_addrs)
 Construct from a vector of LocalAddress pointers, copying each iovec and, where a MemoryRegion is set, its descriptor.
 
 ~LocalIOVec ()
 Free the iovec and descriptor arrays.
 
void reset ()
 Set count() to 0 and set the all-descriptors-present flag; the capacity is kept.
 
bool check_mr ()
 Return the cached flag that says every entry has a memory-region descriptor.
 
size_t count () const
 Return the number of entries in use.
 
const struct iovec * iovecs () const
 Return the iovec array.
 
void ** desc () const
 Return the descriptor array (one entry per iovec).
 
void * allocate ()
 Grow the capacity by one if needed and return a pointer to the next unused iovec, incrementing count().
 
bool add_iovec (LocalAddress *local_addr, size_t count=1)
 Append count entries from the LocalAddress array local_addr, copying descriptors where a MemoryRegion is set.
 
bool add_iovec (std::vector< LocalAddress * > &local_addr)
 Append one entry per LocalAddress in the vector, copying descriptors where a MemoryRegion is set; always returns true.
 
bool add_iovec (void *buf, size_t len, MemoryRegion *mr=NULL)
 Append one entry for buf and len, recording the descriptor of mr when mr is given; always returns true.
 
bool set_count (size_t count)
 Set count() to count; returns false without a change if count is not less than the current capacity.
 
bool set_iovec (unsigned index, LocalAddress *local_addr)
 Overwrite entry index from local_addr, including its descriptor if it has a MemoryRegion (otherwise check_mr() becomes false).
 
bool set_iovec (unsigned index, void *buf, size_t len, MemoryRegion *mr=NULL)
 Overwrite entry index with buf and len and, if mr is given, its descriptor (otherwise check_mr() becomes false).
 
bool set_iovec_mr (unsigned index, MemoryRegion *mr)
 Set the descriptor of entry index from mr; returns false if index is not less than the capacity or mr is NULL.
 

Detailed Description

Growable array of struct iovec entries plus one memory-region descriptor per entry, for vectored libfabric calls.

Constructor & Destructor Documentation

◆ LocalIOVec() [1/3]

Pds::Fabrics::LocalIOVec::LocalIOVec ( size_t  count = 1)

Construct an empty vector (count() is 0) with capacity for count entries.

◆ LocalIOVec() [2/3]

Pds::Fabrics::LocalIOVec::LocalIOVec ( LocalAddress *  local_addrs,
size_t  count 
)

Construct from an array of count LocalAddress objects, copying each iovec and, where a MemoryRegion is set, its descriptor.

If local_addrs is NULL, count() is still count but the entries are not filled and check_mr() is false.

◆ LocalIOVec() [3/3]

Pds::Fabrics::LocalIOVec::LocalIOVec ( const std::vector< LocalAddress * > &  local_addrs)

Construct from a vector of LocalAddress pointers, copying each iovec and, where a MemoryRegion is set, its descriptor.

◆ ~LocalIOVec()

Pds::Fabrics::LocalIOVec::~LocalIOVec ( )

Free the iovec and descriptor arrays.

Member Function Documentation

◆ add_iovec() [1/3]

bool Pds::Fabrics::LocalIOVec::add_iovec ( LocalAddress *  local_addr,
size_t  count = 1 
)

Append count entries from the LocalAddress array local_addr, copying descriptors where a MemoryRegion is set.

Returns false if local_addr is NULL (the capacity may still have grown), otherwise true.

◆ add_iovec() [2/3]

bool Pds::Fabrics::LocalIOVec::add_iovec ( std::vector< LocalAddress * > &  local_addr)

Append one entry per LocalAddress in the vector, copying descriptors where a MemoryRegion is set; always returns true.

◆ add_iovec() [3/3]

bool Pds::Fabrics::LocalIOVec::add_iovec ( void *  buf,
size_t  len,
MemoryRegion *  mr = NULL 
)

Append one entry for buf and len, recording the descriptor of mr when mr is given; always returns true.

◆ allocate()

void * Pds::Fabrics::LocalIOVec::allocate ( )

Grow the capacity by one if needed and return a pointer to the next unused iovec, incrementing count().

The descriptor of that entry is not set.

◆ check_mr()

bool Pds::Fabrics::LocalIOVec::check_mr ( )

Return the cached flag that says every entry has a memory-region descriptor.

◆ count()

size_t Pds::Fabrics::LocalIOVec::count ( ) const

Return the number of entries in use.

◆ desc()

void ** Pds::Fabrics::LocalIOVec::desc ( ) const

Return the descriptor array (one entry per iovec).

◆ iovecs()

const struct iovec * Pds::Fabrics::LocalIOVec::iovecs ( ) const

Return the iovec array.

◆ reset()

void Pds::Fabrics::LocalIOVec::reset ( )

Set count() to 0 and set the all-descriptors-present flag; the capacity is kept.

◆ set_count()

bool Pds::Fabrics::LocalIOVec::set_count ( size_t  count)

Set count() to count; returns false without a change if count is not less than the current capacity.

◆ set_iovec() [1/2]

bool Pds::Fabrics::LocalIOVec::set_iovec ( unsigned  index,
LocalAddress *  local_addr 
)

Overwrite entry index from local_addr, including its descriptor if it has a MemoryRegion (otherwise check_mr() becomes false).

Returns false if index is not less than the capacity.

◆ set_iovec() [2/2]

bool Pds::Fabrics::LocalIOVec::set_iovec ( unsigned  index,
void *  buf,
size_t  len,
MemoryRegion *  mr = NULL 
)

Overwrite entry index with buf and len and, if mr is given, its descriptor (otherwise check_mr() becomes false).

Returns false if index is not less than the capacity.

◆ set_iovec_mr()

bool Pds::Fabrics::LocalIOVec::set_iovec_mr ( unsigned  index,
MemoryRegion *  mr 
)

Set the descriptor of entry index from mr; returns false if index is not less than the capacity or mr is NULL.


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