EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
EBGeometry::PoolHandle Class Reference

Base of every pool-resident handle: the one PoolLocation its arrays resolve against. More...

#include <EBGeometry_Pool.hpp>

Inheritance diagram for EBGeometry::PoolHandle:
Inheritance graph
[legend]

Public Member Functions

PoolLocation location () const noexcept
 Where this handle's arrays live.
 
bool isAttachedTo (const Pool &a_pool) const noexcept
 Check whether this handle's arrays were reserved from a_pool.
 

Protected Member Functions

 PoolHandle () noexcept=default
 An unset location; the first reservation attaches it.
 
 PoolHandle (const PoolLocation &a_location) noexcept
 Adopt a location, as a handle rebuilt from a stored layout does.
 
 PoolHandle (const PoolHandle &) noexcept=default
 Copy a handle, as a derived handle's copy does.
 
 PoolHandle (PoolHandle &&) noexcept=default
 Move a handle; the same as a copy.
 
PoolHandle & operator= (const PoolHandle &) noexcept=default
 Copy-assign a handle, as a derived handle's assignment does.
 
PoolHandle & operator= (PoolHandle &&) noexcept=default
 Move-assign a handle; the same as a copy.
 
 ~PoolHandle () noexcept=default
 Destructor; protected, since a PoolHandle exists only as the base of a handle.
 
void * base () noexcept
 The base address this handle's offsets resolve against; see PoolLocation::base().
 
const void * base () const noexcept
 The base address this handle's offsets resolve against, for read-only access.
 
void attach (const Pool &a_pool, const char *a_who) noexcept
 Follow a_pool, as the first reservation does; see PoolLocation::attach().
 
PoolLocation rebasedLocation (const Pool &a_pool, uint64_t a_endByte, const char *a_who) const noexcept
 The location of this handle's arrays in another pool of its mirror chain; see PoolLocation::rebasedOnto().
 
void setLocation (const PoolLocation &a_location) noexcept
 Replace the location, for a view or a copy made by a derived handle.
 

Detailed Description

Base of every pool-resident handle: the one PoolLocation its arrays resolve against.

A pool-resident class splits into a layout – its PODVectors and plain values, which are offsets and sizes only – and a handle, which is that layout plus where the pool is. The handle derives from this class, which owns the location and the operations on it; nothing else in the library holds a PoolLocation.

Only top-level objects are handles. A pool-resident object stored inside another object's pool (a TriMeshSDF held by a BVHUnion, a mesh inside a tape) is stored as its layout, and the outer handle rebuilds a temporary inner handle from that layout and its own location when it evaluates it. Mirroring the pool copies the layout's bytes verbatim, which is exact, since a layout holds no address. isPoolHandle lets a container reject a handle where a layout belongs, at compile time.

Constructor & Destructor Documentation

◆ PoolHandle() [1/2]

EBGeometry::PoolHandle::PoolHandle ( const PoolLocation &  a_location)
inlineexplicitprotectednoexcept

Adopt a location, as a handle rebuilt from a stored layout does.

Parameters
[in]a_locationLocation to resolve against.

◆ PoolHandle() [2/2]

EBGeometry::PoolHandle::PoolHandle ( const PoolHandle &  )
protecteddefaultnoexcept

Copy a handle, as a derived handle's copy does.

Protected, with the other copy and move operations, so that a derived handle cannot be sliced into a bare PoolHandle. Defaulted, so every derived handle stays trivially copyable.

Member Function Documentation

◆ attach()

void EBGeometry::PoolHandle::attach ( const Pool &  a_pool,
const char *  a_who 
)
inlineprotectednoexcept

Follow a_pool, as the first reservation does; see PoolLocation::attach().

Parameters
[in]a_poolPool to follow.
[in]a_whoName of the handle class, for the message.

◆ base() [1/2]

const void * EBGeometry::PoolHandle::base ( ) const
inlineprotectednoexcept

The base address this handle's offsets resolve against, for read-only access.

A const handle hands out a const base, so that a PODVector bound against it gives const elements (PODVector::bind and PODVector::at pick their const overload from the base's type).

Returns
The base address.

◆ base() [2/2]

void * EBGeometry::PoolHandle::base ( )
inlineprotectednoexcept

The base address this handle's offsets resolve against; see PoolLocation::base().

Returns
The base address.

◆ isAttachedTo()

bool EBGeometry::PoolHandle::isAttachedTo ( const Pool &  a_pool) const
inlinenoexcept

Check whether this handle's arrays were reserved from a_pool.

Parameters
[in]a_poolPool to test against.
Returns
True if this handle follows a_pool.

◆ location()

PoolLocation EBGeometry::PoolHandle::location ( ) const
inlinenoexcept

Where this handle's arrays live.

Returns
The location: the pool it follows, or a snapshot made by rebasedView().

◆ operator=() [1/2]

PoolHandle & EBGeometry::PoolHandle::operator= ( const PoolHandle &  )
protecteddefaultnoexcept

Copy-assign a handle, as a derived handle's assignment does.

Returns
This handle.

◆ operator=() [2/2]

PoolHandle & EBGeometry::PoolHandle::operator= ( PoolHandle &&  )
protecteddefaultnoexcept

Move-assign a handle; the same as a copy.

Returns
This handle.

◆ rebasedLocation()

PoolLocation EBGeometry::PoolHandle::rebasedLocation ( const Pool &  a_pool,
uint64_t  a_endByte,
const char *  a_who 
) const
inlineprotectednoexcept

The location of this handle's arrays in another pool of its mirror chain; see PoolLocation::rebasedOnto().

Parameters
[in]a_poolPool to resolve against.
[in]a_endByteFirst byte past the handle's last array.
[in]a_whoName of the handle class, for the messages.
Returns
The new location.

◆ setLocation()

void EBGeometry::PoolHandle::setLocation ( const PoolLocation &  a_location)
inlineprotectednoexcept

Replace the location, for a view or a copy made by a derived handle.

Parameters
[in]a_locationNew location.

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