ROOT output file.
More...
#include <JRootFile.hh>
|
| JRootOutputFile () |
| Default constructor.
|
|
| JRootOutputFile (const char *file_name) |
| Constructor.
|
|
| ~JRootOutputFile () |
| Destructor.
|
|
virtual void | open (const char *file_name) override |
| Open file.
|
|
virtual void | close () override |
| Close file.
|
|
TFile * | getFile () const |
| Get file.
|
|
virtual bool | is_open () const override |
| Check is file is open.
|
|
virtual void | reset () override |
| Reset pointer.
|
|
template<class T > |
void | reset (const JPointer< T > &pointer) |
| Reset pointer.
|
|
void | reset (JClass_t *p) |
| Reset pointer.
|
|
void | recreate () |
| Recreate object in memory.
|
|
void | create () |
| Create object in memory.
|
|
void | create (const unsigned int size) |
| Create array of objects in memory.
|
|
virtual JClass_t * | get () const override |
| Get pointer.
|
|
virtual void | set (JClass_t *p) override |
| Set pointer.
|
|
template<class T > |
void | set (const JPointer< T > &pointer) |
| Set pointer.
|
|
JClass_t *const & | getReference () const |
| Get rereference to internal pointer.
|
|
JClass_t *& | getReference () |
| Get rereference to internal pointer.
|
|
virtual bool | equals (const JAbstractPointer &object) const |
| Equals.
|
|
bool | is_valid () const |
| Check validity of pointer.
|
|
JClass_t * | operator-> () const |
| Smart pointer operator.
|
|
| operator JClass_t * () const |
| Type conversion operator.
|
|
|
static void | release (JClass_t *p) |
| Release memory.
|
|
static void | Throw (const bool option) |
| Enable/disable throw option.
|
|
static int | Throw (const JException_t &error, const int value=-1) |
| Throw exception or return error.
|
|
|
JClass_t * | __p |
| pointer to object
|
|
|
void | do_open (const char *file_name) |
| Open file.
|
|
void | do_close () |
| Close file.
|
|
ROOT output file.
This class implements the methods open() and close() of the JLANG::JAccessible interface.
Definition at line 196 of file JRootFile.hh.
◆ pointer_type
template<class JClass_t , template< class > class JMemory_t = JNew>
◆ memory_type
template<class JClass_t , template< class > class JMemory_t = JNew>
◆ JRootOutputFile() [1/2]
JROOT::JRootOutputFile::JRootOutputFile |
( |
| ) |
|
|
inline |
Default constructor.
Definition at line 203 of file JRootFile.hh.
203 :
205 {}
JRootFile()
Default constructor.
◆ JRootOutputFile() [2/2]
JROOT::JRootOutputFile::JRootOutputFile |
( |
const char * | file_name | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 213 of file JRootFile.hh.
213 :
215 {
217 }
void do_open(const char *file_name)
Open file.
◆ ~JRootOutputFile()
JROOT::JRootOutputFile::~JRootOutputFile |
( |
| ) |
|
|
inline |
Destructor.
The destructor writes and closes the file if it is still open.
Definition at line 225 of file JRootFile.hh.
226 {
228 }
void do_close()
Close file.
◆ open()
virtual void JROOT::JRootOutputFile::open |
( |
const char * | file_name | ) |
|
|
inlineoverridevirtual |
◆ close()
virtual void JROOT::JRootOutputFile::close |
( |
| ) |
|
|
inlineoverridevirtual |
◆ do_open()
void JROOT::JRootOutputFile::do_open |
( |
const char * | file_name | ) |
|
|
inlineprivate |
Open file.
The file is not opened when a file exists with the given name.
- Parameters
-
Definition at line 260 of file JRootFile.hh.
261 {
262 set(TFile::Open(file_name,
"CREATE"));
263
266 }
267 }
#define MAKE_EXCEPTION(JException_t, A)
Make exception.
virtual void set(JClass_t *p) override
Set pointer.
static void Throw(const bool option)
virtual bool is_open() const override
Check is file is open.
◆ do_close()
void JROOT::JRootOutputFile::do_close |
( |
| ) |
|
|
inlineprivate |
Close file.
This method calls the TFile::Write method before closing the file.
Definition at line 274 of file JRootFile.hh.
275 {
279 }
280
282 }
virtual void reset() override
Reset pointer.
TFile * getFile() const
Get file.
◆ getFile()
TFile * JROOT::JRootFile::getFile |
( |
| ) |
const |
|
inlineinherited |
Get file.
- Returns
- pointer to file
Definition at line 66 of file JRootFile.hh.
67 {
69 }
virtual JClass_t * get() const override
Get pointer.
◆ is_open()
virtual bool JROOT::JRootFile::is_open |
( |
| ) |
const |
|
inlineoverridevirtualinherited |
◆ reset() [1/3]
template<class JClass_t , template< class > class JMemory_t = JNew>
|
inlineoverridevirtualinherited |
Reset pointer.
The allocated memory is released.
Reimplemented from JLANG::JPointer< JClass_t >.
Reimplemented in JLANG::JSharedPointer< JClass_t, JMemory_t >, JLANG::JSharedPointer< JAbstractAutoPointer< JBase_t > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JDAQSummaryslice > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JHead_t > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JTail_t > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JTypeList< JDAQEvent, JNullType > > >, JLANG::JSharedPointer< JAccessibleObjectIterator< KM3NETDAQ::JDAQEvent > >, JLANG::JSharedPointer< JAccessibleObjectIterator< T > >, JLANG::JSharedPointer< JAccessibleObjectOutput< T > >, JLANG::JSharedPointer< JBase_t >, JLANG::JSharedPointer< JFIT::JMEstimator >, JLANG::JSharedPointer< JLOGGER::JLogger >, JLANG::JSharedPointer< JNET::JControlHost >, JLANG::JSharedPointer< JObjectIterator< T > >, JLANG::JSharedPointer< JObjectOutput< JHead_t > >, JLANG::JSharedPointer< JObjectOutput< JTail_t > >, JLANG::JSharedPointer< JObjectOutput< T > >, JLANG::JSharedPointer< JParserElementInterface >, JLANG::JSharedPointer< JPropertiesElementInterface >, JLANG::JSharedPointer< JRadiation >, JLANG::JSharedPointer< JRewindableObjectIterator< const event_type > >, JLANG::JSharedPointer< JRewindableObjectIterator< JHead_t > >, JLANG::JSharedPointer< JRewindableObjectIterator< JTail_t > >, JLANG::JSharedPointer< JRewindableObjectIterator< T > >, JLANG::JSharedPointer< JTOOLS::JMultiMapTransformer >, JLANG::JSharedPointer< JTRIGGER::JDAQHitSelector >, JLANG::JSharedPointer< JTRIGGER::JMatch >, and JLANG::JSharedPointer< match_type >.
Definition at line 42 of file JStorage.hh.
43 {
46 }
47
49 }
bool is_valid() const
Check validity of pointer.
virtual void reset() override
Reset pointer.
void release()
Release memory.
◆ reset() [2/3]
template<class JClass_t , template< class > class JMemory_t = JNew>
template<class T >
Reset pointer.
- Parameters
-
Definition at line 108 of file JPointer.hh.
109 {
110 this->
reset(pointer.get());
111 }
◆ reset() [3/3]
template<class JClass_t >
Reset pointer.
- Parameters
-
Definition at line 94 of file JAbstractPointer.hh.
95 {
96 if (this->
get() != p) {
97
99
100 if (p != NULL) {
102 }
103 }
104 }
virtual void set(JClass_t *p)=0
Set pointer.
virtual JClass_t * get() const =0
Get pointer.
virtual void reset()=0
Reset pointer.
◆ recreate()
template<class JClass_t , template< class > class JMemory_t = JNew>
Recreate object in memory.
A new object is created if no memory is allocated yet, else the previously created object is maintained.
Definition at line 57 of file JStorage.hh.
58 {
60 this->
set(memory_type::create());
61 }
62 }
◆ create() [1/2]
template<class JClass_t , template< class > class JMemory_t = JNew>
Create object in memory.
The memory allocated by a previously created object will be released.
Definition at line 69 of file JStorage.hh.
70 {
71 this->
reset(memory_type::create());
72 }
◆ create() [2/2]
template<class JClass_t , template< class > class JMemory_t = JNew>
void JLANG::JStorage< JClass_t, JMemory_t >::create |
( |
const unsigned int | size | ) |
|
|
inlineinherited |
Create array of objects in memory.
The memory allocated by previously created objects will be released.
- Parameters
-
Definition at line 81 of file JStorage.hh.
82 {
83 this->
reset(memory_type::create(size));
84 }
◆ release() [1/2]
template<class JClass_t , template< class > class JMemory_t = JNew>
Release memory.
Definition at line 91 of file JStorage.hh.
92 {
93 memory_type::release(this->
get());
94 }
◆ release() [2/2]
template<class JClass_t >
static void JLANG::JNew< JClass_t >::release |
( |
JClass_t * | p | ) |
|
|
inlinestaticinherited |
Release memory.
- Parameters
-
Definition at line 41 of file JMemory.hh.
◆ get()
template<class JClass_t >
|
inlineoverridevirtualinherited |
◆ set() [1/2]
template<class JClass_t >
|
inlineoverridevirtualinherited |
Set pointer.
- Parameters
-
Implements JLANG::JAbstractPointer< JClass_t >.
Reimplemented in JLANG::JSharedPointer< JClass_t, JMemory_t >, JLANG::JSharedPointer< JAbstractAutoPointer< JBase_t > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JDAQSummaryslice > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JHead_t > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JTail_t > >, JLANG::JSharedPointer< JAccessibleObjectIterator< JTypeList< JDAQEvent, JNullType > > >, JLANG::JSharedPointer< JAccessibleObjectIterator< KM3NETDAQ::JDAQEvent > >, JLANG::JSharedPointer< JAccessibleObjectIterator< T > >, JLANG::JSharedPointer< JAccessibleObjectOutput< T > >, JLANG::JSharedPointer< JBase_t >, JLANG::JSharedPointer< JFIT::JMEstimator >, JLANG::JSharedPointer< JLOGGER::JLogger >, JLANG::JSharedPointer< JNET::JControlHost >, JLANG::JSharedPointer< JObjectIterator< T > >, JLANG::JSharedPointer< JObjectOutput< JHead_t > >, JLANG::JSharedPointer< JObjectOutput< JTail_t > >, JLANG::JSharedPointer< JObjectOutput< T > >, JLANG::JSharedPointer< JParserElementInterface >, JLANG::JSharedPointer< JPropertiesElementInterface >, JLANG::JSharedPointer< JRadiation >, JLANG::JSharedPointer< JRewindableObjectIterator< const event_type > >, JLANG::JSharedPointer< JRewindableObjectIterator< JHead_t > >, JLANG::JSharedPointer< JRewindableObjectIterator< JTail_t > >, JLANG::JSharedPointer< JRewindableObjectIterator< T > >, JLANG::JSharedPointer< JTOOLS::JMultiMapTransformer >, JLANG::JSharedPointer< JTRIGGER::JDAQHitSelector >, JLANG::JSharedPointer< JTRIGGER::JMatch >, and JLANG::JSharedPointer< match_type >.
Definition at line 75 of file JPointer.hh.
◆ set() [2/2]
template<class JClass_t >
template<class T >
Set pointer.
- Parameters
-
Definition at line 96 of file JPointer.hh.
97 {
98 this->
set(pointer.get());
99 }
◆ getReference() [1/2]
template<class JClass_t >
Get rereference to internal pointer.
- Returns
- reference to internal pointer
Definition at line 119 of file JPointer.hh.
◆ getReference() [2/2]
template<class JClass_t >
Get rereference to internal pointer.
- Returns
- reference to internal pointer
Definition at line 130 of file JPointer.hh.
◆ equals()
template<class JClass_t >
Equals.
The equality is evaluated by comparison of the internal pointers.
- Parameters
-
- 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 >
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 >
Smart pointer operator.
- Returns
- pointer to object
Definition at line 112 of file JAbstractPointer.hh.
113 {
115 THROW(JNullPointerException,
"JAbstractPointer::operator->()");
116 else
118 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
◆ operator JClass_t *()
template<class JClass_t >
◆ Throw() [1/2]
Enable/disable throw option.
- Parameters
-
option | true enable; false disable |
Definition at line 37 of file JThrow.hh.
◆ Throw() [2/2]
Throw exception or return error.
- Parameters
-
error | exception |
value | return code |
- Returns
- return code
Definition at line 51 of file JThrow.hh.
52 {
54
56 throw error;
57 }
58
59 cerr << error.what() << endl;
60
61 return value;
62 }
◆ __p
template<class JClass_t >
◆ do_throw
throw option
Set default throw option to true
.
Definition at line 28 of file JThrow.hh.
The documentation for this class was generated from the following file: