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

Public Member Functions

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

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;
}

Constructor & Destructor Documentation

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

Assumes p is obtained.

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

Member Function Documentation

template<class T>
DataPack* DataPackRef< T >::dataPack ( )
inline
template<class T>
T& DataPackRef< T >::operator* ( )
inline
template<class T>
T* DataPackRef< T >::operator-> ( )
inline
template<class T >
DataPackRef< T > & DataPackRef< T >::operator= ( const DataPackRef< T > &  dpr)
inline
template<class T>
T* DataPackRef< T >::ptr ( )
inline
template<class T>
void DataPackRef< T >::releaseNow ( )

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