Jpp
Public Member Functions | Protected Attributes | List of all members
JGIZMO::JRootObject Class Reference

Auxiliary data structure for TObject with a user defined label. More...

#include <JRootObject.hh>

Inheritance diagram for JGIZMO::JRootObject:
JLANG::JPointer< TObject > JLANG::JAbstractPointer< TObject > JLANG::JEquals< JAbstractPointer< TObject > >

Public Member Functions

 JRootObject (TObject *__p)
 Constructor. More...
 
 JRootObject (TObject *__p, const TString &__label)
 Constructor. More...
 
TString getLabel () const
 Get label. More...
 
void setLabel (const TString &label)
 Set label. More...
 
void Draw (const std::string &option) const
 Draw object. More...
 
virtual TObjectget () const
 Get pointer. More...
 
virtual void set (TObject *p)
 Set pointer. More...
 
void set (const JPointer< T > &pointer)
 Set pointer. More...
 
virtual void reset ()
 Reset pointer. More...
 
void reset (const JPointer< T > &pointer)
 Reset pointer. More...
 
void reset (TObject *p)
 Reset pointer. More...
 
TObject *const & getReference () const
 Get rereference to internal pointer. More...
 
TObject *& getReference ()
 Get rereference to internal pointer. More...
 
virtual bool equals (const JAbstractPointer &object) const
 Equals. More...
 
bool is_valid () const
 Check validity of pointer. More...
 
TObjectoperator-> () const
 Smart pointer operator. More...
 
 operator TObject * () const
 Type conversion operator. More...
 

Protected Attributes

TString label
 
TObject__p
 pointer to object More...
 

Detailed Description

Auxiliary data structure for TObject with a user defined label.

Definition at line 27 of file JRootObject.hh.

Constructor & Destructor Documentation

◆ JRootObject() [1/2]

JGIZMO::JRootObject::JRootObject ( TObject __p)
inline

Constructor.

Parameters
__ppointer to object

Definition at line 36 of file JRootObject.hh.

36  :
38  {
39  label = get()->GetName();
40  }

◆ JRootObject() [2/2]

JGIZMO::JRootObject::JRootObject ( TObject __p,
const TString &  __label 
)
inline

Constructor.

Parameters
__ppointer to object
__labellabel

Definition at line 49 of file JRootObject.hh.

50  :
52  {
53  this->label = __label;
54  }

Member Function Documentation

◆ getLabel()

TString JGIZMO::JRootObject::getLabel ( ) const
inline

Get label.

Returns
label

Definition at line 62 of file JRootObject.hh.

63  {
64  TString buffer(this->label);
65 
66  const Ssiz_t pos = buffer.Last(LABEL_TERMINATOR);
67 
68  if (pos != kNPOS) {
69  buffer = buffer(0, pos);
70  }
71 
72  return buffer;
73  }

◆ setLabel()

void JGIZMO::JRootObject::setLabel ( const TString &  label)
inline

Set label.

Parameters
labellabel

Definition at line 81 of file JRootObject.hh.

82  {
83  this->label = label;
84  }

◆ Draw()

void JGIZMO::JRootObject::Draw ( const std::string &  option) const
inline

Draw object.

Definition at line 90 of file JRootObject.hh.

91  {
92  this->get()->Draw(option.c_str());
93  }

◆ get()

virtual TObject * JLANG::JPointer< TObject >::get ( ) const
inlinevirtualinherited

Get pointer.

Returns
pointer to object

Implements JLANG::JAbstractPointer< TObject >.

Definition at line 64 of file JPointer.hh.

65  {
66  return this->__p;
67  }

◆ set() [1/2]

virtual void JLANG::JPointer< TObject >::set ( TObject p)
inlinevirtualinherited

Set pointer.

Parameters
ppointer to object

Implements JLANG::JAbstractPointer< TObject >.

Definition at line 75 of file JPointer.hh.

76  {
77  this->__p = p;
78  }

◆ set() [2/2]

void JLANG::JPointer< TObject >::set ( const JPointer< T > &  pointer)
inlineinherited

Set pointer.

Parameters
pointerpointer to object

Definition at line 96 of file JPointer.hh.

97  {
98  this->set(pointer.get());
99  }

◆ reset() [1/3]

virtual void JLANG::JPointer< TObject >::reset ( )
inlinevirtualinherited

Reset pointer.

Implements JLANG::JAbstractPointer< TObject >.

Definition at line 84 of file JPointer.hh.

85  {
86  this->__p = NULL;
87  }

◆ reset() [2/3]

void JLANG::JPointer< TObject >::reset ( const JPointer< T > &  pointer)
inlineinherited

Reset pointer.

Parameters
pointerpointer to object

Definition at line 108 of file JPointer.hh.

109  {
110  this->reset(pointer.get());
111  }

◆ reset() [3/3]

void JLANG::JAbstractPointer< TObject >::reset ( TObject p)
inlineinherited

Reset pointer.

Parameters
ppointer to object

Definition at line 94 of file JAbstractPointer.hh.

95  {
96  if (this->get() != p) {
97 
98  this->reset();
99 
100  if (p != NULL) {
101  this->set(p);
102  }
103  }
104  }

◆ getReference() [1/2]

TObject * const& JLANG::JPointer< TObject >::getReference ( ) const
inlineinherited

Get rereference to internal pointer.

Returns
reference to internal pointer

Definition at line 119 of file JPointer.hh.

120  {
121  return __p;
122  }

◆ getReference() [2/2]

TObject * & JLANG::JPointer< TObject >::getReference ( )
inlineinherited

Get rereference to internal pointer.

Returns
reference to internal pointer

Definition at line 130 of file JPointer.hh.

131  {
132  return __p;
133  }

◆ equals()

virtual bool JLANG::JAbstractPointer< TObject >::equals ( const JAbstractPointer< TObject > &  object) const
inlinevirtualinherited

Equals.

The equality is evaluated by comparison of the internal pointers.

Parameters
objectabstract pointer
Returns
true if equals; else false

Definition at line 50 of file JAbstractPointer.hh.

51  {
52  return this->get() == object.get();
53  }

◆ is_valid()

bool JLANG::JAbstractPointer< TObject >::is_valid ( ) const
inlineinherited

Check validity of pointer.

Returns
true if pointer not null; else false

Definition at line 83 of file JAbstractPointer.hh.

84  {
85  return this->get() != NULL;
86  }

◆ operator->()

TObject * JLANG::JAbstractPointer< TObject >::operator-> ( ) const
inlineinherited

Smart pointer operator.

Returns
pointer to object

Definition at line 112 of file JAbstractPointer.hh.

113  {
114  if (!is_valid())
115  throw JNullPointerException("JAbstractPointer::operator->()");
116  else
117  return this->get();
118  }

◆ operator TObject *()

JLANG::JAbstractPointer< TObject >::operator TObject * ( ) const
inlineinherited

Type conversion operator.

Returns
pointer to object

Definition at line 126 of file JAbstractPointer.hh.

127  {
128  return this->get();
129  }

Member Data Documentation

◆ label

TString JGIZMO::JRootObject::label
protected

Definition at line 96 of file JRootObject.hh.

◆ __p

TObject * JLANG::JPointer< TObject >::__p
protectedinherited

pointer to object

Definition at line 136 of file JPointer.hh.


The documentation for this class was generated from the following file:
JLANG::JPointer< TObject >::get
virtual TObject * get() const
Get pointer.
Definition: JPointer.hh:64
JLANG::JPointer< TObject >::__p
TObject * __p
pointer to object
Definition: JPointer.hh:136
JLANG::JNullPointerException
Exception for null pointer operation.
Definition: JException.hh:216
JLANG::JAbstractPointer< TObject >::reset
virtual void reset()=0
Reset pointer.
JGIZMO::JRootObject::label
TString label
Definition: JRootObject.hh:96
JLANG::JPointer< TObject >
JLANG::JPointer< TObject >::reset
virtual void reset()
Reset pointer.
Definition: JPointer.hh:84
JGIZMO::LABEL_TERMINATOR
static const char LABEL_TERMINATOR
label terminator
Definition: JRootObject.hh:21
JLANG::JAbstractPointer< TObject >::is_valid
bool is_valid() const
Check validity of pointer.
Definition: JAbstractPointer.hh:83