AAObject is a base class for I/O-classes that adds the possibility to add 'user' information which will also be stored in the ROOT file.
More...
#include <AAObject.hh>
|
int | idx (const std::string &key) const |
| Get index in user data of the item with given key. More...
|
|
bool | haveusr (const std::string &key) const |
| Check availability of user data of the item with given key. More...
|
|
int | idxusr_checked (const std::string &key) const |
| Get index in user data of the item with given key. More...
|
|
double | getusr (const std::string &key) const |
| Get user data item with given key. More...
|
|
void | setusr (const std::string &key, double value) |
| Set user data item with given key. More...
|
|
bool | delusr (const std::string &key) |
| Remove (first) user data item with given key. More...
|
|
void | clearusr () |
| Clear user data. More...
|
|
void | printusr (std::ostream &out=std::cout) |
| Print user data (i.e. More...
|
|
| AAObject () |
| Default constructor. More...
|
|
| ~AAObject () |
|
const char * | __str__ () const |
| Get class name. More...
|
|
AAObject is a base class for I/O-classes that adds the possibility to add 'user' information which will also be stored in the ROOT file.
Definition at line 18 of file AAObject.hh.
◆ AAObject()
◆ ~AAObject()
◆ idx()
int AAObject::idx |
( |
const std::string & |
key | ) |
const |
|
inline |
Get index in user data of the item with given key.
- Parameters
-
- Returns
- index (-1 if key does not exists)
Definition at line 29 of file AAObject.hh.
◆ haveusr()
bool AAObject::haveusr |
( |
const std::string & |
key | ) |
const |
|
inline |
Check availability of user data of the item with given key.
- Parameters
-
- Returns
- true if available; else false
Definition at line 42 of file AAObject.hh.
44 return idx( key ) >= 0;
◆ idxusr_checked()
int AAObject::idxusr_checked |
( |
const std::string & |
key | ) |
const |
|
inline |
Get index in user data of the item with given key.
This method throws a run-time exception if no user data are available.
- Parameters
-
- Returns
- index (-1 if key does not exists)
Definition at line 54 of file AAObject.hh.
59 THROW(
Exception,
"No user data for key " << key <<
" in aanet object of type " <<
this -> ClassName());
◆ getusr()
double AAObject::getusr |
( |
const std::string & |
key | ) |
const |
|
inline |
Get user data item with given key.
This method throws a run-time exception if no user data are available.
- Parameters
-
- Returns
- value
Definition at line 72 of file AAObject.hh.
74 const int i =
idx( key );
78 THROW(
Exception,
"No user data for key " << key <<
" in aanet object of type " <<
this -> ClassName());
81 if (
unsigned(i) >=
usr.size() )
83 THROW(
Exception,
"Warning: inconsistent user data " << i <<
" >= " <<
usr.size());
◆ setusr()
void AAObject::setusr |
( |
const std::string & |
key, |
|
|
double |
value |
|
) |
| |
|
inline |
Set user data item with given key.
- Parameters
-
Definition at line 95 of file AAObject.hh.
112 usr.push_back( value );
◆ delusr()
bool AAObject::delusr |
( |
const std::string & |
key | ) |
|
|
inline |
Remove (first) user data item with given key.
- Parameters
-
- Returns
- true if data have been removed; else false
Definition at line 126 of file AAObject.hh.
129 if ( i < 0 )
return false;
131 usr.erase (
usr.begin() + i );
◆ clearusr()
void AAObject::clearusr |
( |
| ) |
|
|
inline |
◆ printusr()
void AAObject::printusr |
( |
std::ostream & |
out = std::cout | ) |
|
|
inline |
Print user data (i.e.
list of all pairs of keys and values).
- Parameters
-
Definition at line 150 of file AAObject.hh.
154 for (
unsigned i=0; i<
n ;i++)
156 std::string name =
"(unnamed)";
158 out << i <<
" \t " << name <<
" : \t ";
159 if ( i <
usr.size() ) out <<
usr[i] << std::endl;
160 else out <<
"(none)" << std::endl;
◆ __str__()
const char* AAObject::__str__ |
( |
| ) |
const |
|
inline |
Get class name.
- Returns
- class name
Definition at line 175 of file AAObject.hh.
175 {
return Class_Name(); }
◆ usr
◆ usr_names
◆ any
Pointer to "any" user data.
Definition at line 177 of file AAObject.hh.
The documentation for this struct was generated from the following file: