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 1683 of file odbxx.cxx.

1683 {
1684 if (m_tid == TID_STRING || m_tid == TID_LINK)
1685 delete m_string;
1686 else if (m_tid == TID_KEY)
1687 delete m_odb;
1688 }
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 1930 of file odbxx.cxx.

1930 {
1931 if (m_tid == TID_UINT8)
1932 m_uint8 += inc;
1933 else if (m_tid == TID_INT8)
1934 m_int8 += inc;
1935 else if (m_tid == TID_UINT16)
1936 m_uint16 += inc;
1937 else if (m_tid == TID_INT16)
1938 m_int16 += inc;
1939 else if (m_tid == TID_UINT32)
1940 m_uint32 += inc;
1941 else if (m_tid == TID_INT32)
1942 m_int32 += inc;
1943 else if (m_tid == TID_FLOAT)
1944 m_float += static_cast<float>(inc);
1945 else if (m_tid == TID_DOUBLE)
1946 m_double += inc;
1947 else
1948 mthrow("Invalid arithmetic operation for ODB key \"" +
1949 m_parent_odb->get_full_path() + "\"");
1952 }
std::string get_full_path()
Definition odbxx.cxx:419
void write(int str_size=0)
Definition odbxx.cxx:1155
bool is_auto_refresh_write() const
Definition odbxx.h:1351
#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 1691 of file odbxx.cxx.

1691 {
1692 if (m_tid == TID_UINT8)
1693 s = std::to_string(m_uint8);
1694 else if (m_tid == TID_INT8)
1695 s = std::to_string(m_int8);
1696 else if (m_tid == TID_UINT16)
1697 s = std::to_string(m_uint16);
1698 else if (m_tid == TID_INT16)
1699 s = std::to_string(m_int16);
1700 else if (m_tid == TID_UINT32)
1701 s = std::to_string(m_uint32);
1702 else if (m_tid == TID_INT32)
1703 s = std::to_string(m_int32);
1704 else if (m_tid == TID_UINT64)
1705 s = std::to_string(m_uint64);
1706 else if (m_tid == TID_INT64)
1707 s = std::to_string(m_int64);
1708 else if (m_tid == TID_BOOL)
1709 s = std::string(m_bool ? "true" : "false");
1710 else if (m_tid == TID_FLOAT)
1711 s = std::to_string(m_float);
1712 else if (m_tid == TID_DOUBLE)
1713 s = std::to_string(m_double);
1714 else if (m_tid == TID_STRING)
1715 s = *m_string;
1716 else if (m_tid == TID_LINK)
1717 s = *m_string;
1718 else if (m_tid == TID_KEY)
1719 m_odb->print(s, 0);
1720 else if (m_tid == 0)
1721 mthrow("Subkey \"" + m_parent_odb->get_name() + "\" not found");
1722 else
1723 mthrow("Invalid type ID " + std::to_string(m_tid));
1724 }
std::string get_name()
Definition odbxx.h:1440
std::string print()
Definition odbxx.cxx:476
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 1954 of file odbxx.cxx.

1954 {
1955 int tid = m_parent_odb->get_tid();
1956 if (tid == TID_UINT8)
1957 m_uint8 *= f;
1958 else if (tid == TID_INT8)
1959 m_int8 *= f;
1960 else if (tid == TID_UINT16)
1961 m_uint16 *= f;
1962 else if (tid == TID_INT16)
1963 m_int16 *= f;
1964 else if (tid == TID_UINT32)
1965 m_uint32 *= f;
1966 else if (tid == TID_INT32)
1967 m_int32 *= f;
1968 else if (tid == TID_FLOAT)
1969 m_float *= f;
1970 else if (tid == TID_DOUBLE)
1971 m_double *= f;
1972 else
1973 mthrow("Invalid operation for ODB key \"" +
1974 m_parent_odb->get_full_path() + "\"");
1977 }
int get_tid()
Definition odbxx.h:1438
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 1892 of file odbxx.cxx.

1892 {
1893 if (m_parent_odb)
1895 return get<bool>();
1896 }
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 1914 of file odbxx.cxx.

1914 {
1915 if (m_parent_odb)
1917 if (m_tid != TID_STRING && m_tid != TID_LINK)
1918 mthrow("Only ODB string keys can be converted to \"const char *\"");
1919 return m_string->c_str();
1920 }

◆ operator double()

midas::u_odb::operator double ( )

Definition at line 1902 of file odbxx.cxx.

1902 {
1903 if (m_parent_odb)
1905 return get<double>();
1906 }
Here is the call graph for this function:

◆ operator float()

midas::u_odb::operator float ( )

Definition at line 1897 of file odbxx.cxx.

1897 {
1898 if (m_parent_odb)
1900 return get<float>();
1901 }
Here is the call graph for this function:

◆ operator int16_t()

midas::u_odb::operator int16_t ( )

Definition at line 1867 of file odbxx.cxx.

1867 {
1868 if (m_parent_odb)
1870 return get<int16_t>();
1871 }
Here is the call graph for this function:

◆ operator int32_t()

midas::u_odb::operator int32_t ( )

Definition at line 1877 of file odbxx.cxx.

1877 {
1878 if (m_parent_odb)
1880 return get<int32_t>();
1881 }
Here is the call graph for this function:

◆ operator int64_t()

midas::u_odb::operator int64_t ( )

Definition at line 1887 of file odbxx.cxx.

1887 {
1888 if (m_parent_odb)
1890 return get<int64_t>();
1891 }
Here is the call graph for this function:

◆ operator int8_t()

midas::u_odb::operator int8_t ( )

Definition at line 1857 of file odbxx.cxx.

1857 {
1858 if (m_parent_odb)
1860 return get<int8_t>();
1861 }
Here is the call graph for this function:

◆ operator midas::odb &()

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

Definition at line 1921 of file odbxx.cxx.

1921 {
1922 if (m_parent_odb)
1924 if (m_tid != TID_KEY)
1925 mthrow("Only ODB directories can be converted to \"midas::odb &\"");
1926 return *m_odb;
1927 }
Here is the call graph for this function:

◆ operator std::string()

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

Definition at line 1907 of file odbxx.cxx.

1907 {
1908 if (m_parent_odb)
1910 std::string s;
1911 get(s);
1912 return s;
1913 }

◆ operator uint16_t()

midas::u_odb::operator uint16_t ( )

Definition at line 1862 of file odbxx.cxx.

1862 {
1863 if (m_parent_odb)
1865 return get<uint16_t>();
1866 }
Here is the call graph for this function:

◆ operator uint32_t()

midas::u_odb::operator uint32_t ( )

Definition at line 1872 of file odbxx.cxx.

1872 {
1873 if (m_parent_odb)
1875 return get<uint32_t>();
1876 }
Here is the call graph for this function:

◆ operator uint64_t()

midas::u_odb::operator uint64_t ( )

Definition at line 1882 of file odbxx.cxx.

1882 {
1883 if (m_parent_odb)
1885 return get<uint64_t>();
1886 }
Here is the call graph for this function:

◆ operator uint8_t()

midas::u_odb::operator uint8_t ( )

Definition at line 1852 of file odbxx.cxx.

1852 {
1853 if (m_parent_odb)
1855 return get<uint8_t>();
1856 }
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:1954
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 1793 of file odbxx.cxx.

1793 {
1794 if (m_tid == 0)
1795 m_tid = TID_BOOL;
1796 set(v);
1799 return v;
1800 }
Here is the call graph for this function:

◆ operator=() [2/14]

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

Definition at line 1817 of file odbxx.cxx.

1817 {
1818 if (m_tid == 0)
1819 m_tid = TID_STRING;
1820 set(v);
1823 return v;
1824 }
Here is the call graph for this function:

◆ operator=() [3/14]

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

Definition at line 1809 of file odbxx.cxx.

1809 {
1810 if (m_tid == 0)
1811 m_tid = TID_DOUBLE;
1812 set(v);
1815 return v;
1816 }
Here is the call graph for this function:

◆ operator=() [4/14]

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

Definition at line 1801 of file odbxx.cxx.

1801 {
1802 if (m_tid == 0)
1803 m_tid = TID_FLOAT;
1804 set(v);
1807 return v;
1808 }
Here is the call graph for this function:

◆ operator=() [5/14]

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

Definition at line 1753 of file odbxx.cxx.

1753 {
1754 if (m_tid == 0)
1755 m_tid = TID_INT16;
1756 set(v);
1759 return v;
1760 }
Here is the call graph for this function:

◆ operator=() [6/14]

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

Definition at line 1769 of file odbxx.cxx.

1769 {
1770 if (m_tid == 0)
1771 m_tid = TID_INT32;
1772 set(v);
1775 return v;
1776 }
Here is the call graph for this function:

◆ operator=() [7/14]

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

Definition at line 1785 of file odbxx.cxx.

1785 {
1786 if (m_tid == 0)
1787 m_tid = TID_INT64;
1788 set(v);
1791 return v;
1792 }
Here is the call graph for this function:

◆ operator=() [8/14]

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

Definition at line 1737 of file odbxx.cxx.

1737 {
1738 if (m_tid == 0)
1739 m_tid = TID_INT8;
1740 set(v);
1743 return v;
1744 }
Here is the call graph for this function:

◆ operator=() [9/14]

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

Definition at line 1826 of file odbxx.cxx.

1826 {
1827 if (m_tid == 0)
1828 m_tid = TID_STRING;
1829 set(*v);
1832 return v;
1833 }
Here is the call graph for this function:

◆ operator=() [10/14]

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

Definition at line 1835 of file odbxx.cxx.

1835 {
1836 if (m_tid == 0)
1837 m_tid = TID_STRING;
1838 set(v);
1841 return v;
1842 }
Here is the call graph for this function:

◆ operator=() [11/14]

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

Definition at line 1745 of file odbxx.cxx.

1745 {
1746 if (m_tid == 0)
1747 m_tid = TID_UINT16;
1748 set(v);
1751 return v;
1752 }
Here is the call graph for this function:

◆ operator=() [12/14]

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

Definition at line 1761 of file odbxx.cxx.

1761 {
1762 if (m_tid == 0)
1763 m_tid = TID_UINT32;
1764 set(v);
1767 return v;
1768 }
Here is the call graph for this function:

◆ operator=() [13/14]

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

Definition at line 1777 of file odbxx.cxx.

1777 {
1778 if (m_tid == 0)
1779 m_tid = TID_UINT64;
1780 set(v);
1783 return v;
1784 }
Here is the call graph for this function:

◆ operator=() [14/14]

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

Definition at line 1729 of file odbxx.cxx.

1729 {
1730 if (m_tid == 0)
1731 m_tid = TID_UINT8;
1732 set(v);
1735 return v;
1736 }
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, nullptr, 0); // stoi convertx 0x automatically
198 else if (m_tid == TID_INT8)
199 m_int8 = std::stoi(v, nullptr, 0);
200 else if (m_tid == TID_UINT16)
201 m_uint16 = std::stoi(v, nullptr, 0);
202 else if (m_tid == TID_INT16)
203 m_int16 = std::stoi(v, nullptr, 0);
204 else if (m_tid == TID_UINT32)
205 m_uint32 = std::stoul(v, nullptr, 0);
206 else if (m_tid == TID_INT32)
207 m_int32 = std::stoul(v, nullptr, 0);
208 else if (m_tid == TID_UINT64)
209 m_uint64 = std::stoul(v, nullptr, 0);
210 else if (m_tid == TID_INT64)
211 m_int64 = std::stoul(v, nullptr, 0);
212 else if (m_tid == TID_BOOL)
213 m_bool = std::stoi(v, nullptr, 0);
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 1844 of file odbxx.cxx.

1844 {
1845 m_tid = TID_STRING;
1846 set(v);
1848 m_parent_odb->write(size);
1849 }
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: