MIDAS
Loading...
Searching...
No Matches
midas Namespace Reference

Classes

class  odb
 
class  u_odb
 

Enumerations

enum  odb_flags {
  AUTO_REFRESH_READ = 0 , AUTO_REFRESH_WRITE , PRESERVE_STRING_SIZE , AUTO_CREATE ,
  AUTO_ENLARGE_ARRAY , DIRTY , DELETED , WRITE_PROTECT ,
  TRIGGER_HOTLINK
}
 

Functions

std::vector< std::string > split (std::string input, char delimiter='/')
 
void recurse_del_keys_not_in_defaults (std::string path, HNDLE hDB, HNDLE hKey, midas::odb &default_odb)
 
void recurse_get_defaults_order (std::string path, midas::odb &default_odb, std::map< std::string, std::vector< std::string > > &retval)
 
void recurse_fix_order (midas::odb &default_odb, std::map< std::string, std::vector< std::string > > &user_order)
 
template<typename T >
bool operator== (const midas::odb &o, const T &d)
 
template<typename T >
bool operator== (const T &d, const midas::odb &o)
 
template<typename T >
bool operator!= (const midas::odb &o, const T &d)
 
template<typename T >
bool operator!= (const T &d, const midas::odb &o)
 
template<typename T >
bool operator< (const midas::odb &o, const T &d)
 
template<typename T >
bool operator< (const T &d, const midas::odb &o)
 
template<typename T >
bool operator<= (const midas::odb &o, const T &d)
 
template<typename T >
bool operator<= (const T &d, const midas::odb &o)
 
template<typename T >
bool operator> (const midas::odb &o, const T &d)
 
template<typename T >
bool operator> (const T &d, const midas::odb &o)
 
template<typename T >
bool operator>= (const midas::odb &o, const T &d)
 
template<typename T >
bool operator>= (const T &d, const midas::odb &o)
 

Variables

std::vector< midas::odb * > g_watchlist = {}
 

Enumeration Type Documentation

◆ odb_flags

Enumerator
AUTO_REFRESH_READ 
AUTO_REFRESH_WRITE 
PRESERVE_STRING_SIZE 
AUTO_CREATE 
AUTO_ENLARGE_ARRAY 
DIRTY 
DELETED 
WRITE_PROTECT 
TRIGGER_HOTLINK 

Definition at line 393 of file odbxx.h.

393 {
399 DIRTY,
400 DELETED,
403 };
@ AUTO_REFRESH_WRITE
Definition odbxx.h:395
@ DIRTY
Definition odbxx.h:399
@ TRIGGER_HOTLINK
Definition odbxx.h:402
@ AUTO_REFRESH_READ
Definition odbxx.h:394
@ WRITE_PROTECT
Definition odbxx.h:401
@ AUTO_ENLARGE_ARRAY
Definition odbxx.h:398
@ AUTO_CREATE
Definition odbxx.h:397
@ PRESERVE_STRING_SIZE
Definition odbxx.h:396
@ DELETED
Definition odbxx.h:400

Function Documentation

◆ operator!=() [1/2]

template<typename T >
bool midas::operator!= ( const midas::odb o,
const T &  d 
)

Definition at line 1494 of file odbxx.h.

1494 {
1495 T v;
1496 midas::odb oc(o);
1497 oc.get(v);
1498 return v != d;
1499 }
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
double d
Definition system.cxx:1313

◆ operator!=() [2/2]

template<typename T >
bool midas::operator!= ( const T &  d,
const midas::odb o 
)

Definition at line 1502 of file odbxx.h.

1502 {
1503 T v;
1504 midas::odb oc(o);
1505 oc.get(v);
1506 return d != v;
1507 }

◆ operator<() [1/2]

template<typename T >
bool midas::operator< ( const midas::odb o,
const T &  d 
)

Definition at line 1510 of file odbxx.h.

1510 {
1511 T v;
1512 midas::odb oc(o);
1513 oc.get(v);
1514 return v < d;
1515 }

◆ operator<() [2/2]

template<typename T >
bool midas::operator< ( const T &  d,
const midas::odb o 
)

Definition at line 1518 of file odbxx.h.

1518 {
1519 T v;
1520 midas::odb oc(o);
1521 oc.get(v);
1522 return d < v;
1523 }

◆ operator<=() [1/2]

template<typename T >
bool midas::operator<= ( const midas::odb o,
const T &  d 
)

Definition at line 1526 of file odbxx.h.

1526 {
1527 T v;
1528 midas::odb oc(o);
1529 oc.get(v);
1530 return v <= d;
1531 }

◆ operator<=() [2/2]

template<typename T >
bool midas::operator<= ( const T &  d,
const midas::odb o 
)

Definition at line 1534 of file odbxx.h.

1534 {
1535 T v;
1536 midas::odb oc(o);
1537 oc.get(v);
1538 return d <= v;
1539 }

◆ operator==() [1/2]

template<typename T >
bool midas::operator== ( const midas::odb o,
const T &  d 
)

Definition at line 1476 of file odbxx.h.

1476 {
1477 // the operator needs a "const midas::odb" reference,
1478 // so we have to make a non-const copy
1479 T v;
1480 midas::odb oc(o);
1481 oc.get(v);
1482 return v == d;
1483 }

◆ operator==() [2/2]

template<typename T >
bool midas::operator== ( const T &  d,
const midas::odb o 
)

Definition at line 1486 of file odbxx.h.

1486 {
1487 T v;
1488 midas::odb oc(o);
1489 oc.get(v);
1490 return d == v;
1491 }

◆ operator>() [1/2]

template<typename T >
bool midas::operator> ( const midas::odb o,
const T &  d 
)

Definition at line 1542 of file odbxx.h.

1542 {
1543 T v;
1544 midas::odb oc(o);
1545 oc.get(v);
1546 return v > d;
1547 }

◆ operator>() [2/2]

template<typename T >
bool midas::operator> ( const T &  d,
const midas::odb o 
)

Definition at line 1550 of file odbxx.h.

1550 {
1551 T v;
1552 midas::odb oc(o);
1553 oc.get(v);
1554 return d > v;
1555 }

◆ operator>=() [1/2]

template<typename T >
bool midas::operator>= ( const midas::odb o,
const T &  d 
)

Definition at line 1558 of file odbxx.h.

1558 {
1559 T v;
1560 midas::odb oc(o);
1561 oc.get(v);
1562 return v >= d;
1563 }

◆ operator>=() [2/2]

template<typename T >
bool midas::operator>= ( const T &  d,
const midas::odb o 
)

Definition at line 1566 of file odbxx.h.

1566 {
1567 T v;
1568 midas::odb oc(o);
1569 oc.get(v);
1570 return d >= v;
1571 }

◆ recurse_del_keys_not_in_defaults()

void midas::recurse_del_keys_not_in_defaults ( std::string  path,
HNDLE  hDB,
HNDLE  hKey,
midas::odb default_odb 
)

Definition at line 1306 of file odbxx.cxx.

1306 {
1307 // Delete any subkeys that are not in the list of defaults.
1308 KEY key;
1309 db_get_key(hDB, hKey, &key);
1310
1311 if (key.type == TID_KEY) {
1312 std::vector<std::string> to_delete;
1313
1314 for (int i = 0;; i++) {
1315 HNDLE hSubKey;
1316 int status = db_enum_key(hDB, hKey, i, &hSubKey);
1317 if (status != DB_SUCCESS)
1318 break;
1319
1320 KEY subKey;
1322 std::string full_path = path + "/" + subKey.name;
1323
1324 if (!default_odb.is_subkey(subKey.name)) {
1325 to_delete.push_back(subKey.name);
1326
1327 if (default_odb.get_debug()) {
1328 std::cout << "Deleting " << full_path << " as not in list of defaults" << std::endl;
1329 }
1330 } else if (key.type == TID_KEY) {
1332 }
1333 }
1334
1335 for (auto name : to_delete) {
1336 HNDLE hSubKey;
1337 db_find_key(hDB, hKey, name.c_str(), &hSubKey);
1339 }
1340 }
1341 }
#define FALSE
Definition cfortran.h:309
#define DB_SUCCESS
Definition midas.h:631
#define TID_KEY
Definition midas.h:349
INT db_delete_key(HNDLE hDB, HNDLE hKey, BOOL follow_links)
Definition odb.cxx:3861
INT db_get_key(HNDLE hDB, HNDLE hKey, KEY *key)
Definition odb.cxx:6024
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
Definition odb.cxx:4084
INT db_enum_key(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
Definition odb.cxx:5591
HNDLE hKey
HNDLE hDB
main ODB handle
Definition mana.cxx:207
KEY key
Definition mdump.cxx:34
INT i
Definition mdump.cxx:32
INT HNDLE
Definition midas.h:132
#define name(x)
Definition midas_macro.h:24
void recurse_del_keys_not_in_defaults(std::string path, HNDLE hDB, HNDLE hKey, midas::odb &default_odb)
Definition odbxx.cxx:1306
DWORD status
Definition odbhist.cxx:39
Definition midas.h:1026
DWORD type
Definition midas.h:1027
Here is the call graph for this function:
Here is the caller graph for this function:

◆ recurse_fix_order()

void midas::recurse_fix_order ( midas::odb default_odb,
std::map< std::string, std::vector< std::string > > &  user_order 
)

Definition at line 1353 of file odbxx.cxx.

1353 {
1354 std::string path = default_odb.get_full_path();
1355
1356 if (user_order.find(path) != user_order.end()) {
1357 default_odb.fix_order(user_order[path]);
1358 }
1359
1360 for (midas::odb& it : default_odb) {
1361 if (it.get_tid() == TID_KEY) {
1362 recurse_fix_order(it, user_order);
1363 }
1364 }
1365 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ recurse_get_defaults_order()

void midas::recurse_get_defaults_order ( std::string  path,
midas::odb default_odb,
std::map< std::string, std::vector< std::string > > &  retval 
)

Definition at line 1343 of file odbxx.cxx.

1343 {
1344 for (midas::odb& sub : default_odb) {
1345 if (sub.get_tid() == TID_KEY) {
1346 recurse_get_defaults_order(path + "/" + sub.get_name(), sub, retval);
1347 }
1348
1349 retval[path].push_back(sub.get_name());
1350 }
1351 }
void recurse_get_defaults_order(std::string path, midas::odb &default_odb, std::map< std::string, std::vector< std::string > > &retval)
Definition odbxx.cxx:1343
static double sub(double a, double b)
Definition tinyexpr.c:244
Here is the call graph for this function:
Here is the caller graph for this function:

◆ split()

std::vector< std::string > midas::split ( std::string  input,
char  delimiter = '/' 
)

Definition at line 241 of file odbxx.cxx.

241 {
242 std::vector<std::string> result;
243 std::string item;
244
245 if (!input.empty() && input.front() == '/')
246 input.erase(0, 1);
247 if (!input.empty() && input.back() == '/')
248 input.pop_back();
249
250 std::stringstream ss(input);
251
252 while (std::getline(ss, item, delimiter)) {
253 result.push_back(item);
254 }
255
256 return result;
257 }
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_watchlist

std::vector<midas::odb *> midas::g_watchlist = {}

Definition at line 44 of file odbxx.cxx.

44{};