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

1495 {
1496 T v;
1497 midas::odb oc(o);
1498 oc.get(v);
1499 return v != d;
1500 }
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 1503 of file odbxx.h.

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

◆ operator<() [1/2]

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

Definition at line 1511 of file odbxx.h.

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

◆ operator<() [2/2]

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

Definition at line 1519 of file odbxx.h.

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

◆ operator<=() [1/2]

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

Definition at line 1527 of file odbxx.h.

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

◆ operator<=() [2/2]

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

Definition at line 1535 of file odbxx.h.

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

◆ operator==() [1/2]

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

Definition at line 1477 of file odbxx.h.

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

◆ operator==() [2/2]

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

Definition at line 1487 of file odbxx.h.

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

◆ operator>() [1/2]

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

Definition at line 1543 of file odbxx.h.

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

◆ operator>() [2/2]

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

Definition at line 1551 of file odbxx.h.

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

◆ operator>=() [1/2]

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

Definition at line 1559 of file odbxx.h.

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

◆ operator>=() [2/2]

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

Definition at line 1567 of file odbxx.h.

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

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

1253 {
1254 // Delete any subkeys that are not in the list of defaults.
1255 KEY key;
1256 db_get_key(hDB, hKey, &key);
1257
1258 if (key.type == TID_KEY) {
1259 std::vector<std::string> to_delete;
1260
1261 for (int i = 0;; i++) {
1262 HNDLE hSubKey;
1263 int status = db_enum_key(hDB, hKey, i, &hSubKey);
1264 if (status != DB_SUCCESS)
1265 break;
1266
1267 KEY subKey;
1268 db_get_key(hDB, hSubKey, &subKey);
1269 std::string full_path = path + "/" + subKey.name;
1270
1271 if (!default_odb.is_subkey(subKey.name)) {
1272 to_delete.push_back(subKey.name);
1273
1274 if (default_odb.get_debug()) {
1275 std::cout << "Deleting " << full_path << " as not in list of defaults" << std::endl;
1276 }
1277 } else if (key.type == TID_KEY) {
1278 recurse_del_keys_not_in_defaults(full_path, hDB, hSubKey, default_odb[(const char *)(subKey.name)]);
1279 }
1280 }
1281
1282 for (auto name : to_delete) {
1283 HNDLE hSubKey;
1284 db_find_key(hDB, hKey, name.c_str(), &hSubKey);
1285 db_delete_key(hDB, hSubKey);
1286 }
1287 }
1288 }
static bool get_debug()
Definition odbxx.h:1402
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:1253
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 1300 of file odbxx.cxx.

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

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