Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

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  }
TObject * __p
pointer to object
Definition: JPointer.hh:136
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  }
TObject * __p
pointer to object
Definition: JPointer.hh:136

Member Function Documentation

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  }
static const char LABEL_TERMINATOR
label terminator
Definition: JRootObject.hh:21
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  }
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  }
void Draw(const std::string &option) const
Draw object.
Definition: JRootObject.hh:90
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  }
TObject * __p
pointer to object
Definition: JPointer.hh:136
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  }
TObject * __p
pointer to object
Definition: JPointer.hh:136
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  }
virtual JClass_t * get() const
Get pointer.
Definition: JPointer.hh:64
virtual void set(TObject *p)
Set pointer.
Definition: JPointer.hh:75
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  }
TObject * __p
pointer to object
Definition: JPointer.hh:136
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  }
virtual void reset()
Reset pointer.
Definition: JPointer.hh:84
virtual JClass_t * get() const
Get pointer.
Definition: JPointer.hh:64
void JLANG::JAbstractPointer< TObject >::reset ( TObject p)
inlineinherited

Reset pointer.

Parameters
ppointer to object

Definition at line 92 of file JAbstractPointer.hh.

93  {
94  if (this->get() != p) {
95 
96  this->reset();
97 
98  if (p != NULL) {
99  this->set(p);
100  }
101  }
102  }
virtual void reset()=0
Reset pointer.
virtual void set(TObject *p)=0
Set pointer.
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  }
TObject * __p
pointer to object
Definition: JPointer.hh:136
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  }
TObject * __p
pointer to object
Definition: JPointer.hh:136
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 48 of file JAbstractPointer.hh.

49  {
50  return this->get() == object.get();
51  }
bool JLANG::JAbstractPointer< TObject >::is_valid ( ) const
inlineinherited

Check validity of pointer.

Returns
true if pointer not null; else false

Definition at line 81 of file JAbstractPointer.hh.

82  {
83  return this->get() != NULL;
84  }
TObject * JLANG::JAbstractPointer< TObject >::operator-> ( ) const
inlineinherited

Smart pointer operator.

Returns
pointer to object

Definition at line 110 of file JAbstractPointer.hh.

111  {
112  if (!is_valid())
113  throw JNullPointerException("JAbstractPointer::operator->()");
114  else
115  return this->get();
116  }
bool is_valid() const
Check validity of pointer.
Exception for null pointer operation.
Definition: JException.hh:198
JLANG::JAbstractPointer< TObject >::operator TObject * ( ) const
inlineinherited

Type conversion operator.

Returns
pointer to object

Definition at line 124 of file JAbstractPointer.hh.

125  {
126  return this->get();
127  }

Member Data Documentation

TString JGIZMO::JRootObject::label
protected

Definition at line 96 of file JRootObject.hh.

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: