Medial Code Documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions
xgboost::common::RefResourceView< T > Class Template Reference

A vector-like type that holds a reference counted resource. More...

#include <ref_resource_view.h>

Inheritance diagram for xgboost::common::RefResourceView< T >:
xgboost::common::ReallocVector< T >

Public Types

using value_type = T
 
using size_type = std::uint64_t
 

Public Member Functions

 RefResourceView (value_type *ptr, size_type n, std::shared_ptr< common::ResourceHandler > mem)
 
 RefResourceView (value_type *ptr, size_type n, std::shared_ptr< common::ResourceHandler > mem, T const &init)
 Construct a view on ptr with length n.
 
 RefResourceView (RefResourceView const &that)=delete
 
RefResourceViewoperator= (RefResourceView const &that)=delete
 
 RefResourceView (RefResourceView &&that)=default
 We allow move assignment for lazy initialization.
 
RefResourceViewoperator= (RefResourceView &&that)=default
 
size_type size () const
 
size_type size_bytes () const
 
value_type * data ()
 
value_type const * data () const
 
bool empty () const
 
auto cbegin () const
 
auto begin ()
 
auto begin () const
 
auto cend () const
 
auto end ()
 
auto end () const
 
auto const & front () const
 
auto & front ()
 
auto const & back () const
 
auto & back ()
 
value_type & operator[] (size_type i)
 
value_type const & operator[] (size_type i) const
 
auto Resource () const
 Get the underlying resource.
 

Protected Member Functions

void Init (value_type *ptr, size_type size, std::shared_ptr< common::ResourceHandler > mem)
 

Detailed Description

template<typename T>
class xgboost::common::RefResourceView< T >

A vector-like type that holds a reference counted resource.

The vector size is immutable after construction. This way we can swap the underlying resource when needed.

Constructor & Destructor Documentation

◆ RefResourceView()

template<typename T >
xgboost::common::RefResourceView< T >::RefResourceView ( value_type *  ptr,
size_type  n,
std::shared_ptr< common::ResourceHandler mem,
T const &  init 
)
inline

Construct a view on ptr with length n.

The ptr is held by the mem resource.

Parameters
ptrThe pointer to view.
nThe length of the view.
memThe owner of the pointer.
initInitialize the view with this value.

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