1 #ifndef AAOBJECTINCLUDED
2 #define AAOBJECTINCLUDED
29 int idx(
const std::string& key )
const
42 bool haveusr(
const std::string& key )
const
44 return idx( key ) >= 0;
59 THROW(
Exception,
"No user data for key " << key <<
" in aanet object of type " <<
this -> ClassName());
72 double getusr(
const std::string& key)
const
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());
95 void setusr(
const std::string& key,
double value )
112 usr.push_back( value );
129 if ( i < 0 )
return false;
131 usr.erase (
usr.begin() + i );
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;
175 const char*
__str__()
const {
return Class_Name(); }
void setusr(const std::string &key, double value)
Set user data item with given key.
AAObject()
Default constructor.
std::vector< std::string > usr_names
user keys
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
void printusr(std::ostream &out=std::cout)
Print user data (i.e.
bool delusr(const std::string &key)
Remove (first) user data item with given key.
void clearusr()
Clear user data.
TObject * any
Pointer to "any" user data.
int idx(const std::string &key) const
Get index in user data of the item with given key.
int idxusr_checked(const std::string &key) const
Get index in user data of the item with given key.
const char * __str__() const
Get class name.
double getusr(const std::string &key) const
Get user data item with given key.
#define ClassDef(name, version)
AAObject is a base class for I/O-classes that adds the possibility to add 'user' information which wi...
bool haveusr(const std::string &key) const
Check availability of user data of the item with given key.
alias put_queue eval echo n
std::vector< double > usr
user data