xrootd
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Attributes | List of all members
XrdCl::AnyObject Class Reference

#include <XrdClAnyObject.hh>

Collaboration diagram for XrdCl::AnyObject:
Collaboration graph
[legend]

Classes

class  ConcreteHolder
 
class  Holder
 

Public Member Functions

 AnyObject ()
 Constructor.
 
 ~AnyObject ()
 Destructor.
 
template<class Type >
void Set (Type object, bool own=true)
 
template<class Type >
void Get (Type &object)
 Retrieve the object being held.
 
template<class Type >
bool Has ()
 
bool HasOwnership () const
 Check if we own the object being stored.
 

Private Attributes

HolderpHolder
 
const std::type_info * pTypeInfo
 
bool pOwn
 

Detailed Description

Simple implementation of a type safe holder for any object pointer It would have been a better idea to use boost::any here but we don't want to depend on boost

Constructor & Destructor Documentation

◆ AnyObject()

XrdCl::AnyObject::AnyObject ( )
inline

Constructor.

◆ ~AnyObject()

XrdCl::AnyObject::~AnyObject ( )
inline

Destructor.

References XrdCl::AnyObject::Holder::Delete(), pHolder, and pOwn.

Member Function Documentation

◆ Get()

template<class Type >
void XrdCl::AnyObject::Get ( Type &  object)
inline

◆ Has()

template<class Type >
bool XrdCl::AnyObject::Has ( )
inline
Returns
true is AnyObject holds an instance of given type

References pHolder, and pTypeInfo.

◆ HasOwnership()

bool XrdCl::AnyObject::HasOwnership ( ) const
inline

Check if we own the object being stored.

References pOwn.

◆ Set()

template<class Type >
void XrdCl::AnyObject::Set ( Type  object,
bool  own = true 
)
inline

Grab an object By default the ownership of the object is taken as well, ie. the object will be deleted when the AnyObject holding it is deleted. To release an object grab a zero pointer, ie. (int *)0

Parameters
objectobject pointer
owntake the ownership or not

References pHolder, pOwn, and pTypeInfo.

Referenced by XrdCl::AsyncVectorReader::GetResponse(), XrdCl::EcPgReadResponseHandler::HandleResponse(), XrdCl::UnpackXAttr::HandleResponse(), XrdCl::ZipCache::PkgRsp(), XrdCl::ZipArchive::PkgRsp(), XrdCl::ZipStatImpl< HasHndl >::RunImpl(), XrdCl::ZipListImpl< HasHndl >::RunImpl(), XrdCl::EcHandler::StatRsp(), and XrdCl::MessageUtils::WaitForResponse().

Member Data Documentation

◆ pHolder

Holder* XrdCl::AnyObject::pHolder
private

Referenced by Get(), Has(), Set(), and ~AnyObject().

◆ pOwn

bool XrdCl::AnyObject::pOwn
private

Referenced by HasOwnership(), Set(), and ~AnyObject().

◆ pTypeInfo

const std::type_info* XrdCl::AnyObject::pTypeInfo
private

Referenced by Get(), Has(), and Set().


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