Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Friends | List of all members
JROOT::JManager< JKey_t, JValue_t > Class Template Reference

Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys. More...

#include <JManager.hh>

Inheritance diagram for JROOT::JManager< JKey_t, JValue_t >:
JLANG::JPointer< JClass_t > std::map< JKey_t, JPointer< JValue_t > > JLANG::JAbstractPointer< JClass_t > JLANG::JEquals< JAbstractPointer< JClass_t > >

Public Types

typedef JPointer< JValue_t > ptr_type
 
typedef std::map< JKey_t,
ptr_type
map_type
 

Public Member Functions

 JManager ()
 Default constructor. More...
 
 JManager (JValue_t *master, char wildcard= '%', JFormat_t format=JFormat_t())
 Constructor. More...
 
 JManager (JValue_t *master, const std::string &name, char wildcard= '%', std::ios::fmtflags format=std::ios::fmtflags())
 Constructor. More...
 
 JManager (const JManager &manager)
 Copy constructor. More...
 
void clear ()
 Clear client objects. More...
 
JValue_t * operator[] (JKey_t key)
 Get pointer to object for given key. More...
 
void Read (TDirectory &in)
 Read objects from file. More...
 
void Write (TDirectory &out, const bool wm=false)
 Write objects to file. More...
 
void Write (const char *file_name, const bool wm=false)
 Write objects to file. 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...
 

Static Public Member Functions

static JManager Read (TDirectory &in, const char *const master, const char wildcard)
 Read objects from file into manager. More...
 

Public Attributes

char wc
 
JFormat_t fmt
 

Protected Attributes

JClass_t * __p
 pointer to object More...
 

Friends

TFile & operator>> (TFile &file, JManager &object)
 Read manager from file. More...
 
TFile & operator<< (TFile &file, JManager &object)
 Write manager to file. More...
 

Detailed Description

template<class JKey_t, class JValue_t>
class JROOT::JManager< JKey_t, JValue_t >

Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.


For each use of the map operator [], it is checked whether the corresponding client object exists.
If the corresponding client object does not yet exists, a clone is made of the master object (i.e. the 'client').
The name of the newly created object is derived from the name of the master object by replacing the wild card character with the value of the key according the optional format specifier.

Definition at line 43 of file JManager.hh.

Member Typedef Documentation

template<class JKey_t, class JValue_t>
typedef JPointer<JValue_t> JROOT::JManager< JKey_t, JValue_t >::ptr_type

Definition at line 49 of file JManager.hh.

template<class JKey_t, class JValue_t>
typedef std::map<JKey_t, ptr_type> JROOT::JManager< JKey_t, JValue_t >::map_type

Definition at line 50 of file JManager.hh.

Constructor & Destructor Documentation

template<class JKey_t, class JValue_t>
JROOT::JManager< JKey_t, JValue_t >::JManager ( )
inline

Default constructor.

Definition at line 55 of file JManager.hh.

56  {}
template<class JKey_t, class JValue_t>
JROOT::JManager< JKey_t, JValue_t >::JManager ( JValue_t *  master,
char  wildcard = '%',
JFormat_t  format = JFormat_t() 
)
inline

Constructor.

Note that the manager owns the master object pointed to.
For saving the objects to file, use method JManager::Write (all objects are detached from the current ROOT directory).

Parameters
mastermaster object
wildcardwild card character
formatformat specifier for replacement of wildcard character by value of key

Definition at line 70 of file JManager.hh.

72  :
74  map_type(),
75  wc (wildcard),
76  fmt(format)
77  {
78  using namespace std;
79  using namespace JPP;
80 
81  if (!this->is_valid()) {
82  THROW(JException, "No valid master");
83  }
84 
85  if (string(this->get()->GetName()).find(wc) == string::npos) {
86  THROW(JException, "Invalid wildcard <" << this->get()->GetName() << "> '" << wc << "'");
87  }
88 
89  resetObject(this->get(), true);
90  }
JPointer< JValue_t > ptr_type
Definition: JManager.hh:49
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
then echo Test string reversed by master(hit< return > to continue)." JProcess -c "JEcho" -rC fi if (( 1 ))
std::map< JKey_t, ptr_type > map_type
Definition: JManager.hh:50
bool is_valid() const
Check validity of pointer.
bool resetObject(JManager< JKey_t, JValue_t > *object, const bool reset=false)
Reset JManager object.
Definition: JManager.hh:366
JFormat_t fmt
Definition: JManager.hh:354
template<class JKey_t, class JValue_t>
JROOT::JManager< JKey_t, JValue_t >::JManager ( JValue_t *  master,
const std::string &  name,
char  wildcard = '%',
std::ios::fmtflags  format = std::ios::fmtflags() 
)
inline

Constructor.

Note that the manager owns the master object pointed to.
For saving the objects to file, use method JManager::Write (all objects are detached from the current ROOT directory).

Parameters
mastermaster object
namename of master
wildcardwild card character
formatformat specifier for replacement of wildcard character by value of key

Definition at line 105 of file JManager.hh.

108  :
109  ptr_type(master),
110  map_type(),
111  wc (wildcard),
112  fmt(format)
113  {
114  using namespace std;
115  using namespace JPP;
116 
117  if (!this->is_valid()) {
118  THROW(JException, "No valid master");
119  }
120 
121  this->get()->SetName(name.c_str());
122 
123  if (string(this->get()->GetName()).find(wc) == string::npos) {
124  THROW(JException, "Invalid wildcard <" << this->get()->GetName() << "> '" << wc << "'");
125  }
126 
127  resetObject(this->get(), true);
128  }
JPointer< JValue_t > ptr_type
Definition: JManager.hh:49
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
then echo Test string reversed by master(hit< return > to continue)." JProcess -c "JEcho" -rC fi if (( 1 ))
std::map< JKey_t, ptr_type > map_type
Definition: JManager.hh:50
bool is_valid() const
Check validity of pointer.
bool resetObject(JManager< JKey_t, JValue_t > *object, const bool reset=false)
Reset JManager object.
Definition: JManager.hh:366
then echo n User name
Definition: JCookie.sh:45
JFormat_t fmt
Definition: JManager.hh:354
template<class JKey_t, class JValue_t>
JROOT::JManager< JKey_t, JValue_t >::JManager ( const JManager< JKey_t, JValue_t > &  manager)
inline

Copy constructor.

Note that the master object of the given manager is cloned and the wildcard copied.
The client objects are not copied.

Parameters
managermanager

Definition at line 139 of file JManager.hh.

139  :
140  ptr_type(NULL),
141  map_type(),
142  wc (manager.wc),
143  fmt(manager.fmt)
144  {
145  using namespace JPP;
146 
147  if (manager.is_valid()) {
148 
149  this->set((JValue_t*) manager.get()->Clone());
150 
151  resetObject(this->get(), true);
152  }
153  }
JPointer< JValue_t > ptr_type
Definition: JManager.hh:49
std::map< JKey_t, ptr_type > map_type
Definition: JManager.hh:50
bool is_valid() const
Check validity of pointer.
bool resetObject(JManager< JKey_t, JValue_t > *object, const bool reset=false)
Reset JManager object.
Definition: JManager.hh:366
JFormat_t fmt
Definition: JManager.hh:354
virtual void set(JClass_t *p) override
Set pointer.
Definition: JPointer.hh:75
virtual JClass_t * get() const override
Get pointer.
Definition: JPointer.hh:64

Member Function Documentation

template<class JKey_t, class JValue_t>
void JROOT::JManager< JKey_t, JValue_t >::clear ( )
inline

Clear client objects.

Definition at line 159 of file JManager.hh.

160  {
161  for (typename map_type::iterator i = this->begin(); i != this->end(); ++i) {
162  i->second.reset();
163  }
164 
165  this->clear();
166  }
void clear()
Clear client objects.
Definition: JManager.hh:159
template<class JKey_t, class JValue_t>
JValue_t* JROOT::JManager< JKey_t, JValue_t >::operator[] ( JKey_t  key)
inline

Get pointer to object for given key.

Parameters
keykey
Returns
pointer to client object

Definition at line 175 of file JManager.hh.

176  {
177  using namespace std;
178  using namespace JPP;
179 
180  typename map_type::iterator i = this->find(key);
181 
182  if (i == this->end()) {
183 
184  string buffer = this->get()->GetName();
185  string::size_type ipos = buffer.find(wc);
186 
187  ostringstream os;
188 
189  fmt.put(os);
190 
191  os << key;
192 
193  buffer.replace(ipos, 1, os.str());
194 
195  JValue_t* p = (JValue_t*) this->get()->Clone(buffer.c_str());
196 
197  resetObject(p, true);
198 
199  this->insert(make_pair(key,p));
200 
201  return p;
202 
203  } else {
204 
205  return i->second;
206  }
207  }
void put(std::ostream &out) const
Put format specificaton to given output stream.
Definition: JManip.hh:597
bool resetObject(JManager< JKey_t, JValue_t > *object, const bool reset=false)
Reset JManager object.
Definition: JManager.hh:366
JFormat_t fmt
Definition: JManager.hh:354
template<class JKey_t, class JValue_t>
static JManager JROOT::JManager< JKey_t, JValue_t >::Read ( TDirectory &  in,
const char *const  master,
const char  wildcard 
)
inlinestatic

Read objects from file into manager.

Parameters
ininput file or directory
mastermaster name
wildcardwild card character
Returns
manager

Definition at line 218 of file JManager.hh.

219  {
220  using namespace std;
221  using namespace JPP;
222 
223  JManager manager;
224 
225  TString buffer = master;
226 
227  const Ssiz_t pos = buffer.Index(wildcard);
228 
229  const TString a = buffer(0, pos);
230  const TString b = buffer(pos+1, buffer.Length());
231 
232  buffer.ReplaceAll("[", "\\[");
233  buffer.ReplaceAll("]", "\\]");
234 
235  buffer.ReplaceAll(wildcard, ".*");
236 
237  const TRegexp regexp(buffer);
238 
239  TIter iter(in.GetListOfKeys());
240 
241  for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
242 
243  const TString tag(key->GetName());
244 
245  // option match
246 
247  if (tag.Index(regexp) != -1) {
248 
249  JValue_t* p = dynamic_cast<JValue_t*>(key->ReadObj());
250 
251  if (p != NULL) {
252 
253  resetObject(p, false);
254 
255  string buffer = p->GetName();
256 
257  if (a.Length() != 0) { buffer.replace(buffer.find(a), a.Length(), ""); }
258  if (b.Length() != 0) { buffer.replace(buffer.find(b), b.Length(), ""); }
259 
260  JKey_t key;
261 
262  istringstream(buffer) >> key;
263 
264  manager.insert(make_pair(key, p));
265  }
266  }
267  }
268 
269  return manager;
270  }
then echo Test string reversed by master(hit< return > to continue)." JProcess -c "JEcho" -rC fi if (( 1 ))
bool resetObject(JManager< JKey_t, JValue_t > *object, const bool reset=false)
Reset JManager object.
Definition: JManager.hh:366
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
Definition: JManager.hh:43
then JCalibrateToT a
Definition: JTuneHV.sh:116
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:38
template<class JKey_t, class JValue_t>
void JROOT::JManager< JKey_t, JValue_t >::Read ( TDirectory &  in)
inline

Read objects from file.

Parameters
ininput file or directory

Definition at line 278 of file JManager.hh.

279  {
280  if (this->is_valid()) {
281 
282  JManager buffer = Read(in, this->get()->GetName(), this->wc);
283 
284  this->swap(buffer);
285  }
286  }
bool is_valid() const
Check validity of pointer.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
Definition: JManager.hh:43
static JManager Read(TDirectory &in, const char *const master, const char wildcard)
Read objects from file into manager.
Definition: JManager.hh:218
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:38
template<class JKey_t, class JValue_t>
void JROOT::JManager< JKey_t, JValue_t >::Write ( TDirectory &  out,
const bool  wm = false 
)
inline

Write objects to file.

Parameters
outoutput file or directory
wmwrite master

Definition at line 295 of file JManager.hh.

296  {
297  for (typename map_type::iterator i = this->begin(); i != this->end(); ++i) {
298  out.WriteTObject(i->second);
299  }
300 
301  if (wm) {
302  out.WriteTObject(this->get());
303  }
304  }
template<class JKey_t, class JValue_t>
void JROOT::JManager< JKey_t, JValue_t >::Write ( const char *  file_name,
const bool  wm = false 
)
inline

Write objects to file.

Parameters
file_namefile name
wmwrite master

Definition at line 313 of file JManager.hh.

314  {
315  TFile out(file_name, "RECREATE");
316 
317  this->Write(out, wm) ;
318 
319  out.Write();
320  out.Close();
321  }
void Write(TDirectory &out, const bool wm=false)
Write objects to file.
Definition: JManager.hh:295
template<class JClass_t>
virtual JClass_t* JLANG::JPointer< JClass_t >::get ( ) const
inlineoverridevirtualinherited
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 >, JLANG::JSharedPointer< JFlux >, JLANG::JSharedPointer< JPHYSICS::JRadiation >, JLANG::JSharedPointer< JWeightEvent >, JLANG::JSharedPointer< JAccessibleObjectIterator< KM3NETDAQ::KM3NETDAQ::JDAQEvent > >, JLANG::JSharedPointer< const TFormula >, JLANG::JSharedPointer< JObjectIterator< T > >, JLANG::JSharedPointer< JFIT::JMEstimator >, JLANG::JSharedPointer< JAbstractAutoPointer< JBase_t > >, JLANG::JSharedPointer< JTRIGGER::JDAQHitSelector >, JLANG::JSharedPointer< JAccessibleObjectIterator< JNullType > >, JLANG::JSharedPointer< match_type >, JLANG::JSharedPointer< JAccessibleObjectIterator< JDAQSummaryslice > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JTypeList< JDAQEvent, JTypelist_t > > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JTail_t > >, JLANG::JSharedPointer< JLOGGER::JLogger >, JLANG::JSharedPointer< JAccessibleObjectIterator< T > >, JLANG::JSharedPointer< JParserElementInterface >, JLANG::JSharedPointer< JExceptionHandler >, JLANG::JSharedPointer< JObjectOutput< JHead_t > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JHead_t > >, JLANG::JSharedPointer< JRewindableObjectIterator< JTail_t > >, JLANG::JSharedPointer< JRewindableObjectIterator< JHead_t > >, JLANG::JSharedPointer< JObjectOutput< T > >, JLANG::JSharedPointer< JBase_t >, JLANG::JSharedPointer< JObjectOutput< JTail_t > >, JLANG::JSharedPointer< JPropertiesElementInterface >, JLANG::JSharedPointer< JTRIGGER::JMatch >, JLANG::JSharedPointer< JRewindableObjectIterator< const T > >, JLANG::JSharedPointer< JRewindableObjectIterator< T > >, JLANG::JSharedPointer< JAccessibleObjectOutput< T > >, JLANG::JSharedPointer< JNET::JControlHost >, and JLANG::JSharedPointer< JTOOLS::JMultiMapTransformer >.

Definition at line 75 of file JPointer.hh.

76  {
77  this->__p = p;
78  }
JClass_t * __p
pointer to object
Definition: JPointer.hh:136
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
virtual JClass_t * get() const override
Get pointer.
Definition: JPointer.hh:64
template<class JClass_t>
virtual void JLANG::JPointer< JClass_t >::reset ( )
inlineoverridevirtualinherited

Reset pointer.

Implements JLANG::JAbstractPointer< JClass_t >.

Reimplemented in JLANG::JSharedPointer< JClass_t, JMemory_t >, JLANG::JSharedPointer< JFlux >, JLANG::JSharedPointer< JPHYSICS::JRadiation >, JLANG::JSharedPointer< JWeightEvent >, JLANG::JSharedPointer< JAccessibleObjectIterator< KM3NETDAQ::KM3NETDAQ::JDAQEvent > >, JLANG::JSharedPointer< const TFormula >, JLANG::JSharedPointer< JObjectIterator< T > >, JLANG::JSharedPointer< JFIT::JMEstimator >, JLANG::JSharedPointer< JAbstractAutoPointer< JBase_t > >, JLANG::JSharedPointer< JTRIGGER::JDAQHitSelector >, JLANG::JSharedPointer< JAccessibleObjectIterator< JNullType > >, JLANG::JSharedPointer< match_type >, JLANG::JSharedPointer< JAccessibleObjectIterator< JDAQSummaryslice > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JTypeList< JDAQEvent, JTypelist_t > > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JTail_t > >, JLANG::JSharedPointer< JLOGGER::JLogger >, JLANG::JSharedPointer< JAccessibleObjectIterator< T > >, JLANG::JSharedPointer< JParserElementInterface >, JLANG::JSharedPointer< JExceptionHandler >, JLANG::JSharedPointer< JObjectOutput< JHead_t > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JHead_t > >, JLANG::JSharedPointer< JRewindableObjectIterator< JTail_t > >, JLANG::JSharedPointer< JRewindableObjectIterator< JHead_t > >, JLANG::JSharedPointer< JObjectOutput< T > >, JLANG::JSharedPointer< JBase_t >, JLANG::JSharedPointer< JObjectOutput< JTail_t > >, JLANG::JSharedPointer< JPropertiesElementInterface >, JLANG::JSharedPointer< JTRIGGER::JMatch >, JLANG::JSharedPointer< JRewindableObjectIterator< const T > >, JLANG::JSharedPointer< JRewindableObjectIterator< T > >, JLANG::JSharedPointer< JAccessibleObjectOutput< T > >, JLANG::JSharedPointer< JNET::JControlHost >, JLANG::JSharedPointer< JTOOLS::JMultiMapTransformer >, JLANG::JStorage< JClass_t, JMemory_t >, JLANG::JStorage< JDETECTOR::JK40Simulator, JNew >, JLANG::JStorage< JBuildL2_t, JNew >, JLANG::JStorage< JAccessibleObjectIterator< JTail_t >, JNew >, JLANG::JStorage< match_type, JNew >, JLANG::JStorage< JObjectOutput< JTail_t >, JNew >, JLANG::JStorage< JAccessibleObjectIterator< JNullType >, JNew >, JLANG::JStorage< JAccessibleObjectIterator< KM3NETDAQ::KM3NETDAQ::JDAQEvent >, JNew >, JLANG::JStorage< JDETECTOR::JCLBDefaultSimulatorInterface::JStateMachine, JNew >, JLANG::JStorage< JDETECTOR::JPMTSimulator, JNew >, JLANG::JStorage< JObjectIterator< T >, JNew >, JLANG::JStorage< JAccessibleObjectIterator< T >, JNew >, JLANG::JStorage< JRewindableObjectIterator< JTail_t >, JNew >, JLANG::JStorage< JTOOLS::JFunction1D, JNew >, JLANG::JStorage< JDETECTOR::JCLBSimulator, JNew >, JLANG::JStorage< JModuleRouter, JNew >, JLANG::JStorage< JTOOLS::JMultiMapTransformer, JNew >, JLANG::JStorage< JTriggerNB, JNew >, JLANG::JStorage< JRewindableObjectIterator< const T >, JNew >, JLANG::JStorage< JBase_t, JNew >, JLANG::JStorage< const TFormula, JNew >, JLANG::JStorage< JWeightEvent, JNew >, JLANG::JStorage< JTrigger3DMuon, JNew >, JLANG::JStorage< JTrigger3DShower, JNew >, JLANG::JStorage< JParserElementInterface, JNew >, JLANG::JStorage< JFIT::JMEstimator, JNew >, JLANG::JStorage< JAbstractAutoPointer< JBase_t >, JNew >, JLANG::JStorage< JAccessibleObjectIterator< JHead_t >, JNew >, JLANG::JStorage< JTRIGGER::JDAQHitSelector, JNew >, JLANG::JStorage< JTRIGGER::JMatch, JNew >, JLANG::JStorage< JPHYSICS::JRadiation, JNew >, JLANG::JStorage< JDETECTOR::JCLBDefaultSimulatorInterface::JTDC, JNew >, JLANG::JStorage< JLANG::JMultiPipe< T, N >, JNew >, JLANG::JStorage< JServerSocket, JNew >, JLANG::JStorage< JAccessibleObjectIterator< JDAQSummaryslice >, JNew >, JLANG::JStorage< JObjectOutput< JHead_t >, JNew >, JLANG::JStorage< JAccessibleObjectIterator< JTypeList< JDAQEvent, JTypelist_t > >, JNew >, JLANG::JStorage< JExceptionHandler, JNew >, JLANG::JStorage< TFile >, JLANG::JStorage< JFlux, JNew >, JLANG::JStorage< JTimesliceRouter, JNew >, JLANG::JStorage< JControlHost_t, JNew >, JLANG::JStorage< JRewindableObjectIterator< T >, JNew >, JLANG::JStorage< JPropertiesElementInterface, JNew >, JLANG::JStorage< JRewindableObjectIterator< JHead_t >, JNew >, JLANG::JStorage< JBuildL1_t, JNew >, JLANG::JStorage< JObjectOutput< T >, JNew >, JLANG::JStorage< JIO::JWriter, JNew >, JLANG::JStorage< JNET::JControlHost, JNew >, JLANG::JStorage< JAccessibleObjectOutput< T >, JNew >, JLANG::JStorage< JIO::JReader, JNew >, JLANG::JStorage< JLOGGER::JLogger, JNew >, and JLANG::JStorage< JTriggerMXShower, JNew >.

Definition at line 84 of file JPointer.hh.

85  {
86  this->__p = NULL;
87  }
JClass_t * __p
pointer to object
Definition: JPointer.hh:136
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 JClass_t * get() const override
Get pointer.
Definition: JPointer.hh:64
virtual void reset() override
Reset pointer.
Definition: JPointer.hh:84
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 reset()=0
Reset pointer.
virtual void set(JClass_t *p)=0
Set pointer.
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  }
JClass_t * __p
pointer to object
Definition: JPointer.hh:136
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  }
JClass_t * __p
pointer to object
Definition: JPointer.hh:136
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  }
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  }
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  }
bool is_valid() const
Check validity of pointer.
Exception for null pointer operation.
Definition: JException.hh:216
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  }

Friends And Related Function Documentation

template<class JKey_t, class JValue_t>
TFile& operator>> ( TFile &  file,
JManager< JKey_t, JValue_t > &  object 
)
friend

Read manager from file.

Parameters
filefile
objectmanager
Returns
file

Definition at line 331 of file JManager.hh.

332  {
333  object.Read(file);
334 
335  return file;
336  }
then usage $script< string identifier >< detectorfile > input file(toashort file)+" "\nNote that the input files and toashort files should be one-to-one related." fi if (( $
template<class JKey_t, class JValue_t>
TFile& operator<< ( TFile &  file,
JManager< JKey_t, JValue_t > &  object 
)
friend

Write manager to file.

Parameters
filefile
objectmanager
Returns
file

Definition at line 346 of file JManager.hh.

347  {
348  object.Write(file);
349 
350  return file;
351  }
then usage $script< string identifier >< detectorfile > input file(toashort file)+" "\nNote that the input files and toashort files should be one-to-one related." fi if (( $

Member Data Documentation

template<class JKey_t, class JValue_t>
char JROOT::JManager< JKey_t, JValue_t >::wc

Definition at line 353 of file JManager.hh.

template<class JKey_t, class JValue_t>
JFormat_t JROOT::JManager< JKey_t, JValue_t >::fmt

Definition at line 354 of file JManager.hh.

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: