OpendTect  6.6
Public Member Functions | List of all members
DataPackRef< T > Class Template Reference
Inheritance diagram for DataPackRef< T >:
[legend]

Public Member Functions

 DataPackRef (const DataPackRef< T > &)
 
 DataPackRef (DataPack *p)
 Assumes p is obtained. More...
 
DataPackdataPack ()
 
T & operator* ()
 
T * operator-> ()
 
DataPackRef< T > & operator= (const DataPackRef< T > &)
 
T * ptr ()
 
void releaseNow ()
 
- Public Member Functions inherited from ConstDataPackRef< T >
 ConstDataPackRef (const ConstDataPackRef< T > &)
 
 ConstDataPackRef (const DataPack *p)
 Assumes p is obtained. More...
 
virtual ~ConstDataPackRef ()
 
const DataPackdataPack () const
 
 operator bool () const
 
const T & operator* () const
 
const T * operator-> () const
 
ConstDataPackRef< T > & operator= (const ConstDataPackRef< T > &)
 
const T * ptr () const
 
void releaseNow ()
 

Additional Inherited Members

- Protected Attributes inherited from ConstDataPackRef< T >
DataPackdp_
 
T * ptr_
 

Detailed Description

template<class T>
class DataPackRef< T >

Provides safe&easy access to DataPack subclass.

Obtains the pack, and releases it when it goes out of scope. Typically used to hold a datapack as a local variable. Will also work when there are multiple return points.

Example of usage:

if ( fdp )
{
if ( fdp->info().getTotalSize()== 0 )
return; //release is called automatically;
if ( mIsUdf(fdp->get(0,0) )
return; //release is called automatically;
fdp->set(0,0,0);
}
if ( cdp )
{
if ( cdp->info().getTotalSize()== 0 )
return; //release is called automatically;
if ( mIsUdf(cdp->get(0,0) )
return; //release is called automatically;
}
DataPack * obtain(DataPack::ID dpid)
Definition: datapack.h:153
static ID FlatID()
Flat (N1xN2) data: 4.
Definition: datapack.h:278

<>

Constructor & Destructor Documentation

◆ DataPackRef() [1/2]

template<class T >
DataPackRef< T >::DataPackRef ( DataPack p)
inline

Assumes p is obtained.

◆ DataPackRef() [2/2]

template<class T >
DataPackRef< T >::DataPackRef ( const DataPackRef< T > &  dpr)
inline

Member Function Documentation

◆ dataPack()

template<class T >
DataPack* DataPackRef< T >::dataPack ( )
inline

◆ operator*()

template<class T >
T& DataPackRef< T >::operator* ( )
inline

◆ operator->()

template<class T >
T* DataPackRef< T >::operator-> ( )
inline

◆ operator=()

template<class T >
DataPackRef< T > & DataPackRef< T >::operator= ( const DataPackRef< T > &  dpr)
inline

◆ ptr()

template<class T >
T* DataPackRef< T >::ptr ( )
inline

◆ releaseNow()

template<class T >
void DataPackRef< T >::releaseNow ( )

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2022