DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::oks Namespace Reference

Namespaces

namespace  oks
namespace  python
namespace  xml

Classes

class  AddRcrError
class  AttributeConversionFailed
class  AttributeRangeError
class  AttributeReadError
class  AuthenticationFailure
 Failed to authenticate user. More...
class  bad_query_syntax
class  BadFileData
class  BadReqExp
struct  BindWarning
class  CannotAddClass
 Failed add new class. More...
class  CanNotBackupFile
 Failed backup file. More...
class  CanNotCreateFile
 Cannot create file. More...
class  CanNotCreateRepositoryDir
 Cannot create file. More...
class  CannotDestroyClass
class  CannotFindSuperClass
class  CanNotOpenFile
 Cannot open file. More...
class  CannotRegisterClass
class  CannotResolvePath
 Failed resolve path. More...
class  CanNotSetActiveFile
 Failed to set active file. More...
class  CanNotSetFile
 Failed move item to file. More...
class  CanNotWriteToFile
 Failed write to file. More...
struct  CommandOutput
class  Comment
 The comment about file modification. A comment can be added when user saves file using OKS tools. More...
class  Date
class  EndOfXmlStream
struct  equal_class_ptr
struct  equal_file_ptr
struct  equal_obj_ptr
struct  equal_str
class  exception
class  FailedAddComment
 Cannot add comment. Such exception is thrown when OKS cannot add new comment. More...
class  FailedAddInclude
 Cannot add include file. Such exception is thrown when OKS cannot add include file. More...
class  FailedChangeComment
 Cannot change comment. Such exception is thrown when OKS cannot change comment. More...
class  FailedCreateObject
class  FailedDestoyObject
class  FailedLoadFile
 Cannot load file. More...
class  FailedRead
class  FailedReadObject
class  FailedReloadFile
 Cannot re-load files. More...
class  FailedRemoveComment
 Cannot remove comment. Such exception is thrown when OKS cannot remove comment. More...
class  FailedRemoveInclude
 Cannot remove include file. Such exception is thrown when OKS cannot remove include file. More...
class  FailedRenameInclude
 Cannot rename include file. Such exception is thrown when OKS cannot rename include file. More...
class  FailedRenameObject
class  FailedSave
class  FailedSaveObject
class  FileChangeError
class  FileCompareError
class  FileLockError
 Cannot add include file. Such exception is thrown when OKS cannot add include file. More...
class  GitFoldersHolder
struct  hash_class_ptr
struct  hash_file_ptr
struct  hash_obj_ptr
struct  hash_str
struct  LoadErrors
class  ObjectBindError
class  ObjectGetError
class  ObjectInitError
class  ObjectOperationFailed
class  ObjectSetError
class  Oks
 Class contains common OKS classes and methods. More...
struct  OksAliasTable
 The struct OksAliasTable is used to support aliases. More...
class  OksAndExpression
 OKS query logical AND expression class. More...
class  OksAttribute
 OKS attribute class. More...
class  OksClass
 The OKS class. More...
class  OksComparator
 OKS query expression comparator class. More...
struct  OksData
 Struct OKS data. More...
struct  OksDataInfo
 Struct OKS data information. More...
class  OksFile
 Provides interface to the OKS XML schema and data files. More...
class  OksFunctionProfiler
class  OksIndex
class  OksJob
class  OksKernel
 Provides interface to the OKS kernel. More...
class  OksListBaseQueryExpression
 Abstract class describing list of OKS query expressions. More...
struct  OksLoadObjectsJob
class  OksMethod
 OKS method class. More...
class  OksMethodImplementation
 OKS method implementation class. More...
struct  OksNameTable
 The struct OksNameTable is used to generate unique strings. More...
class  OksNotExpression
 OKS query logical NOT expression class. More...
class  OksObject
 OksObject describes instance of OksClass. More...
class  OksObjectSortBy
class  OksOrExpression
 OKS query logical OR expression class. More...
class  OksPipeline
class  OksProfiler
class  OksQuery
 OKS query class. More...
class  OksQueryExpression
 OKS query expression class. More...
class  OksRange
 OKS range class. More...
struct  OksRCR
 The struct OksRCR describes Reverse Composite Relationship (i.e. back reference from child to composite parent). More...
class  OksRelationship
class  OksRelationshipExpression
 OKS query relationship expression class. More...
struct  OksRepositoryVersion
class  OksString
 Class OKS string. More...
struct  OksXmlAttribute
class  OksXmlInputStream
class  OksXmlOutputStream
struct  OksXmlRelValue
struct  OksXmlToken
struct  OksXmlTokenPool
struct  OksXmlValue
class  QueryFailed
class  QueryPath
class  QueryPathExpression
struct  ReadFileParams
struct  RefData
struct  ReloadObjects
struct  ReposDirs
class  RepositoryOperationFailed
 Cannot commit, checkout or release files. More...
class  SetOperationFailed
class  Time

Typedefs

typedef std::unordered_set< const OksClass *, oks::hash_class_ptr, oks::equal_class_ptr > ClassSet

Enumerations

enum  __LogSeverity__ { Error = 0 , Warning , Log , Debug }

Functions

bool cmp_str1 (const char *s1, const char s2[2])
bool cmp_str2 (const char *s1, const char s2[3])
bool cmp_str2n (const char *s1, const char s2[2])
bool cmp_str3 (const char *s1, const char s2[4])
bool cmp_str3n (const char *s1, const char s2[3])
bool cmp_str4 (const char *s1, const char s2[5])
bool cmp_str4n (const char *s1, const char s2[4])
bool cmp_str5 (const char *s1, const char s2[6])
bool cmp_str5n (const char *s1, const char s2[5])
bool cmp_str6 (const char *s1, const char s2[7])
bool cmp_str6n (const char *s1, const char s2[6])
bool cmp_str7 (const char *s1, const char s2[8])
bool cmp_str7n (const char *s1, const char s2[8])
bool cmp_str8 (const char *s1, const char s2[9])
bool cmp_str8n (const char *s1, const char s2[9])
bool cmp_str9 (const char *s1, const char s2[10])
bool cmp_str10 (const char *s1, const char s2[11])
bool cmp_str11 (const char *s1, const char s2[12])
bool cmp_str12 (const char *s1, const char s2[13])
bool cmp_str13 (const char *s1, const char s2[14])
bool cmp_str14 (const char *s1, const char s2[14])
bool cmp_str15 (const char *s1, const char s2[16])
bool cmp_str16 (const char *s1, const char s2[17])
const std::string strerror (int error)
 Convert C error number to string.
std::ostream & operator<< (std::ostream &s, const oks::exception &ex)
void throw_validate_not_empty (const char *name)
void validate_not_empty (const std::string &value, const char *name)
std::ostream & operator<< (std::ostream &, const OksFile &)
std::ostream & operator<< (std::ostream &, const oks::Comment &)
double get_time_interval (const timeval *t1, const timeval *t2)
std::ostream & log_timestamp (__LogSeverity__ severity=Log)
bool operator== (const OksString &s1, const OksString &s2)
 Implementation of OksString logical equality operator.
bool operator== (const OksString &s1, const std::string &s2)
 Implementation of OksString logical equality operator.
bool operator== (const OksString &s1, const char *s2)
 Implementation of OksString logical equality operator.
bool operator< (const OksString &s1, const OksString &s2)
 Implementation of OksString logical less operator.
std::ostream & operator<< (std::ostream &s, const OksString &str)
 Implementation of OksString out stream operator.
std::ostream & operator<< (std::ostream &, const oks::QueryPathExpression &)
std::ostream & operator<< (std::ostream &, const oks::QueryPath &)
void validate_init2range (const OksAttribute *a)
std::ostream & operator<< (std::ostream &s, const OksAttribute &a)
bool is_star (const std::string &s)
std::ostream & operator<< (std::ostream &s, const OksClass &c)
static void check_and_report_empty_parameter (const char *fname, bool b1, bool b2)
static void check_and_report_found_items (const char *fname, const char *item_type, const std::string &item1_name, const std::string &item2_name, const std::string &class_name, bool b1, bool b2)
static std::string add_super_class_error (const std::string &c1, const std::string &c2)
static std::string remove_super_class_error (const std::string &c1, const std::string &c2)
void add_if_not_found (OksClass::FList &clist, OksClass *c)
const char * bool2value_type (bool v)
bool are_types_different (const OksAttribute *a1, const OksAttribute *a2)
const char * card2string (OksRelationship::CardinalityConstraint cc)
static bool is_not_info (const std::string &line)
 ERS_DECLARE_ISSUE (kernel, SetGroupIdFailed, "cannot set group ID "<< id<< " for the file \'"<< file<< "\': chown() failed with code "<< code<< " , reason = \'"<< why<< '\'',((long) id)((const char *) file)((int) code)((std::string) why)) ERS_DECLARE_ISSUE(kernel
Found unresolved reference (s)
static long get_file_length (std::ifstream &f)
std::string make_fname (const char *f, size_t f_len, const std::string &file, bool *p, const OksFile *const *fh)
std::ostream & operator<< (std::ostream &s, OksKernel &k)
static void test_file_existence (const std::string &file_name, bool silence, const std::string &fname, const char *msg)
std::string mk_name_and_test (const std::string &name, const char *test, size_t test_len)
static void create_updated_lists (const OksFile::Map &files, std::list< OksFile * > **ufs, std::list< OksFile * > **rfs, OksFile::FileStatus wu, OksFile::FileStatus wr)
static bool _find_file (const OksFile::Map &files, const OksFile *f)
static bool check_relevant (const std::set< std::string > &loaded_files, const OksRepositoryVersion &ver)
static std::string replace_datetime_spaces (const std::string &in)
std::ostream & operator<< (std::ostream &s, const OksMethodImplementation &i)
std::ostream & operator<< (std::ostream &s, const OksMethod &m)
static void __throw_unknown_type (const oks::ReadFileParams &params, const char *atype)
std::ostream & operator<< (std::ostream &s, const OksObject *o)
std::ostream & operator<< (std::ostream &s, const OksObject &o)
static bool trim_dangling (OksData &d, const OksKernel &kernel)
static bool cmp_data (OksData *d, OksData *d2)
static void test_dangling_references (const OksObject *obj, const OksData &d, const OksRelationship &r, std::string &result)
static void _references (const OksObject *obj, unsigned long recursion_depth, RefData &data)
static void insert2refs (const OksObject *o, unsigned long recursion_depth, RefData &data)
boost::posix_time::ptime str2time (const char *value, size_t len, const char *file_name=nullptr)
boost::gregorian::date str2date (const char *value, size_t len)
std::ostream & operator<< (std::ostream &, const Date &)
std::ostream & operator<< (std::ostream &, const Time &)
static void printTableSeparator (std::ostream &s, unsigned char c)
static void printTableLine (std::ostream &s, unsigned char c)
std::ostream & operator<< (std::ostream &s, const OksProfiler &t)
void erase_empty_chars (std::string &s)
std::ostream & operator<< (std::ostream &s, const OksQueryExpression &qe)
std::ostream & operator<< (std::ostream &s, const OksQuery &gqe)
std::ostream & operator<< (std::ostream &s, const OksRelationship &r)
static std::string report_unexpected (const char *what, const char expected, const char read)
static void __throw_runtime_error_unexpected_symbol (const char expected, const char read)
static void __throw_bad_file_data_unexpected_symbol (const char *what, const char expected, const char read, unsigned long l, unsigned long p)
bool __is_comment (const char *s)

Variables

const char _empty_str [] = "empty"
static std::mutex s_get_cwd_mutex
static GitFoldersHolder s_git_folders
 BindError
static const char * OksProfilerFunctionsStr []

Typedef Documentation

◆ ClassSet

Definition at line 1129 of file object.hpp.

Enumeration Type Documentation

◆ __LogSeverity__

Enumerator
Error 
Warning 
Log 
Debug 

Definition at line 416 of file kernel.hpp.

417{
418 Error = 0,
419 Warning,
420 Log,
421 Debug
422};

Function Documentation

◆ __is_comment()

bool dunedaq::oks::__is_comment ( const char * s)
inline

Definition at line 332 of file xml.cpp.

333{
334 return oks::cmp_str4n(s, "<!--");
335}
bool cmp_str4n(const char *s1, const char s2[4])
Definition cstring.hpp:51

◆ __throw_bad_file_data_unexpected_symbol()

void dunedaq::oks::__throw_bad_file_data_unexpected_symbol ( const char * what,
const char expected,
const char read,
unsigned long l,
unsigned long p )
static

Definition at line 110 of file xml.cpp.

115{
116 throw oks::BadFileData(report_unexpected(what, expected, read), l, p);
117}
static std::string report_unexpected(const char *what, const char expected, const char read)
Definition xml.cpp:84

◆ __throw_runtime_error_unexpected_symbol()

void dunedaq::oks::__throw_runtime_error_unexpected_symbol ( const char expected,
const char read )
static

Definition at line 104 of file xml.cpp.

105{
106 throw std::runtime_error(report_unexpected(0, expected, read));
107}

◆ __throw_unknown_type()

void dunedaq::oks::__throw_unknown_type ( const oks::ReadFileParams & params,
const char * atype )
static

Definition at line 522 of file object.cpp.

523{
524 std::ostringstream s;
525 s << "Unknown attribute type \"" << atype << '\"';
526 throw oks::BadFileData(s.str(), params.s.get_line_no(), params.s.get_line_pos());
527}
unsigned long get_line_no() const
Definition xml.hpp:400
unsigned long get_line_pos() const
Definition xml.hpp:401
OksXmlInputStream & s
Definition oks_utils.hpp:55

◆ _find_file()

bool dunedaq::oks::_find_file ( const OksFile::Map & files,
const OksFile * f )
static

Definition at line 2954 of file kernel.cpp.

2955{
2956 for (OksFile::Map::const_iterator i = files.begin(); i != files.end(); ++i) {
2957 if (i->second == f)
2958 return true;
2959 }
2960 return false;
2961}

◆ _references()

void dunedaq::oks::_references ( const OksObject * obj,
unsigned long recursion_depth,
RefData & data )
static

Definition at line 3012 of file object.cpp.

3013{
3014 if (recursion_depth == 0)
3015 return;
3016
3017 size_t l1 = obj->GetClass()->number_of_all_attributes();
3018 size_t l2 = l1 + obj->GetClass()->number_of_all_relationships();
3019
3020 while (l1 < l2) {
3021 OksDataInfo odi(l1, (OksRelationship*)0);
3022 OksData* d(obj->GetRelationshipValue(&odi));
3023
3024 if (d->type == OksData::object_type) {
3025 if (OksObject* o2 = d->data.OBJECT) {
3026 insert2refs(o2, recursion_depth, data);
3027 }
3028 } else if (d->type == OksData::list_type) {
3029 for (OksData::List::const_iterator li = d->data.LIST->begin(); li != d->data.LIST->end(); ++li) {
3030 if ((*li)->type == OksData::object_type) {
3031 if (OksObject* o2 = (*li)->data.OBJECT) {
3032 insert2refs(o2, recursion_depth, data);
3033 }
3034 }
3035 }
3036 }
3037
3038 ++l1;
3039 }
3040}
OksObject describes instance of OksClass.
Definition object.hpp:1144
static void insert2refs(const OksObject *o, unsigned long recursion_depth, RefData &data)
Definition object.cpp:2993
msgpack::object obj
Struct OKS data information.
Definition object.hpp:379
Struct OKS data.
Definition object.hpp:510

◆ add_if_not_found()

void dunedaq::oks::add_if_not_found ( OksClass::FList & clist,
OksClass * c )
inline

Definition at line 1525 of file class.cpp.

1526{
1527 for (OksClass::FList::const_iterator i = clist.begin(); i != clist.end(); ++i) {
1528 if (*i == c)
1529 return;
1530 }
1531 clist.push_back(c);
1532}

◆ add_super_class_error()

std::string dunedaq::oks::add_super_class_error ( const std::string & c1,
const std::string & c2 )
static

Definition at line 824 of file class.cpp.

825{
826 return (std::string("cannot add superclass \"") + c1 + "\" to class \"" + c2 + '\"');
827}

◆ are_types_different()

bool dunedaq::oks::are_types_different ( const OksAttribute * a1,
const OksAttribute * a2 )
inline

Definition at line 1607 of file class.cpp.

1608{
1609 static const std::string __enum_str__("enum");
1610 static const std::string __string_str__("string");
1611
1612 const std::string& s1 = a1->get_type();
1613 const std::string& s2 = a2->get_type();
1614
1615 return (
1616 !((s1 == s2) || ((s1 == __enum_str__ && s2 == __string_str__) || (s1 == __string_str__ && s2 == __enum_str__))));
1617}
const std::string & get_type() const noexcept
Get attribute string type.

◆ bool2value_type()

const char * dunedaq::oks::bool2value_type ( bool v)
inline

Definition at line 1599 of file class.cpp.

1600{
1601 return (v ? "multi-value" : "single-value");
1602}
default char v[0]

◆ card2string()

const char * dunedaq::oks::card2string ( OksRelationship::CardinalityConstraint cc)
inline

Definition at line 1697 of file class.cpp.

1698{
1699 return (cc == OksRelationship::One ? "one object" : "many objects");
1700}

◆ check_and_report_empty_parameter()

void dunedaq::oks::check_and_report_empty_parameter ( const char * fname,
bool b1,
bool b2 )
static

Definition at line 781 of file class.cpp.

782{
783 if (b1) {
784 throw oks::SetOperationFailed(fname, "First parameter is (null)");
785 }
786
787 if (b2) {
788 throw oks::SetOperationFailed(fname, "Second parameter is (null)");
789 }
790}

◆ check_and_report_found_items()

void dunedaq::oks::check_and_report_found_items ( const char * fname,
const char * item_type,
const std::string & item1_name,
const std::string & item2_name,
const std::string & class_name,
bool b1,
bool b2 )
static

Definition at line 795 of file class.cpp.

802{
803 struct
804 {
805 bool b;
806 const std::string* name;
807 } info[] = { { b1, &item1_name }, { b2, &item2_name } };
808
809 for (int i = 0; i < 2; ++i) {
810 if (info[i].b) {
811 std::string text("cannot find direct ");
812 text += item_type;
813 text += " \"";
814 text += *info[i].name;
815 text += "\" in class \"";
816 text += class_name;
817 text += '\"';
818 throw oks::SetOperationFailed(fname, text);
819 }
820 }
821}

◆ check_relevant()

bool dunedaq::oks::check_relevant ( const std::set< std::string > & loaded_files,
const OksRepositoryVersion & ver )
static

Definition at line 5093 of file kernel.cpp.

5094{
5095 for (const auto& x : ver.m_files)
5096 if (loaded_files.find(x) != loaded_files.end())
5097 return true;
5098
5099 return false;
5100}
std::vector< std::string > m_files
Definition kernel.hpp:552

◆ cmp_data()

bool dunedaq::oks::cmp_data ( OksData * d,
OksData * d2 )
static

Definition at line 2197 of file object.cpp.

2198{
2199 if (d->type == OksData::object_type && d2->type == OksData::object_type)
2200 return ((d2->data.OBJECT == d->data.OBJECT) ? true : false);
2201
2202 const std::string& object_id = d->type == OksData::object_type ? d->data.OBJECT->GetId()
2203 : d->type == OksData::uid2_type ? *(static_cast<std::string*>(d->data.UID2.object_id))
2204 : *(static_cast<std::string*>(d->data.UID.object_id));
2205
2206 const std::string& object_id2 = d2->type == OksData::object_type ? d2->data.OBJECT->GetId()
2207 : d2->type == OksData::uid2_type
2208 ? *(static_cast<std::string*>(d2->data.UID2.object_id))
2209 : *(static_cast<std::string*>(d2->data.UID.object_id));
2210
2211 if (object_id != object_id2)
2212 return false;
2213
2214 const OksClass* pclass_id = d->type == OksData::object_type ? d->data.OBJECT->GetClass()
2215 : d->type == OksData::uid_type ? d->data.UID.class_id
2216 : 0;
2217
2218 const OksClass* pclass_id2 = d2->type == OksData::object_type ? d2->data.OBJECT->GetClass()
2219 : d2->type == OksData::uid_type ? d2->data.UID.class_id
2220 : 0;
2221
2222 if (pclass_id && pclass_id2)
2223 return (pclass_id == pclass_id2 ? true : false);
2224
2225 const std::string& class_id =
2226 (pclass_id ? pclass_id->get_name() : *(static_cast<std::string*>(d->data.UID2.class_id)));
2227
2228 const std::string& class_id2 =
2229 (pclass_id2 ? pclass_id2->get_name() : *(static_cast<std::string*>(d2->data.UID2.class_id)));
2230
2231 return (class_id == class_id2 ? true : false);
2232}
The OKS class.
Definition class.hpp:223
const std::string & get_name() const noexcept
Definition class.hpp:374
const OksClass * GetClass() const
Definition object.hpp:1286
const std::string & GetId() const
Definition object.hpp:1290
union dunedaq::oks::OksData::Data data
enum dunedaq::oks::OksData::Type type
struct dunedaq::oks::OksData::Data::@266171337063116272021017117226020166361213322350 UID
struct dunedaq::oks::OksData::Data::@226266061051241020017305361066131172152317024337 UID2

◆ cmp_str1()

bool dunedaq::oks::cmp_str1 ( const char * s1,
const char s2[2] )
inline

Definition at line 15 of file cstring.hpp.

16{
17 return (*(const int16_t*)s1 == *(const int16_t*)s2);
18}

◆ cmp_str10()

bool dunedaq::oks::cmp_str10 ( const char * s1,
const char s2[11] )
inline

Definition at line 111 of file cstring.hpp.

112{
113 return cmp_str7(s1, s2) && cmp_str2(s1 + 8, s2 + 8);
114}
bool cmp_str2(const char *s1, const char s2[3])
Definition cstring.hpp:21
bool cmp_str7(const char *s1, const char s2[8])
Definition cstring.hpp:81

◆ cmp_str11()

bool dunedaq::oks::cmp_str11 ( const char * s1,
const char s2[12] )
inline

Definition at line 117 of file cstring.hpp.

118{
119 return cmp_str7(s1, s2) && cmp_str3(s1 + 8, s2 + 8);
120}
bool cmp_str3(const char *s1, const char s2[4])
Definition cstring.hpp:33

◆ cmp_str12()

bool dunedaq::oks::cmp_str12 ( const char * s1,
const char s2[13] )
inline

Definition at line 123 of file cstring.hpp.

124{
125 return cmp_str7(s1, s2) && cmp_str4(s1 + 8, s2 + 8);
126}
bool cmp_str4(const char *s1, const char s2[5])
Definition cstring.hpp:45

◆ cmp_str13()

bool dunedaq::oks::cmp_str13 ( const char * s1,
const char s2[14] )
inline

Definition at line 129 of file cstring.hpp.

130{
131 return cmp_str7(s1, s2) && cmp_str5(s1 + 8, s2 + 8);
132}
bool cmp_str5(const char *s1, const char s2[6])
Definition cstring.hpp:57

◆ cmp_str14()

bool dunedaq::oks::cmp_str14 ( const char * s1,
const char s2[14] )
inline

Definition at line 135 of file cstring.hpp.

136{
137 return cmp_str7(s1, s2) && cmp_str6(s1 + 8, s2 + 8);
138}
bool cmp_str6(const char *s1, const char s2[7])
Definition cstring.hpp:69

◆ cmp_str15()

bool dunedaq::oks::cmp_str15 ( const char * s1,
const char s2[16] )
inline

Definition at line 141 of file cstring.hpp.

142{
143 return cmp_str7(s1, s2) && cmp_str7(s1 + 8, s2 + 8);
144}

◆ cmp_str16()

bool dunedaq::oks::cmp_str16 ( const char * s1,
const char s2[17] )
inline

Definition at line 147 of file cstring.hpp.

148{
149 return cmp_str7(s1, s2) && cmp_str7(s1 + 8, s2 + 8) && (s1[16] == 0);
150}

◆ cmp_str2()

bool dunedaq::oks::cmp_str2 ( const char * s1,
const char s2[3] )
inline

Definition at line 21 of file cstring.hpp.

22{
23 return cmp_str1(s1, s2) && (s1[2] == 0);
24}
bool cmp_str1(const char *s1, const char s2[2])
Definition cstring.hpp:15

◆ cmp_str2n()

bool dunedaq::oks::cmp_str2n ( const char * s1,
const char s2[2] )
inline

Definition at line 27 of file cstring.hpp.

28{
29 return cmp_str1(s1, s2);
30}

◆ cmp_str3()

bool dunedaq::oks::cmp_str3 ( const char * s1,
const char s2[4] )
inline

Definition at line 33 of file cstring.hpp.

34{
35 return (*(const int32_t*)s1 == *(const int32_t*)s2);
36}

◆ cmp_str3n()

bool dunedaq::oks::cmp_str3n ( const char * s1,
const char s2[3] )
inline

Definition at line 39 of file cstring.hpp.

40{
41 return (s1[0] == s2[0]) && cmp_str1(s1 + 1, s2 + 1);
42}

◆ cmp_str4()

bool dunedaq::oks::cmp_str4 ( const char * s1,
const char s2[5] )
inline

Definition at line 45 of file cstring.hpp.

46{
47 return (s1[0] == s2[0]) && cmp_str3(s1 + 1, s2 + 1);
48}

◆ cmp_str4n()

bool dunedaq::oks::cmp_str4n ( const char * s1,
const char s2[4] )
inline

Definition at line 51 of file cstring.hpp.

52{
53 return cmp_str3(s1, s2);
54}

◆ cmp_str5()

bool dunedaq::oks::cmp_str5 ( const char * s1,
const char s2[6] )
inline

Definition at line 57 of file cstring.hpp.

58{
59 return cmp_str1(s1, s2) && cmp_str3(s1 + 2, s2 + 2);
60}

◆ cmp_str5n()

bool dunedaq::oks::cmp_str5n ( const char * s1,
const char s2[5] )
inline

Definition at line 63 of file cstring.hpp.

64{
65 return cmp_str3(s1, s2) && (s1[4] == s2[4]);
66}

◆ cmp_str6()

bool dunedaq::oks::cmp_str6 ( const char * s1,
const char s2[7] )
inline

Definition at line 69 of file cstring.hpp.

70{
71 return cmp_str3(s1, s2) && cmp_str2(s1 + 4, s2 + 4);
72}

◆ cmp_str6n()

bool dunedaq::oks::cmp_str6n ( const char * s1,
const char s2[6] )
inline

Definition at line 75 of file cstring.hpp.

76{
77 return cmp_str3(s1, s2) && cmp_str1(s1 + 4, s2 + 4);
78}

◆ cmp_str7()

bool dunedaq::oks::cmp_str7 ( const char * s1,
const char s2[8] )
inline

Definition at line 81 of file cstring.hpp.

82{
83 return (*(const int64_t*)s1 == *(const int64_t*)s2);
84}

◆ cmp_str7n()

bool dunedaq::oks::cmp_str7n ( const char * s1,
const char s2[8] )
inline

Definition at line 87 of file cstring.hpp.

88{
89 return (cmp_str3(s1, s2) && cmp_str3n(s1 + 4, s2 + 4));
90}
bool cmp_str3n(const char *s1, const char s2[3])
Definition cstring.hpp:39

◆ cmp_str8()

bool dunedaq::oks::cmp_str8 ( const char * s1,
const char s2[9] )
inline

Definition at line 93 of file cstring.hpp.

94{
95 return cmp_str7(s1, s2) && (s1[8] == 0);
96}

◆ cmp_str8n()

bool dunedaq::oks::cmp_str8n ( const char * s1,
const char s2[9] )
inline

Definition at line 99 of file cstring.hpp.

100{
101 return (*(const int64_t*)s1 == *(const int64_t*)s2);
102}

◆ cmp_str9()

bool dunedaq::oks::cmp_str9 ( const char * s1,
const char s2[10] )
inline

Definition at line 105 of file cstring.hpp.

106{
107 return cmp_str1(s1, s2) && cmp_str7(s1 + 2, s2 + 2);
108}

◆ create_updated_lists()

void dunedaq::oks::create_updated_lists ( const OksFile::Map & files,
std::list< OksFile * > ** ufs,
std::list< OksFile * > ** rfs,
OksFile::FileStatus wu,
OksFile::FileStatus wr )
static

Definition at line 2774 of file kernel.cpp.

2779{
2780 *ufs = 0; // updated files
2781 *rfs = 0; // removed files
2782
2783 for (OksFile::Map::const_iterator i = files.begin(); i != files.end(); ++i) {
2784 OksFile::FileStatus fs = i->second->get_status_of_file();
2785
2786 if (fs == wu /* i.e. Which Updated */) {
2787 if (*ufs == 0) {
2788 *ufs = new std::list<OksFile*>();
2789 }
2790 (*ufs)->push_back(i->second);
2791 } else if (fs == wr /* i.e. Which Removed */) {
2792 if (*rfs == 0) {
2793 *rfs = new std::list<OksFile*>();
2794 }
2795 (*rfs)->push_back(i->second);
2796 }
2797 }
2798}

◆ erase_empty_chars()

void dunedaq::oks::erase_empty_chars ( std::string & s)
inline

Definition at line 110 of file query.cpp.

111{
112 while (s[0] == ' ' || s[0] == '\n' || s[0] == '\t')
113 s.erase(0, 1);
114}

◆ ERS_DECLARE_ISSUE()

dunedaq::oks::ERS_DECLARE_ISSUE ( kernel ,
SetGroupIdFailed ,
"cannot set group ID "<< id<< " for the file \'"<< file<< "\': chown() failed with code "<< code<< "  )

◆ get_file_length()

long dunedaq::oks::get_file_length ( std::ifstream & f)
static

Definition at line 446 of file kernel.cpp.

447{
448 long file_length = 0;
449
450 // get size of file and check that it is not empty
451
452 f.seekg(0, std::ios::end);
453
454#if __GNUC__ >= 3
455 file_length = static_cast<std::streamoff>(f.tellg());
456#else
457 file_length = f.tellg();
458#endif
459
460 f.seekg(0, std::ios::beg);
461
462 return file_length;
463}

◆ get_time_interval()

double dunedaq::oks::get_time_interval ( const timeval * t1,
const timeval * t2 )

◆ insert2refs()

void dunedaq::oks::insert2refs ( const OksObject * o,
unsigned long recursion_depth,
RefData & data )
static

Definition at line 2993 of file object.cpp.

2994{
2995 recursion_depth--;
2996
2997 std::pair<OksObject::FSet::iterator, bool> ret = data.tested_objs.insert(const_cast<OksObject*>(o));
2998
2999 if (ret.second == true) {
3000 if (data.classes == nullptr || data.classes->find(const_cast<OksClass*>(o->GetClass())) != data.classes->end()) {
3001 data.refs.insert(const_cast<OksObject*>(o));
3002 }
3003 o->SetTransientData((void*)recursion_depth);
3004 _references(o, recursion_depth, data);
3005 } else if (o->GetTransientData() < (void*)recursion_depth) {
3006 o->SetTransientData((void*)recursion_depth);
3007 _references(o, recursion_depth, data);
3008 }
3009}
void * GetTransientData() const
Get transient user data associated with given object. Return data set using SetTransientData() method...
Definition object.hpp:1621
void SetTransientData(void *d) const
Set transient user data associated with given object. Such data are not stored on file and only exist...
Definition object.hpp:1614
static void _references(const OksObject *obj, unsigned long recursion_depth, RefData &data)
Definition object.cpp:3012

◆ is_not_info()

bool dunedaq::oks::is_not_info ( const std::string & line)
static

Definition at line 1480 of file file.cpp.

1481{
1482 static const char start_tag[] = "<info ";
1483 static const char last_tag[] =
1484 "last-modification-time=\"yyyymmddThhmmss\"/>"; // 24 - is a position of first double quote
1485
1486 const std::string::size_type len = line.length();
1487
1488 return ((len < (sizeof(start_tag) + sizeof(last_tag))) ||
1489 (line.compare(0, sizeof(start_tag) - 1, start_tag, sizeof(start_tag) - 1) != 0) ||
1490 (line.compare(len - sizeof(last_tag) + 1, 24, last_tag, 24) != 0));
1491}

◆ is_star()

bool dunedaq::oks::is_star ( const std::string & s)
inline

Definition at line 750 of file attribute.cpp.

751{
752 return (s.size() == 1 && s[0] == '*');
753}

◆ log_timestamp()

std::ostream & dunedaq::oks::log_timestamp ( __LogSeverity__ severity = Log)

Definition at line 5470 of file kernel.cpp.

5471{
5472 auto now(std::chrono::system_clock::now());
5473 auto time_since_epoch(now.time_since_epoch());
5474 auto seconds_since_epoch(std::chrono::duration_cast<std::chrono::seconds>(time_since_epoch));
5475
5476 std::time_t now_t(std::chrono::system_clock::to_time_t(std::chrono::system_clock::time_point(seconds_since_epoch)));
5477
5478 char buff[128];
5479 std::size_t len = std::strftime(buff, 128 - 16, "%Y-%b-%d %H:%M:%S.", std::localtime(&now_t));
5480 sprintf(buff + len,
5481 "%03d ",
5482 (int)(std::chrono::duration_cast<std::chrono::milliseconds>(time_since_epoch).count() -
5483 seconds_since_epoch.count() * 1000));
5484
5485 std::ostream& s(severity <= Warning ? std::cerr : std::cout);
5486
5487 s << buff << (severity == Error ? "ERROR " : severity == Warning ? "WARNING " : severity == Debug ? "DEBUG " : "");
5488
5489 return s;
5490}

◆ make_fname()

std::string dunedaq::oks::make_fname ( const char * f,
size_t f_len,
const std::string & file,
bool * p,
const OksFile *const * fh )

Definition at line 468 of file kernel.cpp.

469{
470 const char _prefix[] = "OksKernel::";
471 std::string fname(_prefix, (sizeof(_prefix) - 1));
472
473 fname.append(f, f_len);
474
475 const char _x1[] = "(file \'";
476 fname.append(_x1, (sizeof(_x1) - 1));
477 fname.append(file);
478 fname.push_back('\'');
479
480 // add boolean parameter
481
482 if (p) {
483 if (*p) {
484 const char _true_str[] = ", true";
485 fname.append(_true_str, (sizeof(_true_str) - 1));
486 } else {
487 const char _false_str[] = ", false";
488 fname.append(_false_str, (sizeof(_false_str) - 1));
489 }
490 }
491
492 // add file handler parameter
493
494 if (fh && *fh) {
495 const char _x2[] = ", included by file \'";
496 fname.append(_x2, (sizeof(_x2) - 1));
497 fname.append((*fh)->get_full_file_name());
498 fname.push_back('\'');
499 }
500
501 fname.push_back(')');
502
503 return fname;
504}

◆ mk_name_and_test()

std::string dunedaq::oks::mk_name_and_test ( const std::string & name,
const char * test,
size_t test_len )
inline

Definition at line 1492 of file kernel.cpp.

1493{
1494 const char _s1_str[] = " - \'";
1495 const char _s2_str[] = "\' tested as ";
1496
1497 return ((std::string(_s1_str, sizeof(_s1_str) - 1) + name).append(_s2_str, sizeof(_s2_str) - 1))
1498 .append(test, test_len);
1499}

◆ operator<()

bool dunedaq::oks::operator< ( const OksString & s1,
const OksString & s2 )
inline

Implementation of OksString logical less operator.

Definition at line 476 of file object.hpp.

478{
479 return (*(static_cast<const std::string*>(&s1)) < *(static_cast<const std::string*>(&s2)));
480}

◆ operator<<() [1/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const Date & d )

Definition at line 162 of file time.cpp.

164{
165 std::string str = d.str();
166 s << str;
167 return s;
168}

◆ operator<<() [2/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const oks::Comment & c )

Definition at line 1269 of file file.cpp.

1271{
1272 s << "user \"" << c.get_created_by() << "\" (" << c.get_author() << ")"
1273 << " on \"" << c.get_created_on() << "\" wrote: \"" << c.get_text() << "\"";
1274
1275 return s;
1276}

◆ operator<<() [3/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const oks::QueryPath & query )

Definition at line 896 of file query.cpp.

898{
899 s << '(' << OksQuery::PATH_TO << ' ' << query.get_goal_object() << ' ' << *query.get_start_expression() << ')';
900 return s;
901}
static const char * PATH_TO
Definition query.hpp:83
const OksObject * get_goal_object() const
Definition query.hpp:382
const QueryPathExpression * get_start_expression() const
Definition query.hpp:381

◆ operator<<() [4/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const oks::QueryPathExpression & e )

Definition at line 903 of file query.cpp.

905{
906 s << '(' << (e.get_use_nested_lookup() ? OksQuery::NESTED : OksQuery::DIRECT) << ' ';
907
908 for (std::list<std::string>::const_iterator i = e.get_rel_names().begin(); i != e.get_rel_names().end(); ++i) {
909 if (i != e.get_rel_names().begin())
910 s << ' ';
911 s << '\"' << *i << '\"';
912 }
913
914 if (e.get_next())
915 s << ' ' << *(e.get_next());
916
917 s << ')';
918
919 return s;
920}
static const char * NESTED
Definition query.hpp:85
static const char * DIRECT
Definition query.hpp:84
const QueryPathExpression * get_next() const
Definition query.hpp:332
const std::list< std::string > & get_rel_names() const
Definition query.hpp:331

◆ operator<<() [5/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const OksFile & f )

Definition at line 1278 of file file.cpp.

1280{
1281 s << "OKS file\n"
1282 " short file name: \'"
1283 << f.get_short_file_name()
1284 << "\'\n"
1285 " full file name: \'"
1286 << f.get_full_file_name()
1287 << "\'\n"
1288 " lock file name: \'"
1289 << f.get_lock_file()
1290 << "\'\n"
1291 " logical name: \'"
1292 << f.get_logical_name()
1293 << "\'\n"
1294 " type: \'"
1295 << f.get_type()
1296 << "\'\n"
1297 " oks format: \'"
1298 << f.get_oks_format()
1299 << "\'\n"
1300 " number of items: "
1301 << f.get_number_of_items()
1302 << "\n"
1303 " created by: "
1304 << f.get_created_by()
1305 << "\n"
1306 " creation time: "
1307 << boost::posix_time::to_simple_string(f.get_creation_time())
1308 << "\n"
1309 " created on: "
1310 << f.get_created_on()
1311 << "\n"
1312 " last modified by: \'"
1313 << f.get_last_modified_by()
1314 << "\'\n"
1315 " last modification time: "
1316 << boost::posix_time::to_simple_string(f.get_last_modification_time())
1317 << "\'\n"
1318 " last modified on: "
1319 << f.get_last_modified_on()
1320 << "\'\n"
1321 " is "
1322 << (f.is_read_only() ? "read-only" : "read-write")
1323 << "\n"
1324 " is "
1325 << (f.is_locked() ? "" : "not ")
1326 << "locked\n"
1327 " is "
1328 << (f.is_updated() ? "" : "not ") << "updated\n";
1329
1330 {
1331 size_t num_of_includes = f.get_include_files().size();
1332
1333 if (num_of_includes) {
1334 s << " contains " << num_of_includes << " include file(s)";
1335 for (const auto& i : f.get_include_files())
1336 s << " - \'" << i << "\'\n";
1337 } else {
1338 s << " contains no include files\n";
1339 }
1340 }
1341
1342 {
1343 size_t num_of_comments = f.get_comments().size();
1344
1345 if (num_of_comments) {
1346 s << " contains " << num_of_comments << " comment(s)";
1347 for (const auto& i : f.get_comments())
1348 s << " - " << boost::posix_time::to_simple_string(boost::posix_time::from_iso_string(i.first)) << ": \'"
1349 << *i.second << "\'\n";
1350 } else {
1351 s << " contains no comments\n";
1352 }
1353 }
1354
1355 s << "END of oks file\n";
1356
1357 return s;
1358}

◆ operator<<() [6/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const Time & t )

Definition at line 170 of file time.cpp.

172{
173 std::string str = t.str();
174 s << str;
175 return s;
176}
virtual std::string str() const
Definition time.cpp:150

◆ operator<<() [7/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const oks::exception & ex )
inline

Definition at line 39 of file exceptions.hpp.

41{
42 s << ex.what();
43 return s;
44}
virtual const char * what() const noexcept

◆ operator<<() [8/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const OksAttribute & a )

Definition at line 235 of file attribute.cpp.

237{
238 s << "Attribute name: \"" << a.p_name
239 << "\"\n"
240 " type: \""
241 << a.get_type()
242 << "\"\n"
243 " range: \""
244 << a.p_range << "\"\n";
245
246 if (a.is_integer()) {
247 s << " format: \"" << OksAttribute::format2str(a.p_format) << "\"\n";
248 }
249
250 if (a.p_multi_values == true) {
251 s << " is \'multi values\'\n";
252 } else {
253 s << " is \'single value\'\n";
254 }
255
256 s << " initial value: \"" << a.p_init_value
257 << "\"\n"
258 " has description: \""
259 << a.p_description << "\"\n"
260 << (a.p_no_null == true ? " can not be null\n" : " can be null\n") << " is "
261 << (a.p_ordered == true ? "ordered" : "unordered") << std::endl;
262
263 return s;
264}
static const char * format2str(Format) noexcept
Definition attribute.cpp:61
bool is_integer() const noexcept
Definition attribute.cpp:67

◆ operator<<() [9/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const OksClass & c )

Send to stream complete description of OKS class:

  • print class name
  • print details of attributes, relationships and methods
  • print details of objects

Definition at line 380 of file class.cpp.

382{
384
385 s << "Class name: \"" << c.p_name
386 << "\"\n"
387 " has description: \""
388 << c.p_description << "\"\n"
389 << (c.p_abstract == true ? " is abstract\n" : " is not abstract\n");
390
391 if (c.p_super_classes) {
392 s << "The class has superclasses:\n";
393 for (std::list<std::string*>::const_iterator i = c.p_super_classes->begin(); i != c.p_super_classes->end(); ++i) {
394 s << " - " << *(*i) << std::endl;
395 }
396 } else
397 s << "The class has no superclasses\n";
398
399 if (c.p_attributes) {
400 s << "The attributes are:\n";
401 for (std::list<OksAttribute*>::const_iterator i = c.p_attributes->begin(); i != c.p_attributes->end(); ++i) {
402 s << *(*i);
403 }
404 } else
405 s << "There are no attributes\n";
406
407 if (c.p_relationships) {
408 s << "The relationships are:\n";
409 for (std::list<OksRelationship*>::const_iterator i = c.p_relationships->begin(); i != c.p_relationships->end();
410 ++i) {
411 s << *(*i);
412 }
413 } else
414 s << "There are no relationships\n";
415
416 if (c.p_methods) {
417 s << "The methods are:\n";
418 for (std::list<OksMethod*>::const_iterator i = c.p_methods->begin(); i != c.p_methods->end(); ++i) {
419 s << *(*i);
420 }
421 } else
422 s << "There are no methods\n";
423
424 if (c.p_objects) {
425 OksObject::SMap sorted;
426
427 s << "The objects are:\n";
428
429 for (OksObject::Map::iterator i = c.p_objects->begin(); i != c.p_objects->end(); ++i) {
430 sorted[i->first] = i->second;
431 }
432
433 for (OksObject::SMap::iterator i = sorted.begin(); i != sorted.end(); ++i) {
434 s << *(i->second);
435 }
436 } else
437 s << "There are no objects\n";
438
439 s << "End of Class \"" << c.p_name << "\"\n";
440
441 return s;
442}
std::map< const std::string *, OksObject *, SortById > SMap
Definition object.hpp:1166
#define OSK_PROFILING(FID, K)
Definition defs.hpp:96

◆ operator<<() [10/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const OksMethod & m )

Definition at line 191 of file method.cpp.

193{
194 s << "Method name: \"" << m.p_name
195 << "\"\n"
196 " description: \""
197 << m.p_description << "\"\n";
198
199 if (m.p_implementations) {
200 s << " implementations:\n";
201
202 for (std::list<OksMethodImplementation*>::const_iterator i = m.p_implementations->begin();
203 i != m.p_implementations->end();
204 ++i)
205 s << *(*i);
206 } else
207 s << " there are no implementation(s)\n";
208
209 return s;
210}

◆ operator<<() [11/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const OksMethodImplementation & i )

Definition at line 47 of file method.cpp.

49{
50 s << " Method implementation:\n"
51 " language: \""
52 << i.get_language()
53 << "\"\n"
54 " prototype: \""
55 << i.get_prototype()
56 << "\"\n"
57 " body: \""
58 << i.get_body() << "\"\n";
59
60 return s;
61}
const std::string & get_body() const noexcept
Definition method.hpp:101
const std::string & get_language() const noexcept
Definition method.hpp:69
const std::string & get_prototype() const noexcept
Definition method.hpp:86

◆ operator<<() [12/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const OksObject & o )

Send to stream complete description of OKS object:

  • print class name and ID
  • print value of all attributes and relationships

Definition at line 1624 of file object.cpp.

1626{
1628
1629 const OksClass* c = o.uid.class_id;
1630
1631 s << "Object " << &o << std::endl;
1632
1633 OksData* di = o.data;
1634
1635 // print attributes
1636
1637 {
1638 const std::list<OksAttribute*>* alist = c->all_attributes();
1639
1640 if (alist && !alist->empty()) {
1641 s << " Attributes are:\n";
1642
1643 for (std::list<OksAttribute*>::const_iterator i = alist->begin(); i != alist->end(); ++i) {
1644 if ((*i)->is_integer() && (*i)->get_format() != OksAttribute::Dec) {
1645 s.setf(((*i)->get_format() == OksAttribute::Hex ? std::ios::hex : std::ios::oct), std::ios::basefield);
1646 s.setf(std::ios::showbase);
1647 }
1648
1649 s << " " << (*i)->get_name() << ": " << *di++ << std::endl;
1650
1651 if ((*i)->is_integer() && (*i)->get_format() != OksAttribute::Dec) {
1652 s.setf(std::ios::dec, std::ios::basefield);
1653 s.unsetf(std::ios::showbase);
1654 }
1655 }
1656 } else
1657 s << " There are no attributes\n";
1658 }
1659
1660 // print relationships
1661
1662 {
1663 const std::list<OksRelationship*>* rlist = c->all_relationships();
1664
1665 if (rlist && !rlist->empty()) {
1666 s << " Relationships are:\n";
1667
1668 for (std::list<OksRelationship*>::const_iterator i = rlist->begin(); i != rlist->end(); ++i)
1669 s << " " << (*i)->get_name() << ": " << *di++ << std::endl;
1670 } else
1671 s << " There are no relationships\n";
1672 }
1673
1674 return s;
1675}
OksKernel * p_kernel
Definition class.hpp:900
struct dunedaq::oks::OksObject::OksUid uid

◆ operator<<() [13/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const OksObject * o )

Send to stream OKS object reference in format "foo@bar" (i.e. object "foo" from class "bar")

Definition at line 1609 of file object.cpp.

1611{
1612 s << '\"';
1613
1614 if (o)
1615 s << o->GetId() << '@' << o->GetClass()->get_name();
1616 else
1617 s << "(null-obj)";
1618
1619 s << '\"';
1620
1621 return s;
1622}

◆ operator<<() [14/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const OksProfiler & t )

Definition at line 92 of file profiler.cpp.

94{
95 const int p = s.precision(4);
96
97 printTableLine(s, '=');
98
99 s << '|';
100 s.fill(' ');
101 s.width(76);
102 s.setf(std::ios::left, std::ios::adjustfield);
103 s << " O K S P R O F I L E R " << '|' << std::endl;
104
105 printTableLine(s, '-');
106
107 s << "| Time: ";
108 s.setf(std::ios::right, std::ios::adjustfield);
109 s << std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - t.p_start_time_point)
110 .count() /
111 1000.;
112 s.fill(' ');
113 s.width(64);
114 s.setf(std::ios::left, std::ios::adjustfield);
115 s << " seconds" << '|' << std::endl;
116
117 printTableSeparator(s, '-');
118
119 s.fill(' ');
120 s.width(42);
121 s << "| Function name" << '|';
122 s.width(12);
123 s << " # of calls" << '|';
124 s.width(10);
125 s << " total T," << '|';
126 s.width(10);
127 s << " ~T/call," << '|' << std::endl;
128
129 s.fill(' ');
130 s.width(42);
131 s << '|' << "" << '|';
132 s.width(12);
133 s << "" << '|';
134 s.width(10);
135 s << " ms" << '|';
136 s.width(10);
137 s << " µs" << '|' << std::endl;
138
139 for (short i = 0; i <= (short)OksProfiler::QueryOperatorFrom; i++) {
140 if (i == 0 || i == 12 || i == 21 || i == 32)
141 printTableSeparator(s, '-');
142
143 s << "| ";
144
145 s.width(40);
146 s.fill(' ');
147 s.setf(std::ios::left, std::ios::adjustfield);
148 s << OksProfilerFunctionsStr[i] << '|';
149
150 s.width(11);
151 s.setf(std::ios::right, std::ios::adjustfield);
152 s << t.c_total[i] << ' ' << '|';
153
154 if (t.c_total[i]) {
155 s.width(9);
156 s << t.t_total[i] / 1000. << ' ' << '|';
157
158 s.width(9);
159 s << t.t_total[i] / (double)t.c_total[i];
160 } else {
161 s.width(10);
162 s << " - " << '|';
163
164 s.width(9);
165 s << " -";
166 }
167
168 s << " |\n";
169 }
170
171 printTableSeparator(s, '=');
172
173 s.precision(p);
174
175 return s;
176}
unsigned long c_total[(unsigned) OksProfiler::QueryOperatorFrom+1]
Definition profiler.hpp:74
std::chrono::time_point< std::chrono::steady_clock > p_start_time_point
Definition profiler.hpp:71
double t_total[(unsigned) OksProfiler::QueryOperatorFrom+1]
Definition profiler.hpp:73
static const char * OksProfilerFunctionsStr[]
Definition profiler.cpp:14
static void printTableSeparator(std::ostream &s, unsigned char c)
Definition profiler.cpp:69
static void printTableLine(std::ostream &s, unsigned char c)
Definition profiler.cpp:84

◆ operator<<() [15/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const OksQuery & gqe )

Definition at line 881 of file query.cpp.

883{
885
886 if (gqe.p_expression)
887 s << *gqe.p_expression;
888 else
889 s << "(null)";
890
891 s << ')';
892
893 return s;
894}
static const char * ALL_SUBCLASSES
Definition query.hpp:74
static const char * THIS_CLASS
Definition query.hpp:73
OksQueryExpression * p_expression
Definition query.hpp:99

◆ operator<<() [16/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const OksQueryExpression & qe )

Definition at line 760 of file query.cpp.

762{
763 s << '(';
764
765 switch (qe.type()) {
767 OksComparator* cmpr = (OksComparator*)&qe;
768 const OksAttribute* a = cmpr->GetAttribute();
769 OksData* v = cmpr->GetValue();
771
772 if (a) {
773 s << '\"' << a->get_name() << "\" ";
774 } else if (v) {
775 s << OksQuery::OID << ' ';
776 } else {
777 s << "(null) ";
778 }
779
780 if (v) {
781 s << *v << ' ';
782 } else {
783 s << "(null) ";
784 }
785
786 if (f) {
787 if (f == OksQuery::equal_cmp)
788 s << OksQuery::EQ;
789 else if (f == OksQuery::not_equal_cmp)
790 s << OksQuery::NE;
791 else if (f == OksQuery::reg_exp_cmp)
792 s << OksQuery::RE;
793 else if (f == OksQuery::less_or_equal_cmp)
794 s << OksQuery::LE;
795 else if (f == OksQuery::greater_or_equal_cmp)
796 s << OksQuery::GE;
797 else if (f == OksQuery::less_cmp)
798 s << OksQuery::LS;
799 else if (f == OksQuery::greater_cmp)
800 s << OksQuery::GT;
801 } else
802 s << "(null)";
803
804 break;
805 }
806
809 const OksRelationship* r = re->GetRelationship();
810 bool b = re->IsCheckAllObjects();
811 OksQueryExpression* rqe = re->get();
812
813 if (r)
814 s << '\"' << r->get_name() << "\" ";
815 else
816 s << "(null) ";
817
818 s << (b == true ? OksQuery::ALL_SUBCLASSES : OksQuery::SOME) << ' ';
819
820 if (rqe)
821 s << *rqe;
822 else
823 s << "(null)";
824
825 break;
826 }
827
829 s << OksQuery::NOT << ' ' << *(((OksNotExpression*)&qe)->get());
830
831 break;
832
833 case OksQuery::and_type: {
834 s << OksQuery::AND << ' ';
835
836 const std::list<OksQueryExpression*>& elist = ((OksAndExpression*)&qe)->expressions();
837
838 if (!elist.empty()) {
839 const OksQueryExpression* last = elist.back();
840
841 for (std::list<OksQueryExpression*>::const_iterator i = elist.begin(); i != elist.end(); ++i) {
842 s << *(*i);
843 if (*i != last)
844 s << ' ';
845 }
846 }
847
848 break;
849 }
850
851 case OksQuery::or_type: {
852 s << OksQuery::OR << ' ';
853
854 const std::list<OksQueryExpression*>& elist = ((OksOrExpression*)&qe)->expressions();
855
856 if (!elist.empty()) {
857 const OksQueryExpression* last = elist.back();
858
859 for (std::list<OksQueryExpression*>::const_iterator i = elist.begin(); i != elist.end(); ++i) {
860 s << *(*i);
861 if (*i != last)
862 s << ' ';
863 }
864 }
865
866 break;
867 }
868
870 s << "(unknown)";
871
872 break;
873 }
874 }
875
876 s << ')';
877
878 return s;
879}
OKS query logical AND expression class.
Definition query.hpp:272
OKS attribute class.
Definition attribute.hpp:94
const std::string & get_name() const noexcept
out stream operator
OKS query expression comparator class.
Definition query.hpp:139
OksQuery::Comparator GetFunction() const
Definition query.hpp:166
const OksAttribute * GetAttribute() const
Definition query.hpp:158
OKS query logical NOT expression class.
Definition query.hpp:219
OKS query logical OR expression class.
Definition query.hpp:285
OKS query expression class.
Definition query.hpp:112
OksQuery::QueryType type() const
Definition query.hpp:118
static bool equal_cmp(const OksData *, const OksData *)
Definition query.cpp:56
static bool reg_exp_cmp(const OksData *, const OksData *regexp)
Definition query.cpp:86
bool(*) Comparator(const OksData *, const OksData *)
Definition query.hpp:95
static bool greater_cmp(const OksData *, const OksData *)
Definition query.cpp:81
static const char * OR
Definition query.hpp:69
static const char * RE
Definition query.hpp:78
static const char * OID
Definition query.hpp:75
static bool less_or_equal_cmp(const OksData *, const OksData *)
Definition query.cpp:66
static bool not_equal_cmp(const OksData *, const OksData *)
Definition query.cpp:61
static const char * GT
Definition query.hpp:82
static const char * NOT
Definition query.hpp:71
static const char * SOME
Definition query.hpp:72
static const char * GE
Definition query.hpp:80
static const char * AND
Definition query.hpp:70
static bool greater_or_equal_cmp(const OksData *, const OksData *)
Definition query.cpp:71
static const char * EQ
Definition query.hpp:76
static bool less_cmp(const OksData *, const OksData *)
Definition query.cpp:76
static const char * LE
Definition query.hpp:79
static const char * NE
Definition query.hpp:77
static const char * LS
Definition query.hpp:81
OKS query relationship expression class.
Definition query.hpp:184

◆ operator<<() [17/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const OksRelationship & r )

Definition at line 90 of file relationship.cpp.

92{
93 s << "Relationship name: \"" << r.p_name
94 << "\"\n"
95 " class type: \""
96 << r.p_rclass
97 << "\"\n"
98 " low cardinality constraint is "
99 << OksRelationship::card2str(r.p_low_cc)
100 << "\n"
101 " high cardinality constraint is "
102 << OksRelationship::card2str(r.p_high_cc)
103 << "\n"
104 " is"
105 << (r.p_composite == true ? "" : " not")
106 << " composite reference\n"
107 " is"
108 << (r.p_exclusive == true ? "" : " not")
109 << " exclusive reference\n"
110 " is "
111 << (r.p_dependent == true ? "dependent" : "shared")
112 << " reference\n"
113 " has description: \""
114 << r.p_description
115 << "\"\n"
116 " is "
117 << (r.p_ordered == true ? "ordered" : "unordered") << std::endl;
118
119 return s;
120}
static const char * card2str(CardinalityConstraint) noexcept

◆ operator<<() [18/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
const OksString & str )
inline

Implementation of OksString out stream operator.

Definition at line 484 of file object.hpp.

486{
487 s << *(static_cast<const std::string*>(&str));
488
489 return s;
490}

◆ operator<<() [19/19]

std::ostream & dunedaq::oks::operator<< ( std::ostream & s,
OksKernel & k )

Definition at line 1358 of file kernel.cpp.

1360{
1362
1363 s << "OKS KERNEL DUMP:\n" << "OKS VERSION: " << k.GetVersion() << std::endl;
1364
1365 if (!k.p_schema_files.empty()) {
1366 s << " Loaded schema:\n";
1367
1368 for (const auto& i : k.p_schema_files)
1369 s << " " << i.second->get_full_file_name() << std::endl;
1370
1371 if (!k.p_data_files.empty()) {
1372 s << " Loaded data:\n";
1373
1374 for (const auto& j : k.p_data_files)
1375 s << " " << j.second->get_full_file_name() << std::endl;
1376 } else
1377 s << " No loaded data files\n";
1378
1379 if (!k.p_classes.empty()) {
1380 s << " The classes:\n";
1381
1382 for (const auto& j : k.p_classes)
1383 s << *j.second;
1384 }
1385 } else
1386 s << " No loaded schema files\n";
1387
1388 s << "END OF OKS KERNEL DUMP.\n";
1389
1390 return s;
1391}
OksClass::Map p_classes
Definition kernel.hpp:1987
OksFile::Map p_schema_files
Definition kernel.hpp:1973
static const char * GetVersion()
Get OKS version. The method returns string containing CVS tag and date of OKS build.
Definition kernel.cpp:274
OksFile::Map p_data_files
Definition kernel.hpp:1974

◆ operator==() [1/3]

bool dunedaq::oks::operator== ( const OksString & s1,
const char * s2 )
inline

Implementation of OksString logical equality operator.

Definition at line 469 of file object.hpp.

470{
471 return (*(static_cast<const std::string*>(&s1)) == s2);
472}

◆ operator==() [2/3]

bool dunedaq::oks::operator== ( const OksString & s1,
const OksString & s2 )
inline

Implementation of OksString logical equality operator.

Definition at line 453 of file object.hpp.

454{
455 return (*(static_cast<const std::string*>(&s1)) == *(static_cast<const std::string*>(&s2)));
456}

◆ operator==() [3/3]

bool dunedaq::oks::operator== ( const OksString & s1,
const std::string & s2 )
inline

Implementation of OksString logical equality operator.

Definition at line 461 of file object.hpp.

462{
463 return (*(static_cast<const std::string*>(&s1)) == s2);
464}

◆ printTableLine()

void dunedaq::oks::printTableLine ( std::ostream & s,
unsigned char c )
static

Definition at line 84 of file profiler.cpp.

85{
86 s << '+';
87 s.fill(c);
88 s.width(76);
89 s << "" << '+' << std::endl;
90}

◆ printTableSeparator()

void dunedaq::oks::printTableSeparator ( std::ostream & s,
unsigned char c )
static

Definition at line 69 of file profiler.cpp.

70{
71 s << '+';
72 s.fill(c);
73 s.width(41);
74 s << "" << '+';
75 s.width(12);
76 s << "" << '+';
77 s.width(10);
78 s << "" << '+';
79 s.width(10);
80 s << "" << '+' << std::endl;
81}

◆ reference()

Found unresolved dunedaq::oks::reference ( s )

Definition at line 124 of file kernel.cpp.

124 :\n" << which, ((std::string)which))
125
126ERS_DECLARE_ISSUE(kernel,
127 ClassAlreadyDefined,
128 "class \"" << name << "\" is defined in files \"" << f1 << "\" and \"" << f2 << "\"",
129 ((std::string)name)((std::string)f1)((std::string)f2))
130
131ERS_DECLARE_ISSUE(kernel, InternalError, "internal error: " << text, ((std::string)text))
132
133std::string
134CanNotOpenFile::fill(const char* prefix, const std::string& name, const std::string& reason) noexcept
135{
136 std::string result(prefix);
137 result += "(): ";
138
139 if (name.empty())
140 return (result + "file name is empty");
141
142 result += "cannot load file \'" + name + '\'';
143
144 if (!reason.empty()) {
145 result += " because:\n" + reason;
146 }
147
148 return result;
149}
150
151std::string
152FailedLoadFile::fill(const std::string& what, const std::string& name, const std::string& reason) noexcept
153{
154 return (std::string("Failed to load ") + what + " \"" + name + "\" because:\n" + reason);
155}
156
157std::string
158FailedReloadFile::fill(const std::string& names, const std::string& reason) noexcept
159{
160 return (std::string("Failed to re-load file(s) ") + names + " because:\n" + reason);
161}
162
163std::string
164RepositoryOperationFailed::fill(const char* op, const std::string& reason) noexcept
165{
166 return (std::string("Failed to ") + op + " file(s) because:\n" + reason);
167}
168
169std::string
170CanNotCreateFile::fill(const char* prefix,
171 const char* what,
172 const std::string& name,
173 const std::string& reason) noexcept
174{
175 return std::string(prefix) + "(): failed to create new " + what + " \'" + name + "\' because:\n" + reason;
176}
177
178std::string
179CanNotCreateRepositoryDir::fill(const char* prefix, const std::string& name) noexcept
180{
181 return std::string(prefix) + "(): failed to create user repository dir, mkdtemp(\'" + name +
182 "\') failed: " + strerror(errno);
183}
184
185std::string
186CanNotWriteToFile::fill(const char* prefix,
187 const char* item,
188 const std::string& name,
189 const std::string& reason) noexcept
190{
191 return (std::string(prefix) + "(): failed to write " + item + " to \'" + name + "\' because:\n" + reason);
192}
193
194std::string
195CanNotBackupFile::fill(const std::string& name, const std::string& reason) noexcept
196{
197 return (std::string("Failed to make a backup file of \'") + name + "\' because:\n" + reason);
198}
199
200std::string
201CanNotSetActiveFile::fill(const char* item, const std::string& name, const std::string& reason) noexcept
202{
203 return (std::string("Failed to set active ") + item + " file \'" + name + "\' because:\n" + reason);
204}
205
206std::string
207CanNotSetFile::fill(const OksClass* c, const OksObject* o, const OksFile& file, const std::string& reason) noexcept
208{
209 std::ostringstream s;
210 s << "Failed to move ";
211 if (c)
212 s << "class " << c->get_name();
213 else
214 s << "object " << o;
215 s << " to file \'" << file.get_full_file_name() << "\' because:\n" << reason;
216 return s.str();
217}
218
219std::string
220CannotAddClass::fill(const OksClass& c, const std::string& reason) noexcept
221{
222 return (std::string("Cannot add class \'") + c.get_name() + "\' because:\n" + reason);
223}
224
225std::string
226CannotResolvePath::fill(const std::string& path, int error_code) noexcept
227{
228 std::ostringstream text;
229 text << "realpath(\'" << path << "\') has failed with code " << error_code << ": \'" << strerror(error_code) << '\'';
230 return text.str();
231}
232
233static const std::string&
234get_temporary_dir()
235{
236 static std::string s_dir;
237 static std::once_flag flag;
238
239 std::call_once(flag, []() {
240 try {
241 if (!getenv("OKS_GIT_NO_VAR_DIR")) {
242 OksSystem::User myself;
243
244 s_dir = "/var/run/user/";
245 s_dir.append(std::to_string(myself.identity()));
246
247 if (std::filesystem::is_directory(s_dir) == false) {
248 TLOG_DEBUG(1) << "directory " << s_dir << " does not exist";
249 s_dir.clear();
250 } else {
251 const std::filesystem::space_info si = std::filesystem::space(s_dir);
252 const double available = static_cast<double>(si.available) / static_cast<double>(si.capacity);
253
254 if (available < 0.5) {
255 TLOG_DEBUG(1) << "usage of " << s_dir << " is " << static_cast<int>((1.0 - available) * 100.0)
256 << "%, will use standard temporary path";
257 s_dir.clear();
258 }
259 }
260 }
261
262 if (s_dir.empty())
263 s_dir = std::filesystem::temp_directory_path().string();
264 } catch (std::exception& ex) {
265 Oks::error_msg("OksKernel::OksKernel") << "cannot get temporary directory path: " << ex.what() << std::endl;
266 s_dir = "/tmp";
267 }
268 });
269
270 return s_dir;
271}
ERS_DECLARE_ISSUE(kernel, SetGroupIdFailed, "cannot set group ID "<< id<< " for the file \'"<< file<< "\': chown() failed with code "<< code<< " , reason = \'"<< why<< '\'',((long) id)((const char *) file)((int) code)((std::string) why)) ERS_DECLARE_ISSUE(kernel

◆ remove_super_class_error()

std::string dunedaq::oks::remove_super_class_error ( const std::string & c1,
const std::string & c2 )
static

Definition at line 881 of file class.cpp.

882{
883 return (std::string("cannot remove superclass \"") + c1 + "\" from class \"" + c2 + '\"');
884}

◆ replace_datetime_spaces()

std::string dunedaq::oks::replace_datetime_spaces ( const std::string & in)
static

Definition at line 5230 of file kernel.cpp.

5231{
5232 std::string out(in);
5233 std::replace(out.begin(), out.end(), ' ', 'T');
5234 return out;
5235}
FELIX Initialization std::string initerror FELIX queue timed out

◆ report_unexpected()

std::string dunedaq::oks::report_unexpected ( const char * what,
const char expected,
const char read )
static

Definition at line 84 of file xml.cpp.

85{
86 std::string s;
87
88 if (what) {
89 s += "Failed to read ";
90 s += what;
91 s += ": ";
92 }
93
94 s += "symbol \'";
95 s += expected;
96 s += "\' is expected instead of \'";
97 s += read;
98 s += '\'';
99
100 return s;
101}

◆ str2date()

boost::gregorian::date dunedaq::oks::str2date ( const char * value,
size_t len )

◆ str2time()

boost::posix_time::ptime dunedaq::oks::str2time ( const char * value,
size_t len,
const char * file_name = nullptr )

◆ strerror()

const std::string dunedaq::oks::strerror ( int error)

Convert C error number to string.

Definition at line 111 of file kernel.cpp.

112{
113 char buffer[1024];
114 buffer[0] = 0;
115 return std::string(strerror_r(error, buffer, 1024));
116}
CIB Buffer std::string descriptor Message from std::string descriptor CIB process error

◆ test_dangling_references()

void dunedaq::oks::test_dangling_references ( const OksObject * obj,
const OksData & d,
const OksRelationship & r,
std::string & result )
static

Definition at line 2872 of file object.cpp.

2873{
2874 if (d.type == OksData::uid_type || d.type == OksData::uid2_type) {
2875 std::ostringstream text;
2876
2877 if (result.empty()) {
2878 text << " * object " << obj << " has dangling references:\n";
2879 }
2880
2881 text << " - object " << d << " referenced via \'" << r.get_name() << "\'\n";
2882
2883 result += text.str();
2884 }
2885}

◆ test_file_existence()

void dunedaq::oks::test_file_existence ( const std::string & file_name,
bool silence,
const std::string & fname,
const char * msg )
static

Definition at line 1455 of file kernel.cpp.

1456{
1457 // test file existence
1458
1459 bool file_exists = false;
1460
1461 {
1462 struct stat buf;
1463 if (stat(file_name.c_str(), &buf) == 0) {
1464 if (!silence) {
1465 Oks::warning_msg(fname) << " File \"" << file_name << "\" already exists\n";
1466 }
1467 file_exists = true;
1468 }
1469 }
1470
1471 // test file permissions
1472
1473 {
1474 std::ofstream f(file_name.c_str());
1475
1476 if (!f) {
1477 if (!silence) {
1478 if (file_exists) {
1479 throw std::runtime_error("cannot open file in write mode");
1480 } else {
1481 throw std::runtime_error("cannot create file");
1482 }
1483 }
1484 }
1485 }
1486
1487 if (!silence)
1488 std::cout << "Creating new " << msg << " file \"" << file_name << "\"..." << std::endl;
1489}
static std::ostream & warning_msg(const char *)
Definition kernel.cpp:518

◆ throw_validate_not_empty()

void dunedaq::oks::throw_validate_not_empty ( const char * name)

Definition at line 50 of file xml.cpp.

51{
52 std::string text(name);
53 text += " is not set";
54 throw std::runtime_error(text.c_str());
55}

◆ trim_dangling()

bool dunedaq::oks::trim_dangling ( OksData & d,
const OksKernel & kernel )
static

Definition at line 1683 of file object.cpp.

1684{
1685 if (d.type == OksData::object_type) {
1686 if (d.data.OBJECT && kernel.is_dangling(d.data.OBJECT)) {
1687 d.data.OBJECT = nullptr;
1688 }
1689
1690 return (d.data.OBJECT != nullptr);
1691 } else if (d.type == OksData::list_type) {
1692 if (d.data.LIST) {
1693 for (OksData::List::iterator i = d.data.LIST->begin(); i != d.data.LIST->end();) {
1694 OksData* d2 = *i;
1695 if (d2->type == OksData::object_type) {
1696 if (d2->data.OBJECT == nullptr || kernel.is_dangling(d2->data.OBJECT)) {
1697 i = d.data.LIST->erase(i);
1698 delete d2;
1699 continue;
1700 }
1701 }
1702 ++i;
1703 }
1704
1705 return (!d.data.LIST->empty());
1706 } else
1707 return false;
1708 }
1709
1710 return true;
1711}
bool is_dangling(OksClass *class_ptr) const
Check pointer on oks class.
Definition kernel.cpp:4415

◆ validate_init2range()

void dunedaq::oks::validate_init2range ( const OksAttribute * a)

Definition at line 164 of file attribute.cpp.

165{
166 if (!a->get_range().empty() && a->get_data_type() != OksData::class_type) {
167 try {
168 OksData d;
169 d.set_init_value(a, false);
170 d.check_range(a);
171 } catch (std::exception& ex) {
172 std::ostringstream text;
173 text << "failed to set initial value \'" << a->get_init_value() << "\' of attribute \'" << a->get_name()
174 << "\':\n"
175 << ex.what();
176 throw std::runtime_error(text.str().c_str());
177 }
178 }
179}
const std::string & get_range() const noexcept
Get attribute range.
const std::string & get_init_value() const noexcept
static OksData::Type get_data_type(const std::string &type) noexcept
Converts string to attribute OKS data type.

◆ validate_not_empty()

void dunedaq::oks::validate_not_empty ( const std::string & value,
const char * name )
inline

Check string value is not empty. Throw exception if length = 0.

Definition at line 52 of file exceptions.hpp.

53{
54 if (value.empty())
56}
void throw_validate_not_empty(const char *name)
Definition xml.cpp:50

Variable Documentation

◆ _empty_str

const char dunedaq::oks::_empty_str[] = "empty"

Definition at line 354 of file file.cpp.

◆ BindError

dunedaq::oks::BindError

Definition at line 124 of file kernel.cpp.

◆ OksProfilerFunctionsStr

const char* dunedaq::oks::OksProfilerFunctionsStr[]
static

Definition at line 14 of file profiler.cpp.

◆ s_get_cwd_mutex

std::mutex dunedaq::oks::s_get_cwd_mutex
static

Definition at line 57 of file kernel.cpp.

◆ s_git_folders

GitFoldersHolder dunedaq::oks::s_git_folders
static

Definition at line 108 of file kernel.cpp.