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 48 of file odbxx.h.

Constructor & Destructor Documentation

◆ u_odb() [1/13]

midas::u_odb::u_odb ( )
inline

Definition at line 71 of file odbxx.h.

71: m_string{}, m_tid{}, m_parent_odb{nullptr} {};
odb * m_parent_odb
Definition odbxx.h:68
int m_tid
Definition odbxx.h:67
std::string * m_string
Definition odbxx.h:63

◆ u_odb() [2/13]

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

Definition at line 74 of file odbxx.h.

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

◆ u_odb() [3/13]

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

Definition at line 76 of file odbxx.h.

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

◆ u_odb() [4/13]

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

Definition at line 78 of file odbxx.h.

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

◆ u_odb() [5/13]

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

Definition at line 80 of file odbxx.h.

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

◆ u_odb() [6/13]

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

Definition at line 82 of file odbxx.h.

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

◆ u_odb() [7/13]

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

Definition at line 84 of file odbxx.h.

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

◆ u_odb() [8/13]

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

Definition at line 86 of file odbxx.h.

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

◆ u_odb() [9/13]

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

Definition at line 88 of file odbxx.h.

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

◆ u_odb() [10/13]

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

Definition at line 90 of file odbxx.h.

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

◆ u_odb() [11/13]

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

Definition at line 92 of file odbxx.h.

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

◆ u_odb() [12/13]

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

Definition at line 94 of file odbxx.h.

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

◆ u_odb() [13/13]

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

Definition at line 96 of file odbxx.h.

96: 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 1622 of file odbxx.cxx.

1622 {
1623 if (m_tid == TID_STRING || m_tid == TID_LINK)
1624 delete m_string;
1625 else if (m_tid == TID_KEY)
1626 delete m_odb;
1627 }
odb * m_odb
Definition odbxx.h:64
#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 1869 of file odbxx.cxx.

1869 {
1870 if (m_tid == TID_UINT8)
1871 m_uint8 += inc;
1872 else if (m_tid == TID_INT8)
1873 m_int8 += inc;
1874 else if (m_tid == TID_UINT16)
1875 m_uint16 += inc;
1876 else if (m_tid == TID_INT16)
1877 m_int16 += inc;
1878 else if (m_tid == TID_UINT32)
1879 m_uint32 += inc;
1880 else if (m_tid == TID_INT32)
1881 m_int32 += inc;
1882 else if (m_tid == TID_FLOAT)
1883 m_float += static_cast<float>(inc);
1884 else if (m_tid == TID_DOUBLE)
1885 m_double += inc;
1886 else
1887 mthrow("Invalid arithmetic operation for ODB key \"" +
1888 m_parent_odb->get_full_path() + "\"");
1891 }
std::string get_full_path()
Definition odbxx.cxx:358
void write(int str_size=0)
Definition odbxx.cxx:1094
bool is_auto_refresh_write() const
Definition odbxx.h:1333
#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 318 of file odbxx.h.

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

◆ get() [2/3]

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

Definition at line 348 of file odbxx.h.

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

◆ get() [3/3]

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

Definition at line 1630 of file odbxx.cxx.

1630 {
1631 if (m_tid == TID_UINT8)
1632 s = std::to_string(m_uint8);
1633 else if (m_tid == TID_INT8)
1634 s = std::to_string(m_int8);
1635 else if (m_tid == TID_UINT16)
1636 s = std::to_string(m_uint16);
1637 else if (m_tid == TID_INT16)
1638 s = std::to_string(m_int16);
1639 else if (m_tid == TID_UINT32)
1640 s = std::to_string(m_uint32);
1641 else if (m_tid == TID_INT32)
1642 s = std::to_string(m_int32);
1643 else if (m_tid == TID_UINT64)
1644 s = std::to_string(m_uint64);
1645 else if (m_tid == TID_INT64)
1646 s = std::to_string(m_int64);
1647 else if (m_tid == TID_BOOL)
1648 s = std::string(m_bool ? "true" : "false");
1649 else if (m_tid == TID_FLOAT)
1650 s = std::to_string(m_float);
1651 else if (m_tid == TID_DOUBLE)
1652 s = std::to_string(m_double);
1653 else if (m_tid == TID_STRING)
1654 s = *m_string;
1655 else if (m_tid == TID_LINK)
1656 s = *m_string;
1657 else if (m_tid == TID_KEY)
1658 m_odb->print(s, 0);
1659 else if (m_tid == 0)
1660 mthrow("Subkey \"" + m_parent_odb->get_name() + "\" not found");
1661 else
1662 mthrow("Invalid type ID " + std::to_string(m_tid));
1663 }
std::string get_name()
Definition odbxx.h:1422
std::string print()
Definition odbxx.cxx:415
Here is the call graph for this function:

◆ get_odb()

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

Definition at line 375 of file odbxx.h.

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

◆ get_parent()

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

Definition at line 103 of file odbxx.h.

103{ return m_parent_odb; }

◆ get_podb()

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

Definition at line 369 of file odbxx.h.

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

◆ get_tid()

int midas::u_odb::get_tid ( )
inline

Definition at line 107 of file odbxx.h.

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

◆ get_value()

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

Definition at line 354 of file odbxx.h.

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

◆ mult()

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

Definition at line 1893 of file odbxx.cxx.

1893 {
1894 int tid = m_parent_odb->get_tid();
1895 if (tid == TID_UINT8)
1896 m_uint8 *= f;
1897 else if (tid == TID_INT8)
1898 m_int8 *= f;
1899 else if (tid == TID_UINT16)
1900 m_uint16 *= f;
1901 else if (tid == TID_INT16)
1902 m_int16 *= f;
1903 else if (tid == TID_UINT32)
1904 m_uint32 *= f;
1905 else if (tid == TID_INT32)
1906 m_int32 *= f;
1907 else if (tid == TID_FLOAT)
1908 m_float *= f;
1909 else if (tid == TID_DOUBLE)
1910 m_double *= f;
1911 else
1912 mthrow("Invalid operation for ODB key \"" +
1913 m_parent_odb->get_full_path() + "\"");
1916 }
int get_tid()
Definition odbxx.h:1420
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 1831 of file odbxx.cxx.

1831 {
1832 if (m_parent_odb)
1834 return get<bool>();
1835 }
void set_last_index(int i)
Definition odbxx.h:999
Here is the call graph for this function:

◆ operator const char *()

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

Definition at line 1853 of file odbxx.cxx.

1853 {
1854 if (m_parent_odb)
1856 if (m_tid != TID_STRING && m_tid != TID_LINK)
1857 mthrow("Only ODB string keys can be converted to \"const char *\"");
1858 return m_string->c_str();
1859 }

◆ operator double()

midas::u_odb::operator double ( )

Definition at line 1841 of file odbxx.cxx.

1841 {
1842 if (m_parent_odb)
1844 return get<double>();
1845 }
Here is the call graph for this function:

◆ operator float()

midas::u_odb::operator float ( )

Definition at line 1836 of file odbxx.cxx.

1836 {
1837 if (m_parent_odb)
1839 return get<float>();
1840 }
Here is the call graph for this function:

◆ operator int16_t()

midas::u_odb::operator int16_t ( )

Definition at line 1806 of file odbxx.cxx.

1806 {
1807 if (m_parent_odb)
1809 return get<int16_t>();
1810 }
Here is the call graph for this function:

◆ operator int32_t()

midas::u_odb::operator int32_t ( )

Definition at line 1816 of file odbxx.cxx.

1816 {
1817 if (m_parent_odb)
1819 return get<int32_t>();
1820 }
Here is the call graph for this function:

◆ operator int64_t()

midas::u_odb::operator int64_t ( )

Definition at line 1826 of file odbxx.cxx.

1826 {
1827 if (m_parent_odb)
1829 return get<int64_t>();
1830 }
Here is the call graph for this function:

◆ operator int8_t()

midas::u_odb::operator int8_t ( )

Definition at line 1796 of file odbxx.cxx.

1796 {
1797 if (m_parent_odb)
1799 return get<int8_t>();
1800 }
Here is the call graph for this function:

◆ operator midas::odb &()

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

Definition at line 1860 of file odbxx.cxx.

1860 {
1861 if (m_parent_odb)
1863 if (m_tid != TID_KEY)
1864 mthrow("Only ODB directories can be converted to \"midas::odb &\"");
1865 return *m_odb;
1866 }
Here is the call graph for this function:

◆ operator std::string()

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

Definition at line 1846 of file odbxx.cxx.

1846 {
1847 if (m_parent_odb)
1849 std::string s;
1850 get(s);
1851 return s;
1852 }

◆ operator uint16_t()

midas::u_odb::operator uint16_t ( )

Definition at line 1801 of file odbxx.cxx.

1801 {
1802 if (m_parent_odb)
1804 return get<uint16_t>();
1805 }
Here is the call graph for this function:

◆ operator uint32_t()

midas::u_odb::operator uint32_t ( )

Definition at line 1811 of file odbxx.cxx.

1811 {
1812 if (m_parent_odb)
1814 return get<uint32_t>();
1815 }
Here is the call graph for this function:

◆ operator uint64_t()

midas::u_odb::operator uint64_t ( )

Definition at line 1821 of file odbxx.cxx.

1821 {
1822 if (m_parent_odb)
1824 return get<uint64_t>();
1825 }
Here is the call graph for this function:

◆ operator uint8_t()

midas::u_odb::operator uint8_t ( )

Definition at line 1791 of file odbxx.cxx.

1791 {
1792 if (m_parent_odb)
1794 return get<uint8_t>();
1795 }
Here is the call graph for this function:

◆ operator*()

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

Definition at line 301 of file odbxx.h.

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

◆ operator*=()

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

Definition at line 272 of file odbxx.h.

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

◆ operator+()

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

Definition at line 285 of file odbxx.h.

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

◆ operator++() [1/2]

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

Definition at line 247 of file odbxx.h.

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

◆ operator++() [2/2]

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

Definition at line 242 of file odbxx.h.

242 {
243 add(1);
244 return *this;
245 }

◆ operator+=()

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

Definition at line 262 of file odbxx.h.

262 {
263 add(d);
264 return *this;
265 }

◆ operator-()

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

Definition at line 293 of file odbxx.h.

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

◆ operator--() [1/2]

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

Definition at line 257 of file odbxx.h.

257 {
258 add(-1);
259 return *this;
260 }

◆ operator--() [2/2]

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

Definition at line 252 of file odbxx.h.

252 {
253 add(-1);
254 return *this;
255 }

◆ operator-=()

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

Definition at line 267 of file odbxx.h.

267 {
268 add(-d);
269 return *this;
270 }

◆ operator/()

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

Definition at line 309 of file odbxx.h.

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

◆ operator/=()

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

Definition at line 277 of file odbxx.h.

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

◆ operator=() [1/14]

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

Definition at line 1732 of file odbxx.cxx.

1732 {
1733 if (m_tid == 0)
1734 m_tid = TID_BOOL;
1735 set(v);
1738 return v;
1739 }
Here is the call graph for this function:

◆ operator=() [2/14]

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

Definition at line 1756 of file odbxx.cxx.

1756 {
1757 if (m_tid == 0)
1758 m_tid = TID_STRING;
1759 set(v);
1762 return v;
1763 }
Here is the call graph for this function:

◆ operator=() [3/14]

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

Definition at line 1748 of file odbxx.cxx.

1748 {
1749 if (m_tid == 0)
1750 m_tid = TID_DOUBLE;
1751 set(v);
1754 return v;
1755 }
Here is the call graph for this function:

◆ operator=() [4/14]

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

Definition at line 1740 of file odbxx.cxx.

1740 {
1741 if (m_tid == 0)
1742 m_tid = TID_FLOAT;
1743 set(v);
1746 return v;
1747 }
Here is the call graph for this function:

◆ operator=() [5/14]

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

Definition at line 1692 of file odbxx.cxx.

1692 {
1693 if (m_tid == 0)
1694 m_tid = TID_INT16;
1695 set(v);
1698 return v;
1699 }
Here is the call graph for this function:

◆ operator=() [6/14]

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

Definition at line 1708 of file odbxx.cxx.

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

◆ operator=() [7/14]

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

Definition at line 1724 of file odbxx.cxx.

1724 {
1725 if (m_tid == 0)
1726 m_tid = TID_INT64;
1727 set(v);
1730 return v;
1731 }
Here is the call graph for this function:

◆ operator=() [8/14]

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

Definition at line 1676 of file odbxx.cxx.

1676 {
1677 if (m_tid == 0)
1678 m_tid = TID_INT8;
1679 set(v);
1682 return v;
1683 }
Here is the call graph for this function:

◆ operator=() [9/14]

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

Definition at line 1765 of file odbxx.cxx.

1765 {
1766 if (m_tid == 0)
1767 m_tid = TID_STRING;
1768 set(*v);
1771 return v;
1772 }
Here is the call graph for this function:

◆ operator=() [10/14]

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

Definition at line 1774 of file odbxx.cxx.

1774 {
1775 if (m_tid == 0)
1776 m_tid = TID_STRING;
1777 set(v);
1780 return v;
1781 }
Here is the call graph for this function:

◆ operator=() [11/14]

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

Definition at line 1684 of file odbxx.cxx.

1684 {
1685 if (m_tid == 0)
1686 m_tid = TID_UINT16;
1687 set(v);
1690 return v;
1691 }
Here is the call graph for this function:

◆ operator=() [12/14]

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

Definition at line 1700 of file odbxx.cxx.

1700 {
1701 if (m_tid == 0)
1702 m_tid = TID_UINT32;
1703 set(v);
1706 return v;
1707 }
Here is the call graph for this function:

◆ operator=() [13/14]

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

Definition at line 1716 of file odbxx.cxx.

1716 {
1717 if (m_tid == 0)
1718 m_tid = TID_UINT64;
1719 set(v);
1722 return v;
1723 }
Here is the call graph for this function:

◆ operator=() [14/14]

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

Definition at line 1668 of file odbxx.cxx.

1668 {
1669 if (m_tid == 0)
1670 m_tid = TID_UINT8;
1671 set(v);
1674 return v;
1675 }
Here is the call graph for this function:

◆ s()

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

Definition at line 361 of file odbxx.h.

361 {
362 return get();
363 }
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 232 of file odbxx.h.

232 {
233 set(std::string(v));
234 }

◆ set() [2/5]

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

Definition at line 228 of file odbxx.h.

228 {
229 set(std::string(v));
230 }

◆ set() [3/5]

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

Definition at line 183 of file odbxx.h.

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

◆ set() [4/5]

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

Definition at line 195 of file odbxx.h.

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

◆ set() [5/5]

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

Definition at line 142 of file odbxx.h.

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

◆ set_odb()

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

Definition at line 189 of file odbxx.h.

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

◆ set_parent()

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

Definition at line 102 of file odbxx.h.

102{ 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 172 of file odbxx.h.

172 {
173 delete m_string;
174 m_string = new std::string(s);
175 }
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 179 of file odbxx.h.

179 {
180 m_string = s;
181 }
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 1783 of file odbxx.cxx.

1783 {
1784 m_tid = TID_STRING;
1785 set(v);
1787 m_parent_odb->write(size);
1788 }
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 105 of file odbxx.h.

105{ 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 382 of file odbxx.h.

382 {
383 std::string s = o;
384 output << s;
385 return output;
386 };
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 60 of file odbxx.h.

◆ m_double

double midas::u_odb::m_double

Definition at line 62 of file odbxx.h.

◆ m_float

float midas::u_odb::m_float

Definition at line 61 of file odbxx.h.

◆ m_int16

int16_t midas::u_odb::m_int16

Definition at line 55 of file odbxx.h.

◆ m_int32

int32_t midas::u_odb::m_int32

Definition at line 57 of file odbxx.h.

◆ m_int64

int64_t midas::u_odb::m_int64

Definition at line 59 of file odbxx.h.

◆ m_int8

int8_t midas::u_odb::m_int8

Definition at line 53 of file odbxx.h.

◆ m_odb

odb* midas::u_odb::m_odb

Definition at line 64 of file odbxx.h.

◆ m_parent_odb

odb* midas::u_odb::m_parent_odb
private

Definition at line 68 of file odbxx.h.

◆ m_string

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

Definition at line 63 of file odbxx.h.

◆ m_tid

int midas::u_odb::m_tid
private

Definition at line 67 of file odbxx.h.

◆ m_uint16

uint16_t midas::u_odb::m_uint16

Definition at line 54 of file odbxx.h.

◆ m_uint32

uint32_t midas::u_odb::m_uint32

Definition at line 56 of file odbxx.h.

◆ m_uint64

uint64_t midas::u_odb::m_uint64

Definition at line 58 of file odbxx.h.

◆ m_uint8

uint8_t midas::u_odb::m_uint8

Definition at line 52 of file odbxx.h.


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