xrootd
Classes | Public Member Functions | Private Attributes
XrdCl::AnyObject Class Reference

#include <XrdClAnyObject.hh>

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

List of all members.

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.
bool HasOwnership () const
 Check if we own the object being stored.

Private Attributes

Holder * pHolder
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

XrdCl::AnyObject::AnyObject ( )
inline

Constructor.

XrdCl::AnyObject::~AnyObject ( )
inline

Destructor.

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


Member Function Documentation

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

Check if we own the object being stored.

References pOwn.

Referenced by UtilsTest::AnyTest().

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 UtilsTest::AnyTest(), XrdCl::XRootDTransport::InitializeChannel(), XrdCl::XRootDMsgHandler::ParseResponse(), XrdCl::XRootDTransport::Query(), and XrdCl::FileStateHandler::Stat().


Member Data Documentation

Holder* XrdCl::AnyObject::pHolder
private

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

bool XrdCl::AnyObject::pOwn
private

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

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

Referenced by Get(), and Set().


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