MIDAS
Loading...
Searching...
No Matches
midas::u_odb Class Reference

#include <odbxx.h>

Collaboration diagram for midas::u_odb:

Public Member Functions

 u_odb ()
 
 u_odb (uint8_t v)
 
 u_odb (int8_t v)
 
 u_odb (uint16_t v)
 
 u_odb (int16_t v)
 
 u_odb (uint32_t v)
 
 u_odb (int32_t v)
 
 u_odb (uint64_t v)
 
 u_odb (int64_t v)
 
 u_odb (bool v)
 
 u_odb (float v)
 
 u_odb (double v)
 
 u_odb (std::string *v)
 
 ~u_odb ()
 
void set_parent (odb *o)
 
odbget_parent ()
 
void set_tid (int tid)
 
int get_tid ()
 
uint8_t operator= (uint8_t v)
 
int8_t operator= (int8_t v)
 
uint16_t operator= (uint16_t v)
 
int16_t operator= (int16_t v)
 
uint32_t operator= (uint32_t v)
 
int32_t operator= (int32_t v)
 
uint64_t operator= (uint64_t v)
 
int64_t operator= (int64_t v)
 
bool operator= (bool v)
 
float operator= (float v)
 
double operator= (double v)
 
const charoperator= (const char *v)
 
std::string * operator= (std::string *v)
 
std::string operator= (std::string v)
 
 operator uint8_t ()
 
 operator int8_t ()
 
 operator uint16_t ()
 
 operator int16_t ()
 
 operator uint32_t ()
 
 operator int32_t ()
 
 operator uint64_t ()
 
 operator int64_t ()
 
 operator bool ()
 
 operator float ()
 
 operator double ()
 
 operator std::string ()
 
 operator const char * ()
 
 operator midas::odb & ()
 
template<typename T >
void set (T v)
 
void set_string (std::string s)
 
void set_string_size (std::string s, int size)
 
void set_string_ptr (std::string *s)
 
void set (odb *v)
 
void set_odb (odb *v)
 
void set (std::string v)
 
void set (const char *v)
 
void set (char *v)
 
void add (double inc, bool push=true)
 
void mult (double f, bool push=true)
 
u_odboperator++ (int)
 
u_odboperator++ ()
 
u_odboperator-- (int)
 
u_odboperator-- ()
 
u_odboperator+= (double d)
 
u_odboperator-= (double d)
 
u_odboperator*= (double d)
 
u_odboperator/= (double d)
 
template<typename T >
u_odboperator+ (T v)
 
template<typename T >
u_odboperator- (T v)
 
template<typename T >
u_odboperator* (T v)
 
template<typename T >
u_odboperator/ (T v)
 
template<typename T >
get ()
 
std::string get ()
 
std::string get_value ()
 
std::string s ()
 
void get (std::string &s)
 
odbget_podb ()
 
odbget_odb ()
 

Private Attributes

union { 
 
   uint8_t   m_uint8 
 
   int8_t   m_int8 
 
   uint16_t   m_uint16 
 
   int16_t   m_int16 
 
   uint32_t   m_uint32 
 
   int32_t   m_int32 
 
   uint64_t   m_uint64 
 
   int64_t   m_int64 
 
   bool   m_bool 
 
   float   m_float 
 
   double   m_double 
 
   std::string *   m_string 
 
   odb *   m_odb 
 
};  
 
int m_tid
 
odbm_parent_odb
 

Friends

std::ostream & operator<< (std::ostream &output, u_odb &o)
 

Detailed Description

Definition at line 46 of file odbxx.h.

Constructor & Destructor Documentation

◆ u_odb() [1/13]

midas::u_odb::u_odb ( )
inline

Definition at line 69 of file odbxx.h.

69: m_string{}, m_tid{}, m_parent_odb{nullptr} {};
odb * m_parent_odb
Definition odbxx.h:66
int m_tid
Definition odbxx.h:65
std::string * m_string
Definition odbxx.h:61

◆ u_odb() [2/13]

midas::u_odb::u_odb ( uint8_t  v)
inline

Definition at line 72 of file odbxx.h.

72: m_tid{TID_UINT8}, m_parent_odb{nullptr} {m_string = nullptr; m_uint8 = v;};
uint8_t m_uint8
Definition odbxx.h:50
#define TID_UINT8
Definition midas.h:328

◆ u_odb() [3/13]

midas::u_odb::u_odb ( int8_t  v)
inline

Definition at line 74 of file odbxx.h.

74: m_tid{TID_INT8}, m_parent_odb{nullptr} {m_string = nullptr; m_int8 = v;};
int8_t m_int8
Definition odbxx.h:51
#define TID_INT8
Definition midas.h:330

◆ u_odb() [4/13]

midas::u_odb::u_odb ( uint16_t  v)
inline

Definition at line 76 of file odbxx.h.

76: m_tid{TID_UINT16}, m_parent_odb{nullptr} {m_string = nullptr; m_uint16 = v;};
uint16_t m_uint16
Definition odbxx.h:52
#define TID_UINT16
Definition midas.h:333

◆ u_odb() [5/13]

midas::u_odb::u_odb ( int16_t  v)
inline

Definition at line 78 of file odbxx.h.

78: m_tid{TID_INT16}, m_parent_odb{nullptr} {m_string = nullptr; m_int16 = v;};
int16_t m_int16
Definition odbxx.h:53
#define TID_INT16
Definition midas.h:335

◆ u_odb() [6/13]

midas::u_odb::u_odb ( uint32_t  v)
inline

Definition at line 80 of file odbxx.h.

80: m_tid{TID_UINT32}, m_parent_odb{nullptr} {m_string = nullptr; m_uint32 = v;};
uint32_t m_uint32
Definition odbxx.h:54
#define TID_UINT32
Definition midas.h:337

◆ u_odb() [7/13]

midas::u_odb::u_odb ( int32_t  v)
inline

Definition at line 82 of file odbxx.h.

82: m_tid{TID_INT32}, m_parent_odb{nullptr} {m_string = nullptr; m_int32 = v;};
int32_t m_int32
Definition odbxx.h:55
#define TID_INT32
Definition midas.h:339

◆ u_odb() [8/13]

midas::u_odb::u_odb ( uint64_t  v)
inline

Definition at line 84 of file odbxx.h.

84: m_tid{TID_UINT64}, m_parent_odb{nullptr} {m_string = nullptr; m_uint64 = v;};
uint64_t m_uint64
Definition odbxx.h:56
#define TID_UINT64
Definition midas.h:352

◆ u_odb() [9/13]

midas::u_odb::u_odb ( int64_t  v)
inline

Definition at line 86 of file odbxx.h.

86: m_tid{TID_INT64}, m_parent_odb{nullptr} {m_string = nullptr; m_int64 = v;};
int64_t m_int64
Definition odbxx.h:57
#define TID_INT64
Definition midas.h:351

◆ u_odb() [10/13]

midas::u_odb::u_odb ( bool  v)
inline

Definition at line 88 of file odbxx.h.

88: m_tid{TID_BOOL}, m_parent_odb{nullptr} {m_string = nullptr; m_bool = v;};
bool m_bool
Definition odbxx.h:58
#define TID_BOOL
Definition midas.h:340

◆ u_odb() [11/13]

midas::u_odb::u_odb ( float  v)
inline

Definition at line 90 of file odbxx.h.

90: m_float{v}, m_tid{TID_FLOAT}, m_parent_odb{nullptr} {m_string = nullptr; m_float = v;};
float m_float
Definition odbxx.h:59
#define TID_FLOAT
Definition midas.h:341

◆ u_odb() [12/13]

midas::u_odb::u_odb ( double  v)
inline

Definition at line 92 of file odbxx.h.

92: m_double{v}, m_tid{TID_DOUBLE}, m_parent_odb{nullptr} {m_string = nullptr; m_double = v;};
double m_double
Definition odbxx.h:60
#define TID_DOUBLE
Definition midas.h:343

◆ u_odb() [13/13]

midas::u_odb::u_odb ( std::string *  v)
inline

Definition at line 94 of file odbxx.h.

94: m_string{v}, m_tid{TID_STRING}, m_parent_odb{nullptr} {};
#define TID_STRING
Definition midas.h:346

◆ ~u_odb()

midas::u_odb::~u_odb ( )

Definition at line 1555 of file odbxx.cxx.

1555 {
1556 if (m_tid == TID_STRING || m_tid == TID_LINK)
1557 delete m_string;
1558 else if (m_tid == TID_KEY)
1559 delete m_odb;
1560 }
odb * m_odb
Definition odbxx.h:62
#define TID_KEY
Definition midas.h:349
#define TID_LINK
Definition midas.h:350

Member Function Documentation

◆ add()

void midas::u_odb::add ( double  inc,
bool  push = true 
)

Definition at line 1802 of file odbxx.cxx.

1802 {
1803 if (m_tid == TID_UINT8)
1804 m_uint8 += inc;
1805 else if (m_tid == TID_INT8)
1806 m_int8 += inc;
1807 else if (m_tid == TID_UINT16)
1808 m_uint16 += inc;
1809 else if (m_tid == TID_INT16)
1810 m_int16 += inc;
1811 else if (m_tid == TID_UINT32)
1812 m_uint32 += inc;
1813 else if (m_tid == TID_INT32)
1814 m_int32 += inc;
1815 else if (m_tid == TID_FLOAT)
1816 m_float += static_cast<float>(inc);
1817 else if (m_tid == TID_DOUBLE)
1818 m_double += inc;
1819 else
1820 mthrow("Invalid arithmetic operation for ODB key \"" +
1821 m_parent_odb->get_full_path() + "\"");
1824 }
std::string get_full_path()
Definition odbxx.cxx:291
void write(int str_size=0)
Definition odbxx.cxx:1027
bool is_auto_refresh_write() const
Definition odbxx.h:1205
#define mthrow(arg)
Definition mexcept.h:24
#define write(n, a, f, d)
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function:

◆ get() [1/3]

template<typename T >
T midas::u_odb::get ( )
inline

Definition at line 316 of file odbxx.h.

316 {
317 if (m_tid == TID_UINT8)
318 return (T) m_uint8;
319 else if (m_tid == TID_INT8)
320 return (T) m_int8;
321 else if (m_tid == TID_UINT16)
322 return (T) m_uint16;
323 else if (m_tid == TID_INT16)
324 return (T) m_int16;
325 else if (m_tid == TID_UINT32)
326 return (T) m_uint32;
327 else if (m_tid == TID_INT32)
328 return (T) m_int32;
329 else if (m_tid == TID_UINT64)
330 return (T) m_uint64;
331 else if (m_tid == TID_INT64)
332 return (T) m_int64;
333 else if (m_tid == TID_BOOL)
334 return (T) m_bool;
335 else if (m_tid == TID_FLOAT)
336 return (T) m_float;
337 else if (m_tid == TID_DOUBLE)
338 return (T) m_double;
339 else if (m_tid == 0)
340 mthrow("Subkey not found");
341 else
342 mthrow("Invalid type ID %s" + std::to_string(m_tid));
343 }
Here is the caller graph for this function:

◆ get() [2/3]

std::string midas::u_odb::get ( )
inline

Definition at line 346 of file odbxx.h.

346 {
347 std::string s;
348 get(s);
349 return s;
350 }
std::string s()
Definition odbxx.h:359
Here is the call graph for this function:

◆ get() [3/3]

void midas::u_odb::get ( std::string &  s)

Definition at line 1563 of file odbxx.cxx.

1563 {
1564 if (m_tid == TID_UINT8)
1565 s = std::to_string(m_uint8);
1566 else if (m_tid == TID_INT8)
1567 s = std::to_string(m_int8);
1568 else if (m_tid == TID_UINT16)
1569 s = std::to_string(m_uint16);
1570 else if (m_tid == TID_INT16)
1571 s = std::to_string(m_int16);
1572 else if (m_tid == TID_UINT32)
1573 s = std::to_string(m_uint32);
1574 else if (m_tid == TID_INT32)
1575 s = std::to_string(m_int32);
1576 else if (m_tid == TID_UINT64)
1577 s = std::to_string(m_uint64);
1578 else if (m_tid == TID_INT64)
1579 s = std::to_string(m_int64);
1580 else if (m_tid == TID_BOOL)
1581 s = std::string(m_bool ? "true" : "false");
1582 else if (m_tid == TID_FLOAT)
1583 s = std::to_string(m_float);
1584 else if (m_tid == TID_DOUBLE)
1585 s = std::to_string(m_double);
1586 else if (m_tid == TID_STRING)
1587 s = *m_string;
1588 else if (m_tid == TID_LINK)
1589 s = *m_string;
1590 else if (m_tid == TID_KEY)
1591 m_odb->print(s, 0);
1592 else if (m_tid == 0)
1593 mthrow("Subkey \"" + m_parent_odb->get_name() + "\" not found");
1594 else
1595 mthrow("Invalid type ID " + std::to_string(m_tid));
1596 }
std::string get_name()
Definition odbxx.h:1278
std::string print()
Definition odbxx.cxx:348
Here is the call graph for this function:

◆ get_odb()

odb & midas::u_odb::get_odb ( )
inline

Definition at line 373 of file odbxx.h.

373 {
374 if (m_tid != TID_KEY)
375 mthrow("odb_get() called for non-key object");
376 return *m_odb;
377 }
Here is the caller graph for this function:

◆ get_parent()

odb * midas::u_odb::get_parent ( )
inline

Definition at line 101 of file odbxx.h.

101{ return m_parent_odb; }

◆ get_podb()

odb * midas::u_odb::get_podb ( )
inline

Definition at line 367 of file odbxx.h.

367 {
368 if (m_tid != TID_KEY)
369 mthrow("odb_get() called for non-key object");
370 return m_odb;
371 }
Here is the caller graph for this function:

◆ get_tid()

int midas::u_odb::get_tid ( )
inline

Definition at line 105 of file odbxx.h.

105{ return m_tid; }
Here is the caller graph for this function:

◆ get_value()

std::string midas::u_odb::get_value ( )
inline

Definition at line 352 of file odbxx.h.

352 {
353 std::string s;
354 get(s);
355 return s;
356 }
Here is the call graph for this function:

◆ mult()

void midas::u_odb::mult ( double  f,
bool  push = true 
)

Definition at line 1826 of file odbxx.cxx.

1826 {
1827 int tid = m_parent_odb->get_tid();
1828 if (tid == TID_UINT8)
1829 m_uint8 *= f;
1830 else if (tid == TID_INT8)
1831 m_int8 *= f;
1832 else if (tid == TID_UINT16)
1833 m_uint16 *= f;
1834 else if (tid == TID_INT16)
1835 m_int16 *= f;
1836 else if (tid == TID_UINT32)
1837 m_uint32 *= f;
1838 else if (tid == TID_INT32)
1839 m_int32 *= f;
1840 else if (tid == TID_FLOAT)
1841 m_float *= f;
1842 else if (tid == TID_DOUBLE)
1843 m_double *= f;
1844 else
1845 mthrow("Invalid operation for ODB key \"" +
1846 m_parent_odb->get_full_path() + "\"");
1849 }
int get_tid()
Definition odbxx.h:1276
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator bool()

midas::u_odb::operator bool ( )

Definition at line 1764 of file odbxx.cxx.

1764 {
1765 if (m_parent_odb)
1767 return get<bool>();
1768 }
void set_last_index(int i)
Definition odbxx.h:956
Here is the call graph for this function:

◆ operator const char *()

midas::u_odb::operator const char * ( )

Definition at line 1786 of file odbxx.cxx.

1786 {
1787 if (m_parent_odb)
1789 if (m_tid != TID_STRING && m_tid != TID_LINK)
1790 mthrow("Only ODB string keys can be converted to \"const char *\"");
1791 return m_string->c_str();
1792 }

◆ operator double()

midas::u_odb::operator double ( )

Definition at line 1774 of file odbxx.cxx.

1774 {
1775 if (m_parent_odb)
1777 return get<double>();
1778 }
Here is the call graph for this function:

◆ operator float()

midas::u_odb::operator float ( )

Definition at line 1769 of file odbxx.cxx.

1769 {
1770 if (m_parent_odb)
1772 return get<float>();
1773 }
Here is the call graph for this function:

◆ operator int16_t()

midas::u_odb::operator int16_t ( )

Definition at line 1739 of file odbxx.cxx.

1739 {
1740 if (m_parent_odb)
1742 return get<int16_t>();
1743 }
Here is the call graph for this function:

◆ operator int32_t()

midas::u_odb::operator int32_t ( )

Definition at line 1749 of file odbxx.cxx.

1749 {
1750 if (m_parent_odb)
1752 return get<int32_t>();
1753 }
Here is the call graph for this function:

◆ operator int64_t()

midas::u_odb::operator int64_t ( )

Definition at line 1759 of file odbxx.cxx.

1759 {
1760 if (m_parent_odb)
1762 return get<int64_t>();
1763 }
Here is the call graph for this function:

◆ operator int8_t()

midas::u_odb::operator int8_t ( )

Definition at line 1729 of file odbxx.cxx.

1729 {
1730 if (m_parent_odb)
1732 return get<int8_t>();
1733 }
Here is the call graph for this function:

◆ operator midas::odb &()

midas::u_odb::operator midas::odb & ( )

Definition at line 1793 of file odbxx.cxx.

1793 {
1794 if (m_parent_odb)
1796 if (m_tid != TID_KEY)
1797 mthrow("Only ODB directories can be converted to \"midas::odb &\"");
1798 return *m_odb;
1799 }
Here is the call graph for this function:

◆ operator std::string()

midas::u_odb::operator std::string ( )

Definition at line 1779 of file odbxx.cxx.

1779 {
1780 if (m_parent_odb)
1782 std::string s;
1783 get(s);
1784 return s;
1785 }

◆ operator uint16_t()

midas::u_odb::operator uint16_t ( )

Definition at line 1734 of file odbxx.cxx.

1734 {
1735 if (m_parent_odb)
1737 return get<uint16_t>();
1738 }
Here is the call graph for this function:

◆ operator uint32_t()

midas::u_odb::operator uint32_t ( )

Definition at line 1744 of file odbxx.cxx.

1744 {
1745 if (m_parent_odb)
1747 return get<uint32_t>();
1748 }
Here is the call graph for this function:

◆ operator uint64_t()

midas::u_odb::operator uint64_t ( )

Definition at line 1754 of file odbxx.cxx.

1754 {
1755 if (m_parent_odb)
1757 return get<uint64_t>();
1758 }
Here is the call graph for this function:

◆ operator uint8_t()

midas::u_odb::operator uint8_t ( )

Definition at line 1724 of file odbxx.cxx.

1724 {
1725 if (m_parent_odb)
1727 return get<uint8_t>();
1728 }
Here is the call graph for this function:

◆ operator*()

template<typename T >
u_odb & midas::u_odb::operator* ( v)
inline

Definition at line 299 of file odbxx.h.

299 {
300 double d = *this;
301 d *= v;
302 set(v);
303 return *this;
304 }
#define set(var, value)
double d
Definition system.cxx:1311

◆ operator*=()

u_odb & midas::u_odb::operator*= ( double  d)
inline

Definition at line 270 of file odbxx.h.

270 {
271 mult(d);
272 return *this;
273 }
void mult(double f, bool push=true)
Definition odbxx.cxx:1826
Here is the call graph for this function:

◆ operator+()

template<typename T >
u_odb & midas::u_odb::operator+ ( v)
inline

Definition at line 283 of file odbxx.h.

283 {
284 double d = *this;
285 d += v;
286 set(v);
287 return *this;
288 }

◆ operator++() [1/2]

u_odb & midas::u_odb::operator++ ( )
inline

Definition at line 245 of file odbxx.h.

245 {
246 add(1);
247 return *this;
248 }
INT add
Definition odbhist.cxx:40

◆ operator++() [2/2]

u_odb & midas::u_odb::operator++ ( int  )
inline

Definition at line 240 of file odbxx.h.

240 {
241 add(1);
242 return *this;
243 }

◆ operator+=()

u_odb & midas::u_odb::operator+= ( double  d)
inline

Definition at line 260 of file odbxx.h.

260 {
261 add(d);
262 return *this;
263 }

◆ operator-()

template<typename T >
u_odb & midas::u_odb::operator- ( v)
inline

Definition at line 291 of file odbxx.h.

291 {
292 double d = *this;
293 d -= v;
294 set(v);
295 return *this;
296 }

◆ operator--() [1/2]

u_odb & midas::u_odb::operator-- ( )
inline

Definition at line 255 of file odbxx.h.

255 {
256 add(-1);
257 return *this;
258 }

◆ operator--() [2/2]

u_odb & midas::u_odb::operator-- ( int  )
inline

Definition at line 250 of file odbxx.h.

250 {
251 add(-1);
252 return *this;
253 }

◆ operator-=()

u_odb & midas::u_odb::operator-= ( double  d)
inline

Definition at line 265 of file odbxx.h.

265 {
266 add(-d);
267 return *this;
268 }

◆ operator/()

template<typename T >
u_odb & midas::u_odb::operator/ ( v)
inline

Definition at line 307 of file odbxx.h.

307 {
308 double d = *this;
309 d /= v;
310 set(v);
311 return *this;
312 }

◆ operator/=()

u_odb & midas::u_odb::operator/= ( double  d)
inline

Definition at line 275 of file odbxx.h.

275 {
276 if (d == 0)
277 mthrow("Division by zero");
278 mult(1 / d);
279 return *this;
280 }
Here is the call graph for this function:

◆ operator=() [1/14]

bool midas::u_odb::operator= ( bool  v)

Definition at line 1665 of file odbxx.cxx.

1665 {
1666 if (m_tid == 0)
1667 m_tid = TID_BOOL;
1668 set(v);
1671 return v;
1672 }
Here is the call graph for this function:

◆ operator=() [2/14]

const char * midas::u_odb::operator= ( const char v)

Definition at line 1689 of file odbxx.cxx.

1689 {
1690 if (m_tid == 0)
1691 m_tid = TID_STRING;
1692 set(v);
1695 return v;
1696 }
Here is the call graph for this function:

◆ operator=() [3/14]

double midas::u_odb::operator= ( double  v)

Definition at line 1681 of file odbxx.cxx.

1681 {
1682 if (m_tid == 0)
1683 m_tid = TID_DOUBLE;
1684 set(v);
1687 return v;
1688 }
Here is the call graph for this function:

◆ operator=() [4/14]

float midas::u_odb::operator= ( float  v)

Definition at line 1673 of file odbxx.cxx.

1673 {
1674 if (m_tid == 0)
1675 m_tid = TID_FLOAT;
1676 set(v);
1679 return v;
1680 }
Here is the call graph for this function:

◆ operator=() [5/14]

int16_t midas::u_odb::operator= ( int16_t  v)

Definition at line 1625 of file odbxx.cxx.

1625 {
1626 if (m_tid == 0)
1627 m_tid = TID_INT16;
1628 set(v);
1631 return v;
1632 }
Here is the call graph for this function:

◆ operator=() [6/14]

int32_t midas::u_odb::operator= ( int32_t  v)

Definition at line 1641 of file odbxx.cxx.

1641 {
1642 if (m_tid == 0)
1643 m_tid = TID_INT32;
1644 set(v);
1647 return v;
1648 }
Here is the call graph for this function:

◆ operator=() [7/14]

int64_t midas::u_odb::operator= ( int64_t  v)

Definition at line 1657 of file odbxx.cxx.

1657 {
1658 if (m_tid == 0)
1659 m_tid = TID_INT64;
1660 set(v);
1663 return v;
1664 }
Here is the call graph for this function:

◆ operator=() [8/14]

int8_t midas::u_odb::operator= ( int8_t  v)

Definition at line 1609 of file odbxx.cxx.

1609 {
1610 if (m_tid == 0)
1611 m_tid = TID_INT8;
1612 set(v);
1615 return v;
1616 }
Here is the call graph for this function:

◆ operator=() [9/14]

std::string * midas::u_odb::operator= ( std::string *  v)

Definition at line 1698 of file odbxx.cxx.

1698 {
1699 if (m_tid == 0)
1700 m_tid = TID_STRING;
1701 set(*v);
1704 return v;
1705 }
Here is the call graph for this function:

◆ operator=() [10/14]

std::string midas::u_odb::operator= ( std::string  v)

Definition at line 1707 of file odbxx.cxx.

1707 {
1708 if (m_tid == 0)
1709 m_tid = TID_STRING;
1710 set(v);
1713 return v;
1714 }
Here is the call graph for this function:

◆ operator=() [11/14]

uint16_t midas::u_odb::operator= ( uint16_t  v)

Definition at line 1617 of file odbxx.cxx.

1617 {
1618 if (m_tid == 0)
1619 m_tid = TID_UINT16;
1620 set(v);
1623 return v;
1624 }
Here is the call graph for this function:

◆ operator=() [12/14]

uint32_t midas::u_odb::operator= ( uint32_t  v)

Definition at line 1633 of file odbxx.cxx.

1633 {
1634 if (m_tid == 0)
1635 m_tid = TID_UINT32;
1636 set(v);
1639 return v;
1640 }
Here is the call graph for this function:

◆ operator=() [13/14]

uint64_t midas::u_odb::operator= ( uint64_t  v)

Definition at line 1649 of file odbxx.cxx.

1649 {
1650 if (m_tid == 0)
1651 m_tid = TID_UINT64;
1652 set(v);
1655 return v;
1656 }
Here is the call graph for this function:

◆ operator=() [14/14]

uint8_t midas::u_odb::operator= ( uint8_t  v)

Definition at line 1601 of file odbxx.cxx.

1601 {
1602 if (m_tid == 0)
1603 m_tid = TID_UINT8;
1604 set(v);
1607 return v;
1608 }
Here is the call graph for this function:

◆ s()

std::string midas::u_odb::s ( )
inline

Definition at line 359 of file odbxx.h.

359 {
360 return get();
361 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set() [1/5]

void midas::u_odb::set ( char v)
inline

Definition at line 230 of file odbxx.h.

230 {
231 set(std::string(v));
232 }

◆ set() [2/5]

void midas::u_odb::set ( const char v)
inline

Definition at line 226 of file odbxx.h.

226 {
227 set(std::string(v));
228 }

◆ set() [3/5]

void midas::u_odb::set ( odb v)
inline

Definition at line 181 of file odbxx.h.

181 {
182 if (m_tid != TID_KEY)
183 mthrow("Subkey can only be assigned to ODB key");
184 m_odb = v;
185 }

◆ set() [4/5]

void midas::u_odb::set ( std::string  v)
inline

Definition at line 193 of file odbxx.h.

193 {
194 if (m_tid == TID_UINT8)
195 m_uint8 = std::stoi(v);
196 else if (m_tid == TID_INT8)
197 m_int8 = std::stoi(v);
198 else if (m_tid == TID_UINT16)
199 m_uint16 = std::stoul(v);
200 else if (m_tid == TID_INT16)
201 m_int16 = std::stoi(v);
202 else if (m_tid == TID_UINT32)
203 m_uint32 = std::stoul(v);
204 else if (m_tid == TID_INT32)
205 m_int32 = std::stoi(v);
206 else if (m_tid == TID_UINT64)
207 m_uint64 = std::stoul(v);
208 else if (m_tid == TID_INT64)
209 m_int64 = std::stoi(v);
210 else if (m_tid == TID_BOOL)
211 m_bool = std::stoi(v);
212 else if (m_tid == TID_FLOAT)
213 m_float = std::stod(v);
214 else if (m_tid == TID_DOUBLE)
215 m_double = std::stod(v);
216 else if (m_tid == TID_STRING) {
217 delete m_string;
218 m_string = new std::string(v);
219 } else if (m_tid == TID_LINK) {
220 delete m_string;
221 m_string = new std::string(v);
222 } else
223 mthrow("Invalid type ID " + std::to_string(m_tid));
224 }

◆ set() [5/5]

template<typename T >
void midas::u_odb::set ( v)
inline

Definition at line 140 of file odbxx.h.

140 {
141 if (m_tid == TID_UINT8)
142 m_uint8 = v;
143 else if (m_tid == TID_INT8)
144 m_int8 = v;
145 else if (m_tid == TID_UINT16)
146 m_uint16 = v;
147 else if (m_tid == TID_INT16)
148 m_int16 = v;
149 else if (m_tid == TID_UINT32)
150 m_uint32 = v;
151 else if (m_tid == TID_INT32)
152 m_int32 = v;
153 else if (m_tid == TID_UINT64)
154 m_uint64 = v;
155 else if (m_tid == TID_INT64)
156 m_int64 = v;
157 else if (m_tid == TID_BOOL)
158 m_bool = v;
159 else if (m_tid == TID_FLOAT)
160 m_float = v;
161 else if (m_tid == TID_DOUBLE)
162 m_double = v;
163 else if (m_tid == TID_STRING) {
164 delete m_string;
165 m_string = new std::string(std::to_string(v));
166 } else
167 mthrow("Invalid type ID " + std::to_string(m_tid));
168 }
Here is the caller graph for this function:

◆ set_odb()

void midas::u_odb::set_odb ( odb v)
inline

Definition at line 187 of file odbxx.h.

187 {
188 if (m_tid != TID_KEY)
189 mthrow("Subkey can only be assigned to ODB key");
190 m_odb = v;
191 }
Here is the caller graph for this function:

◆ set_parent()

void midas::u_odb::set_parent ( odb o)
inline

Definition at line 100 of file odbxx.h.

100{ m_parent_odb = o; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_string()

void midas::u_odb::set_string ( std::string  s)
inline

Definition at line 170 of file odbxx.h.

170 {
171 delete m_string;
172 m_string = new std::string(s);
173 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_string_ptr()

void midas::u_odb::set_string_ptr ( std::string *  s)
inline

Definition at line 177 of file odbxx.h.

177 {
178 m_string = s;
179 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_string_size()

void midas::u_odb::set_string_size ( std::string  s,
int  size 
)

Definition at line 1716 of file odbxx.cxx.

1716 {
1717 m_tid = TID_STRING;
1718 set(v);
1720 m_parent_odb->write(size);
1721 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_tid()

void midas::u_odb::set_tid ( int  tid)
inline

Definition at line 103 of file odbxx.h.

103{ m_tid = tid; }
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  output,
u_odb o 
)
friend

Definition at line 380 of file odbxx.h.

380 {
381 std::string s = o;
382 output << s;
383 return output;
384 };
static void output(code_int code)
Definition mgd.cxx:1647

Member Data Documentation

◆ [union]

union { ... } midas::u_odb

◆ m_bool

bool midas::u_odb::m_bool

Definition at line 58 of file odbxx.h.

◆ m_double

double midas::u_odb::m_double

Definition at line 60 of file odbxx.h.

◆ m_float

float midas::u_odb::m_float

Definition at line 59 of file odbxx.h.

◆ m_int16

int16_t midas::u_odb::m_int16

Definition at line 53 of file odbxx.h.

◆ m_int32

int32_t midas::u_odb::m_int32

Definition at line 55 of file odbxx.h.

◆ m_int64

int64_t midas::u_odb::m_int64

Definition at line 57 of file odbxx.h.

◆ m_int8

int8_t midas::u_odb::m_int8

Definition at line 51 of file odbxx.h.

◆ m_odb

odb* midas::u_odb::m_odb

Definition at line 62 of file odbxx.h.

◆ m_parent_odb

odb* midas::u_odb::m_parent_odb
private

Definition at line 66 of file odbxx.h.

◆ m_string

std::string* midas::u_odb::m_string

Definition at line 61 of file odbxx.h.

◆ m_tid

int midas::u_odb::m_tid
private

Definition at line 65 of file odbxx.h.

◆ m_uint16

uint16_t midas::u_odb::m_uint16

Definition at line 52 of file odbxx.h.

◆ m_uint32

uint32_t midas::u_odb::m_uint32

Definition at line 54 of file odbxx.h.

◆ m_uint64

uint64_t midas::u_odb::m_uint64

Definition at line 56 of file odbxx.h.

◆ m_uint8

uint8_t midas::u_odb::m_uint8

Definition at line 50 of file odbxx.h.


The documentation for this class was generated from the following files: