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 () |
|
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.
Default constructor.
Definition at line 167 of file AAObject.hh.
TObject * any
Pointer to "any" user data.
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.
std::vector< std::string > usr_names
user keys
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;
int idx(const std::string &key) const
Get index in user data of the item with given key.
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());
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
int idx(const std::string &key) const
Get index in user data of the item with given key.
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());
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
int idx(const std::string &key) const
Get index in user data of the item with given key.
std::vector< double > usr
user data
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 );
std::vector< std::string > usr_names
user keys
int idx(const std::string &key) const
Get index in user data of the item with given key.
std::vector< double > usr
user data
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 );
std::vector< std::string > usr_names
user keys
int idx(const std::string &key) const
Get index in user data of the item with given key.
std::vector< double > usr
user data
void AAObject::clearusr |
( |
| ) |
|
|
inline |
Clear user data.
Definition at line 139 of file AAObject.hh.
std::vector< std::string > usr_names
user keys
std::vector< double > usr
user data
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;
std::vector< std::string > usr_names
user keys
alias put_queue eval echo n
std::vector< double > usr
user data
Pointer to "any" user data.
Definition at line 171 of file AAObject.hh.
The documentation for this struct was generated from the following file: