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

399 {
405 DIRTY,
406 DELETED,
409 };
@ AUTO_REFRESH_WRITE
Definition odbxx.h:401
@ DIRTY
Definition odbxx.h:405
@ TRIGGER_HOTLINK
Definition odbxx.h:408
@ AUTO_REFRESH_READ
Definition odbxx.h:400
@ WRITE_PROTECT
Definition odbxx.h:407
@ AUTO_ENLARGE_ARRAY
Definition odbxx.h:404
@ AUTO_CREATE
Definition odbxx.h:403
@ PRESERVE_STRING_SIZE
Definition odbxx.h:402
@ DELETED
Definition odbxx.h:406

Function Documentation

◆ operator!=() [1/2]

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

Definition at line 1500 of file odbxx.h.

1500 {
1501 T v;
1502 midas::odb oc(o);
1503 oc.get(v);
1504 return v != d;
1505 }
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 1508 of file odbxx.h.

1508 {
1509 T v;
1510 midas::odb oc(o);
1511 oc.get(v);
1512 return d != v;
1513 }

◆ operator<() [1/2]

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

Definition at line 1516 of file odbxx.h.

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

◆ operator<() [2/2]

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

Definition at line 1524 of file odbxx.h.

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

◆ operator<=() [1/2]

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

Definition at line 1532 of file odbxx.h.

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

◆ operator<=() [2/2]

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

Definition at line 1540 of file odbxx.h.

1540 {
1541 T v;
1542 midas::odb oc(o);
1543 oc.get(v);
1544 return d <= v;
1545 }

◆ operator==() [1/2]

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

Definition at line 1482 of file odbxx.h.

1482 {
1483 // the operator needs a "const midas::odb" reference,
1484 // so we have to make a non-const copy
1485 T v;
1486 midas::odb oc(o);
1487 oc.get(v);
1488 return v == d;
1489 }

◆ operator==() [2/2]

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

Definition at line 1492 of file odbxx.h.

1492 {
1493 T v;
1494 midas::odb oc(o);
1495 oc.get(v);
1496 return d == v;
1497 }

◆ operator>() [1/2]

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

Definition at line 1548 of file odbxx.h.

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

◆ operator>() [2/2]

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

Definition at line 1556 of file odbxx.h.

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

◆ operator>=() [1/2]

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

Definition at line 1564 of file odbxx.h.

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

◆ operator>=() [2/2]

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

Definition at line 1572 of file odbxx.h.

1572 {
1573 T v;
1574 midas::odb oc(o);
1575 oc.get(v);
1576 return d >= v;
1577 }

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

1255 {
1256 // Delete any subkeys that are not in the list of defaults.
1257 KEY key;
1258 db_get_key(hDB, hKey, &key);
1259
1260 if (key.type == TID_KEY) {
1261 std::vector<std::string> to_delete;
1262
1263 for (int i = 0;; i++) {
1264 HNDLE hSubKey;
1265 int status = db_enum_key(hDB, hKey, i, &hSubKey);
1266 if (status != DB_SUCCESS)
1267 break;
1268
1269 KEY subKey;
1270 db_get_key(hDB, hSubKey, &subKey);
1271 std::string full_path = path + "/" + subKey.name;
1272
1273 if (!default_odb.is_subkey(subKey.name)) {
1274 to_delete.push_back(subKey.name);
1275
1276 if (default_odb.get_debug()) {
1277 std::cout << "Deleting " << full_path << " as not in list of defaults" << std::endl;
1278 }
1279 } else if (key.type == TID_KEY) {
1280 recurse_del_keys_not_in_defaults(full_path, hDB, hSubKey, default_odb[(const char *)(subKey.name)]);
1281 }
1282 }
1283
1284 for (auto name : to_delete) {
1285 HNDLE hSubKey;
1286 db_find_key(hDB, hKey, name.c_str(), &hSubKey);
1287 db_delete_key(hDB, hSubKey);
1288 }
1289 }
1290 }
static bool get_debug()
Definition odbxx.h:1407
bool is_subkey(std::string str)
Definition odbxx.cxx:544
#define DB_SUCCESS
Definition midas.h:632
#define TID_KEY
Definition midas.h:349
INT db_delete_key(HNDLE hDB, HNDLE hKey, BOOL follow_links)
Definition odb.cxx:3933
INT db_get_key(HNDLE hDB, HNDLE hKey, KEY *key)
Definition odb.cxx:6043
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
Definition odb.cxx:4256
INT db_enum_key(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
Definition odb.cxx:5357
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:1255
DWORD status
Definition odbhist.cxx:39
Definition midas.h:1027
DWORD type
Definition midas.h:1028
char name[NAME_LENGTH]
Definition midas.h:1030
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 1302 of file odbxx.cxx.

1302 {
1303 std::string path = default_odb.get_full_path();
1304
1305 if (user_order.find(path) != user_order.end()) {
1306 default_odb.fix_order(user_order[path]);
1307 }
1308
1309 for (midas::odb& it : default_odb) {
1310 if (it.get_tid() == TID_KEY) {
1311 recurse_fix_order(it, user_order);
1312 }
1313 }
1314 }
std::string get_full_path()
Definition odbxx.cxx:362
void fix_order(std::vector< std::string > target_subkey_order)
Definition odbxx.cxx:1316
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 1292 of file odbxx.cxx.

1292 {
1293 for (midas::odb& sub : default_odb) {
1294 if (sub.get_tid() == TID_KEY) {
1295 recurse_get_defaults_order(path + "/" + sub.get_name(), sub, retval);
1296 }
1297
1298 retval[path].push_back(sub.get_name());
1299 }
1300 }
void recurse_get_defaults_order(std::string path, midas::odb &default_odb, std::map< std::string, std::vector< std::string > > &retval)
Definition odbxx.cxx:1292
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 222 of file odbxx.cxx.

222 {
223 std::vector<std::string> result;
224 std::string item;
225
226 if (!input.empty() && input.front() == '/')
227 input.erase(0, 1);
228 if (!input.empty() && input.back() == '/')
229 input.pop_back();
230
231 std::stringstream ss(input);
232
233 while (std::getline(ss, item, delimiter)) {
234 result.push_back(item);
235 }
236
237 return result;
238 }

Variable Documentation

◆ g_watchlist

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

Definition at line 45 of file odbxx.cxx.

45{};