Jpp  19.1.0
the software that should make you happy
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< JClass_t > JLANG::JAbstractPointer< JClass_t > JLANG::JEquals< JAbstractPointer< JClass_t > >

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 JClass_t * get () const override
 Get pointer. More...
 
virtual void set (JClass_t *p) override
 Set pointer. More...
 
template<class T >
void set (const JPointer< T > &pointer)
 Set pointer. More...
 
virtual void reset () override
 Reset pointer. More...
 
template<class T >
void reset (const JPointer< T > &pointer)
 Reset pointer. More...
 
void reset (JClass_t *p)
 Reset pointer. More...
 
JClass_t *const & getReference () const
 Get rereference to internal pointer. More...
 
JClass_t *& 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...
 
JClass_t * operator-> () const
 Smart pointer operator. More...
 
 operator JClass_t * () const
 Type conversion operator. More...
 

Protected Attributes

TString label
 
JClass_t * __p
 pointer to object More...
 

Detailed Description

Auxiliary data structure for TObject with a user defined label.

Definition at line 29 of file JRootObject.hh.

Constructor & Destructor Documentation

◆ JRootObject() [1/2]

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

Constructor.

Parameters
__ppointer to object

Definition at line 38 of file JRootObject.hh.

38  :
40  {
41  label = get()->GetName();
42  }
virtual JClass_t * get() const override
Get pointer.
Definition: JPointer.hh:64
JClass_t * __p
pointer to object
Definition: JPointer.hh:136

◆ JRootObject() [2/2]

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

Constructor.

Parameters
__ppointer to object
__labellabel

Definition at line 51 of file JRootObject.hh.

52  :
54  {
55  this->label = __label;
56  }

Member Function Documentation

◆ getLabel()

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

Get label.

Returns
label

Definition at line 64 of file JRootObject.hh.

65  {
66  TString buffer(this->label);
67 
68  const Ssiz_t pos = buffer.Last(LABEL_TERMINATOR);
69 
70  if (pos != kNPOS) {
71  buffer = buffer(0, pos);
72  }
73 
74  return buffer;
75  }
static const char LABEL_TERMINATOR
label terminator
Definition: JRootObject.hh:23

◆ setLabel()

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

Set label.

Parameters
labellabel

Definition at line 83 of file JRootObject.hh.

84  {
85  this->label = label;
86  }

◆ Draw()

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

Draw object.

Definition at line 92 of file JRootObject.hh.

93  {
94  this->get()->Draw(option.c_str());
95  }

◆ get()

template<class JClass_t >
virtual JClass_t* JLANG::JPointer< JClass_t >::get ( ) const
inlineoverridevirtualinherited

◆ set() [1/2]

template<class JClass_t >
virtual void JLANG::JPointer< JClass_t >::set ( JClass_t *  p)
inlineoverridevirtualinherited

Set pointer.

Parameters
ppointer to object

Implements JLANG::JAbstractPointer< JClass_t >.

Reimplemented in JLANG::JSharedPointer< JClass_t, JMemory_t >.

Definition at line 75 of file JPointer.hh.

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

◆ set() [2/2]

template<class JClass_t >
template<class T >
void JLANG::JPointer< JClass_t >::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  }
virtual void set(JClass_t *p) override
Set pointer.
Definition: JPointer.hh:75

◆ reset() [1/3]

template<class JClass_t >
virtual void JLANG::JPointer< JClass_t >::reset ( )
inlineoverridevirtualinherited

◆ reset() [2/3]

template<class JClass_t >
template<class T >
void JLANG::JPointer< JClass_t >::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  }
virtual void reset() override
Reset pointer.
Definition: JPointer.hh:84

◆ reset() [3/3]

template<class JClass_t >
void JLANG::JAbstractPointer< JClass_t >::reset ( JClass_t *  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  }
virtual void set(JClass_t *p)=0
Set pointer.
virtual void reset()=0
Reset pointer.
virtual JClass_t * get() const =0
Get pointer.

◆ getReference() [1/2]

template<class JClass_t >
JClass_t* const& JLANG::JPointer< JClass_t >::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]

template<class JClass_t >
JClass_t* & JLANG::JPointer< JClass_t >::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()

template<class JClass_t >
virtual bool JLANG::JAbstractPointer< JClass_t >::equals ( const JAbstractPointer< JClass_t > &  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()

template<class JClass_t >
bool JLANG::JAbstractPointer< JClass_t >::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->()

template<class JClass_t >
JClass_t* JLANG::JAbstractPointer< JClass_t >::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  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
bool is_valid() const
Check validity of pointer.
Exception for null pointer operation.
Definition: JException.hh:234

◆ operator JClass_t *()

template<class JClass_t >
JLANG::JAbstractPointer< JClass_t >::operator JClass_t * ( ) 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 98 of file JRootObject.hh.

◆ __p

template<class JClass_t >
JClass_t* JLANG::JPointer< JClass_t >::__p
protectedinherited

pointer to object

Definition at line 136 of file JPointer.hh.


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