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
 the structure to pass common parameters to various read() methods of OksData and OksObject class 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_ptrClassSet
 

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 820 of file object.hpp.

Enumeration Type Documentation

◆ __LogSeverity__

Enumerator
Error 
Warning 
Log 
Debug 

Definition at line 381 of file kernel.hpp.

382 {
383 Error = 0,
384 Warning,
385 Log,
386 Debug
387 };

Function Documentation

◆ __is_comment()

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

Definition at line 327 of file xml.cpp.

327 {
328 return oks::cmp_str4n(s, "<!--");
329}

◆ __throw_bad_file_data_unexpected_symbol()

static 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 106 of file xml.cpp.

107{
108 throw oks::BadFileData(report_unexpected(what, expected, read), l, p);
109}
static std::string report_unexpected(const char *what, const char expected, const char read)
Definition xml.cpp:79

◆ __throw_runtime_error_unexpected_symbol()

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

Definition at line 100 of file xml.cpp.

101{
102 throw std::runtime_error(report_unexpected(0, expected, read));
103}

◆ __throw_unknown_type()

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

Definition at line 494 of file object.cpp.

495{
496 std::ostringstream s;
497 s << "Unknown attribute type \"" << atype << '\"';
498 throw oks::BadFileData(s.str(), params.s.get_line_no(), params.s.get_line_pos());
499}
unsigned long get_line_no() const
Definition xml.hpp:410
unsigned long get_line_pos() const
Definition xml.hpp:411
OksXmlInputStream & s
Definition oks_utils.hpp:49

◆ _find_file()

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

Definition at line 3167 of file kernel.cpp.

3168{
3169 for(OksFile::Map::const_iterator i = files.begin(); i != files.end(); ++i) {
3170 if(i->second == f) return true;
3171 }
3172 return false;
3173}

◆ _references()

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

Definition at line 3079 of file object.cpp.

3080{
3081 if(recursion_depth == 0) return;
3082
3083 size_t l1 = obj->GetClass()->number_of_all_attributes();
3084 size_t l2 = l1 + obj->GetClass()->number_of_all_relationships();
3085
3086 while(l1 < l2) {
3087 OksDataInfo odi(l1, (OksRelationship *)0);
3088 OksData * d(obj->GetRelationshipValue(&odi));
3089
3090 if(d->type == OksData::object_type) {
3091 if(OksObject * o2 = d->data.OBJECT) {
3092 insert2refs(o2, recursion_depth, data);
3093 }
3094 }
3095 else if(d->type == OksData::list_type) {
3096 for(OksData::List::const_iterator li = d->data.LIST->begin(); li != d->data.LIST->end(); ++li) {
3097 if((*li)->type == OksData::object_type) {
3098 if(OksObject * o2 = (*li)->data.OBJECT) {
3099 insert2refs(o2, recursion_depth, data);
3100 }
3101 }
3102 }
3103 }
3104
3105 ++l1;
3106 }
3107}
OksObject describes instance of OksClass.
Definition object.hpp:836
static void insert2refs(const OksObject *o, unsigned long recursion_depth, RefData &data)
Definition object.cpp:3059
Struct OKS data information.
Definition object.hpp:342
the structure to pass common parameters to various read() methods of OksData and OksObject class
Definition object.hpp:449

◆ add_if_not_found()

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

Definition at line 1565 of file class.cpp.

1566{
1567 for(OksClass::FList::const_iterator i = clist.begin(); i != clist.end(); ++i) {
1568 if(*i == c) return;
1569 }
1570 clist.push_back(c);
1571}

◆ add_super_class_error()

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

Definition at line 860 of file class.cpp.

861{
862 return (std::string("cannot add superclass \"") + c1 + "\" to class \"" + c2 + '\"');
863}

◆ are_types_different()

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

Definition at line 1644 of file class.cpp.

1645{
1646 static const std::string __enum_str__("enum");
1647 static const std::string __string_str__("string");
1648
1649 const std::string& s1 = a1->get_type();
1650 const std::string& s2 = a2->get_type();
1651
1652 return (
1653 !((s1 == s2) || ((s1 == __enum_str__ && s2 == __string_str__) || (s1 == __string_str__ && s2 == __enum_str__)))
1654 );
1655}
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 1636 of file class.cpp.

1637{
1638 return (v ? "multi-value" : "single-value");
1639}

◆ card2string()

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

Definition at line 1729 of file class.cpp.

1730{
1731 return (cc == OksRelationship::One ? "one object" : "many objects");
1732}

◆ check_and_report_empty_parameter()

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

Definition at line 818 of file class.cpp.

819{
820 if(b1) {
821 throw oks::SetOperationFailed(fname, "First parameter is (null)");
822 }
823
824 if(b2) {
825 throw oks::SetOperationFailed(fname, "Second parameter is (null)");
826 }
827}

◆ check_and_report_found_items()

static 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 833 of file class.cpp.

836{
837 struct {
838 bool b;
839 const std::string * name;
840 } info[] = {
841 {b1, &item1_name},
842 {b2, &item2_name}
843 };
844
845 for(int i = 0; i < 2; ++i) {
846 if(info[i].b) {
847 std::string text("cannot find direct ");
848 text += item_type;
849 text += " \"";
850 text += *info[i].name;
851 text += "\" in class \"";
852 text += class_name;
853 text += '\"';
854 throw oks::SetOperationFailed(fname, text);
855 }
856 }
857}

◆ check_relevant()

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

Definition at line 5319 of file kernel.cpp.

5320{
5321 for (const auto& x : ver.m_files)
5322 if (loaded_files.find(x) != loaded_files.end())
5323 return true;
5324
5325 return false;
5326}
std::vector< std::string > m_files
Definition kernel.hpp:515

◆ cmp_data()

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

Definition at line 2263 of file object.cpp.

2264{
2265 if(d->type == OksData::object_type && d2->type == OksData::object_type)
2266 return ((d2->data.OBJECT == d->data.OBJECT) ? true : false);
2267
2268 const std::string& object_id =
2269 d->type == OksData::object_type ? d->data.OBJECT->GetId() :
2270 d->type == OksData::uid2_type ? *(static_cast<std::string*>(d->data.UID2.object_id)) :
2271 *(static_cast<std::string*>(d->data.UID.object_id));
2272
2273 const std::string& object_id2 =
2274 d2->type == OksData::object_type ? d2->data.OBJECT->GetId() :
2275 d2->type == OksData::uid2_type ? *(static_cast<std::string*>(d2->data.UID2.object_id)) :
2276 *(static_cast<std::string*>(d2->data.UID.object_id));
2277
2278 if(object_id != object_id2) return false;
2279
2280 const OksClass *pclass_id =
2281 d->type == OksData::object_type ? d->data.OBJECT->GetClass() :
2282 d->type == OksData::uid_type ? d->data.UID.class_id :
2283 0;
2284
2285 const OksClass *pclass_id2 =
2286 d2->type == OksData::object_type ? d2->data.OBJECT->GetClass() :
2287 d2->type == OksData::uid_type ? d2->data.UID.class_id :
2288 0;
2289
2290 if(pclass_id && pclass_id2) return (pclass_id == pclass_id2 ? true : false);
2291
2292 const std::string& class_id =
2293 (pclass_id ? pclass_id->get_name() : *(static_cast<std::string*>(d->data.UID2.class_id)));
2294
2295 const std::string& class_id2 =
2296 (pclass_id2 ? pclass_id2->get_name() : *(static_cast<std::string*>(d2->data.UID2.class_id)));
2297
2298 return (class_id == class_id2 ? true : false);
2299}
The OKS class.
Definition class.hpp:200
const OksClass * GetClass() const
Definition object.hpp:990
const std::string & GetId() const
Definition object.hpp:995
union dunedaq::oks::OksData::Data data
enum dunedaq::oks::OksData::Type type
struct dunedaq::oks::OksData::Data::@165 UID
struct dunedaq::oks::OksData::Data::@166 UID2

◆ cmp_str1()

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

Definition at line 9 of file cstring.hpp.

9 {
10 return (*(const int16_t *)s1 == *(const int16_t *)s2);
11 }

◆ cmp_str10()

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

Definition at line 73 of file cstring.hpp.

73 {
74 return cmp_str7(s1,s2) && cmp_str2(s1+8,s2+8);
75 }
bool cmp_str2(const char *s1, const char s2[3])
Definition cstring.hpp:13
bool cmp_str7(const char *s1, const char s2[8])
Definition cstring.hpp:53

◆ cmp_str11()

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

Definition at line 77 of file cstring.hpp.

77 {
78 return cmp_str7(s1,s2) && cmp_str3(s1+8,s2+8);
79 }
bool cmp_str3(const char *s1, const char s2[4])
Definition cstring.hpp:21

◆ cmp_str12()

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

Definition at line 81 of file cstring.hpp.

81 {
82 return cmp_str7(s1,s2) && cmp_str4(s1+8,s2+8);
83 }
bool cmp_str4(const char *s1, const char s2[5])
Definition cstring.hpp:29

◆ cmp_str13()

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

Definition at line 85 of file cstring.hpp.

85 {
86 return cmp_str7(s1,s2) && cmp_str5(s1+8,s2+8);
87 }
bool cmp_str5(const char *s1, const char s2[6])
Definition cstring.hpp:37

◆ cmp_str14()

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

Definition at line 89 of file cstring.hpp.

89 {
90 return cmp_str7(s1,s2) && cmp_str6(s1+8,s2+8);
91 }
bool cmp_str6(const char *s1, const char s2[7])
Definition cstring.hpp:45

◆ cmp_str15()

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

Definition at line 93 of file cstring.hpp.

93 {
94 return cmp_str7(s1,s2) && cmp_str7(s1+8,s2+8);
95 }

◆ cmp_str16()

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

Definition at line 97 of file cstring.hpp.

97 {
98 return cmp_str7(s1,s2) && cmp_str7(s1+8,s2+8) && (s1[16] == 0);
99 }

◆ cmp_str2()

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

Definition at line 13 of file cstring.hpp.

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

◆ cmp_str2n()

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

Definition at line 17 of file cstring.hpp.

17 {
18 return cmp_str1(s1,s2);
19 }

◆ cmp_str3()

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

Definition at line 21 of file cstring.hpp.

21 {
22 return (*(const int32_t *)s1 == *(const int32_t *)s2);
23 }

◆ cmp_str3n()

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

Definition at line 25 of file cstring.hpp.

25 {
26 return (s1[0] == s2[0]) && cmp_str1(s1+1,s2+1);
27 }

◆ cmp_str4()

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

Definition at line 29 of file cstring.hpp.

29 {
30 return (s1[0] == s2[0]) && cmp_str3(s1+1,s2+1);
31 }

◆ cmp_str4n()

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

Definition at line 33 of file cstring.hpp.

33 {
34 return cmp_str3(s1,s2);
35 }

◆ cmp_str5()

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

Definition at line 37 of file cstring.hpp.

37 {
38 return cmp_str1(s1,s2) && cmp_str3(s1+2,s2+2);
39 }

◆ cmp_str5n()

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

Definition at line 41 of file cstring.hpp.

41 {
42 return cmp_str3(s1,s2) && (s1[4] == s2[4]);
43 }

◆ cmp_str6()

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

Definition at line 45 of file cstring.hpp.

45 {
46 return cmp_str3(s1,s2) && cmp_str2(s1+4,s2+4);
47 }

◆ cmp_str6n()

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

Definition at line 49 of file cstring.hpp.

49 {
50 return cmp_str3(s1,s2) && cmp_str1(s1+4,s2+4);
51 }

◆ cmp_str7()

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

Definition at line 53 of file cstring.hpp.

53 {
54 return (*(const int64_t *)s1 == *(const int64_t *)s2);
55 }

◆ cmp_str7n()

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

Definition at line 57 of file cstring.hpp.

57 {
58 return (cmp_str3(s1,s2) && cmp_str3n(s1+4,s2+4));
59 }
bool cmp_str3n(const char *s1, const char s2[3])
Definition cstring.hpp:25

◆ cmp_str8()

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

Definition at line 61 of file cstring.hpp.

61 {
62 return cmp_str7(s1,s2) && (s1[8] == 0);
63 }

◆ cmp_str8n()

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

Definition at line 65 of file cstring.hpp.

65 {
66 return (*(const int64_t *)s1 == *(const int64_t *)s2);
67 }

◆ cmp_str9()

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

Definition at line 69 of file cstring.hpp.

69 {
70 return cmp_str1(s1,s2) && cmp_str7(s1+2,s2+2);
71 }

◆ create_updated_lists()

static 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 2981 of file kernel.cpp.

2982{
2983 *ufs = 0; // updated files
2984 *rfs = 0; // removed files
2985
2986 for(OksFile::Map::const_iterator i = files.begin(); i != files.end(); ++i) {
2987 OksFile::FileStatus fs = i->second->get_status_of_file();
2988
2989 if(fs == wu /* i.e. Which Updated */ ) {
2990 if(*ufs == 0) { *ufs = new std::list<OksFile *>(); }
2991 (*ufs)->push_back(i->second);
2992 }
2993 else if(fs == wr /* i.e. Which Removed */ ) {
2994 if(*rfs == 0) { *rfs = new std::list<OksFile *>(); }
2995 (*rfs)->push_back(i->second);
2996 }
2997 }
2998}

◆ erase_empty_chars()

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

Definition at line 79 of file query.cpp.

80{
81 while(s[0] == ' ' || s[0] == '\n' || s[0] == '\t') s.erase(0, 1);
82}

◆ 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()

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

Definition at line 490 of file kernel.cpp.

491{
492 long file_length = 0;
493
494 // get size of file and check that it is not empty
495
496 f.seekg(0, std::ios::end);
497
498#if __GNUC__ >= 3
499 file_length = static_cast<std::streamoff>(f.tellg());
500#else
501 file_length = f.tellg();
502#endif
503
504 f.seekg(0, std::ios::beg);
505
506 return file_length;
507}

◆ get_time_interval()

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

◆ insert2refs()

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

Definition at line 3059 of file object.cpp.

3060{
3061 recursion_depth--;
3062
3063 std::pair<OksObject::FSet::iterator,bool> ret = data.tested_objs.insert(const_cast<OksObject *>(o));
3064
3065 if(ret.second==true) {
3066 if(data.classes == nullptr || data.classes->find(const_cast<OksClass *>(o->GetClass())) != data.classes->end()) {
3067 data.refs.insert(const_cast<OksObject *>(o));
3068 }
3069 o->SetTransientData((void *)recursion_depth);
3070 _references(o, recursion_depth, data);
3071 }
3072 else if(o->GetTransientData() < (void *)recursion_depth) {
3073 o->SetTransientData((void *)recursion_depth);
3074 _references(o, recursion_depth, data);
3075 }
3076}
void * GetTransientData() const
Get transient user data associated with given object. Return data set using SetTransientData() method...
Definition object.hpp:1343
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:1335

◆ is_not_info()

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

Definition at line 1499 of file file.cpp.

1500{
1501 static const char start_tag[] = "<info ";
1502 static const char last_tag[] = "last-modification-time=\"yyyymmddThhmmss\"/>"; // 24 - is a position of first double quote
1503
1504 const std::string::size_type len = line.length();
1505
1506 return(
1507 ( len < (sizeof(start_tag) + sizeof(last_tag)) ) ||
1508 ( line.compare(0, sizeof(start_tag)-1, start_tag, sizeof(start_tag)-1) != 0 ) ||
1509 ( line.compare(len - sizeof(last_tag) + 1, 24, last_tag, 24) != 0 )
1510 );
1511}

◆ is_star()

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

Definition at line 832 of file attribute.cpp.

833{
834 return (s.size() == 1 && s[0] == '*');
835}

◆ log_timestamp()

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

Definition at line 5722 of file kernel.cpp.

5723{
5724 auto now(std::chrono::system_clock::now());
5725 auto time_since_epoch(now.time_since_epoch());
5726 auto seconds_since_epoch(std::chrono::duration_cast<std::chrono::seconds>(time_since_epoch));
5727
5728 std::time_t now_t(std::chrono::system_clock::to_time_t(std::chrono::system_clock::time_point(seconds_since_epoch)));
5729
5730 char buff[128];
5731 std::size_t len = std::strftime(buff, 128 - 16, "%Y-%b-%d %H:%M:%S.", std::localtime(&now_t));
5732 sprintf(buff+len, "%03d ", (int)(std::chrono::duration_cast<std::chrono::milliseconds>(time_since_epoch).count() - seconds_since_epoch.count()*1000));
5733
5734 std::ostream& s (severity <= Warning ? std::cerr : std::cout);
5735
5736 s << buff << (severity == Error ? "ERROR " : severity == Warning ? "WARNING " : severity == Debug ? "DEBUG " : "");
5737
5738 return s;
5739}
static int64_t now()

◆ 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 512 of file kernel.cpp.

513{
514 const char _prefix [] = "OksKernel::";
515 std::string fname(_prefix, (sizeof(_prefix)-1));
516
517 fname.append(f, f_len);
518
519 const char _x1 [] = "(file \'";
520 fname.append(_x1, (sizeof(_x1)-1));
521 fname.append(file);
522 fname.push_back('\'');
523
524 // add boolean parameter
525
526 if(p) {
527 if(*p) {
528 const char _true_str [] = ", true";
529 fname.append(_true_str, (sizeof(_true_str)-1));
530 }
531 else {
532 const char _false_str [] = ", false";
533 fname.append(_false_str, (sizeof(_false_str)-1));
534 }
535 }
536
537 // add file handler parameter
538
539 if(fh && *fh) {
540 const char _x2 [] = ", included by file \'";
541 fname.append(_x2, (sizeof(_x2)-1));
542 fname.append((*fh)->get_full_file_name());
543 fname.push_back('\'');
544 }
545
546 fname.push_back(')');
547
548 return fname;
549}

◆ 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 1635 of file kernel.cpp.

1636{
1637 const char _s1_str[] = " - \'";
1638 const char _s2_str[] = "\' tested as ";
1639
1640 return ((std::string(_s1_str, sizeof(_s1_str)-1) + name).append(_s2_str, sizeof(_s2_str)-1)).append(test, test_len);
1641}

◆ operator<()

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

Implementation of OksString logical less operator.

Definition at line 414 of file object.hpp.

416{
417 return ( *(static_cast<const std::string *>(&s1)) < *(static_cast<const std::string *>(&s2)) );
418}

◆ operator<<() [1/19]

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

Definition at line 162 of file time.cpp.

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

◆ operator<<() [2/19]

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

Definition at line 1311 of file file.cpp.

1312{
1313 s << "user \"" << c.get_created_by() << "\" (" << c.get_author() << ")"
1314 << " on \"" << c.get_created_on() << "\" wrote: \"" << c.get_text() << "\"";
1315
1316 return s;
1317}

◆ operator<<() [3/19]

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

Definition at line 909 of file query.cpp.

911{
912 s << '(' << OksQuery::PATH_TO << ' ' << query.get_goal_object() << ' ' << *query.get_start_expression() << ')';
913 return s;
914}
const OksObject * get_goal_object() const
Definition query.hpp:392
const QueryPathExpression * get_start_expression() const
Definition query.hpp:391

◆ operator<<() [4/19]

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

Definition at line 917 of file query.cpp.

919{
920 s << '(' << (e.get_use_nested_lookup() ? OksQuery::NESTED : OksQuery::DIRECT) << ' ';
921
922 for(std::list<std::string>::const_iterator i = e.get_rel_names().begin(); i != e.get_rel_names().end(); ++i) {
923 if(i != e.get_rel_names().begin()) s << ' ';
924 s << '\"' << *i << '\"';
925 }
926
927 if(e.get_next()) s << ' ' << *(e.get_next());
928
929 s << ')';
930
931 return s;
932}
const QueryPathExpression * get_next() const
Definition query.hpp:343
const std::list< std::string > & get_rel_names() const
Definition query.hpp:342

◆ operator<<() [5/19]

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

Definition at line 1320 of file file.cpp.

1322{
1323 s << "OKS file\n"
1324 " short file name: \'" << f.get_short_file_name() << "\'\n"
1325 " full file name: \'" << f.get_full_file_name() << "\'\n"
1326 " lock file name: \'" << f.get_lock_file() << "\'\n"
1327 " logical name: \'" << f.get_logical_name() << "\'\n"
1328 " type: \'" << f.get_type() << "\'\n"
1329 " oks format: \'" << f.get_oks_format() << "\'\n"
1330 " number of items: " << f.get_number_of_items() << "\n"
1331 " created by: " << f.get_created_by() << "\n"
1332 " creation time: " << boost::posix_time::to_simple_string(f.get_creation_time()) << "\n"
1333 " created on: " << f.get_created_on() << "\n"
1334 " last modified by: \'" << f.get_last_modified_by() << "\'\n"
1335 " last modification time: " << boost::posix_time::to_simple_string(f.get_last_modification_time()) << "\'\n"
1336 " last modified on: " << f.get_last_modified_on() << "\'\n"
1337 " is " << (f.is_read_only() ? "read-only" : "read-write") << "\n"
1338 " is " << (f.is_locked() ? "" : "not ") << "locked\n"
1339 " is " << (f.is_updated() ? "" : "not ") << "updated\n";
1340
1341 {
1342 size_t num_of_includes = f.get_include_files().size();
1343
1344 if (num_of_includes)
1345 {
1346 s << " contains " << num_of_includes << " include file(s)";
1347 for (const auto& i : f.get_include_files())
1348 s << " - \'" << i << "\'\n";
1349 }
1350 else
1351 {
1352 s << " contains no include files\n";
1353 }
1354 }
1355
1356 {
1357 size_t num_of_comments = f.get_comments().size();
1358
1359 if (num_of_comments)
1360 {
1361 s << " contains " << num_of_comments << " comment(s)";
1362 for (const auto& i : f.get_comments())
1363 s << " - " << boost::posix_time::to_simple_string(boost::posix_time::from_iso_string(i.first)) << ": \'" << *i.second << "\'\n";
1364 }
1365 else
1366 {
1367 s << " contains no comments\n";
1368 }
1369 }
1370
1371 s << "END of oks file\n";
1372
1373 return s;
1374}

◆ operator<<() [6/19]

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

Definition at line 170 of file time.cpp.

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

◆ operator<<() [7/19]

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

Definition at line 39 of file exceptions.hpp.

39{ s << ex.what(); return s; }
virtual const char * what() const noexcept

◆ operator<<() [8/19]

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

Definition at line 264 of file attribute.cpp.

266{
267 s << "Attribute name: \"" << a.p_name << "\"\n"
268 " type: \"" << a.get_type() << "\"\n"
269 " range: \"" << a.p_range << "\"\n";
270
271 if(a.is_integer()) {
272 s << " format: \"" << OksAttribute::format2str(a.p_format) << "\"\n";
273 }
274
275 if(a.p_multi_values == true) {
276 s << " is \'multi values\'\n";
277 }
278 else {
279 s << " is \'single value\'\n";
280 }
281
282 s << " initial value: \"" << a.p_init_value << "\"\n"
283 " has description: \"" << a.p_description << "\"\n"
284 << (a.p_no_null == true ? " can not be null\n" : " can be null\n")
285 << " is " << (a.p_ordered == true ? "ordered" : "unordered") << std::endl;
286
287 return s;
288}
bool is_integer() const noexcept
Definition attribute.cpp:72

◆ 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 385 of file class.cpp.

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

◆ operator<<() [10/19]

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

Definition at line 184 of file method.cpp.

186{
187 s << "Method name: \"" << m.p_name << "\"\n"
188 " description: \"" << m.p_description << "\"\n";
189
190 if(m.p_implementations) {
191 s << " implementations:\n";
192
193 for(std::list<OksMethodImplementation *>::const_iterator i = m.p_implementations->begin(); i != m.p_implementations->end(); ++i)
194 s << *(*i);
195 }
196 else
197 s << " there are no implementation(s)\n";
198
199 return s;
200}

◆ operator<<() [11/19]

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

Definition at line 43 of file method.cpp.

45{
46 s << " Method implementation:\n"
47 " language: \"" << i.get_language() << "\"\n"
48 " prototype: \"" << i.get_prototype() << "\"\n"
49 " body: \"" << i.get_body() << "\"\n";
50
51 return s;
52}
const std::string & get_body() const noexcept
Definition method.hpp:99
const std::string & get_language() const noexcept
Definition method.hpp:63
const std::string & get_prototype() const noexcept
Definition method.hpp:82

◆ 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 1649 of file object.cpp.

1651{
1652 OSK_PROFILING(OksProfiler::ObjectOperatorOut, o.uid.class_id->p_kernel)
1653
1654 const OksClass * c = o.uid.class_id;
1655
1656 s << "Object " << &o << std::endl;
1657
1658 OksData * di = o.data;
1659
1660
1661 // print attributes
1662
1663 {
1664 const std::list<OksAttribute *> * alist = c->all_attributes();
1665
1666 if(alist && !alist->empty()) {
1667 s << " Attributes are:\n";
1668
1669 for(std::list<OksAttribute *>::const_iterator i = alist->begin(); i != alist->end(); ++i) {
1670 if((*i)->is_integer() && (*i)->get_format() != OksAttribute::Dec) {
1671 s.setf(((*i)->get_format() == OksAttribute::Hex ? std::ios::hex : std::ios::oct), std::ios::basefield);
1672 s.setf(std::ios::showbase);
1673 }
1674
1675 s << " " << (*i)->get_name() << ": " << *di++ << std::endl;
1676
1677 if((*i)->is_integer() && (*i)->get_format() != OksAttribute::Dec) {
1678 s.setf(std::ios::dec, std::ios::basefield);
1679 s.unsetf(std::ios::showbase);
1680 }
1681 }
1682 }
1683 else
1684 s << " There are no attributes\n";
1685 }
1686
1687
1688 // print relationships
1689
1690 {
1691 const std::list<OksRelationship *> * rlist = c->all_relationships();
1692
1693 if(rlist && !rlist->empty()) {
1694 s << " Relationships are:\n";
1695
1696 for(std::list<OksRelationship *>::const_iterator i = rlist->begin(); i != rlist->end(); ++i)
1697 s << " " << (*i)->get_name() << ": " << *di++ << std::endl;
1698 }
1699 else
1700 s << " There are no relationships\n";
1701 }
1702
1703 return s;
1704}
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 1633 of file object.cpp.

1635{
1636 s << '\"';
1637
1638 if(o)
1639 s << o->GetId() << '@' << o->GetClass()->get_name();
1640 else
1641 s << "(null-obj)";
1642
1643 s << '\"';
1644
1645 return s;
1646}
const std::string & get_name() const noexcept
Definition class.hpp:363

◆ operator<<() [14/19]

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

Definition at line 84 of file profiler.cpp.

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

◆ operator<<() [15/19]

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

Definition at line 891 of file query.cpp.

893{
894 s << '('
895 << (gqe.p_sub_classes ? OksQuery::ALL_SUBCLASSES : OksQuery::THIS_CLASS)
896 << ' ';
897
898 if(gqe.p_expression)
899 s << *gqe.p_expression;
900 else
901 s << "(null)";
902
903 s << ')';
904
905 return s;
906}
OksQueryExpression * p_expression
Definition query.hpp:94

◆ operator<<() [16/19]

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

Definition at line 778 of file query.cpp.

780{
781 s << '(';
782
783 switch(qe.type()) {
784 case OksQuery::comparator_type: {
785 OksComparator *cmpr = (OksComparator *)&qe;
786 const OksAttribute *a = cmpr->GetAttribute();
787 OksData *v = cmpr->GetValue();
788 OksQuery::Comparator f = cmpr->GetFunction();
789
790 if(a) {
791 s << '\"' << a->get_name() << "\" ";
792 }
793 else if(v) {
794 s << OksQuery::OID << ' ';
795 }
796 else {
797 s << "(null) ";
798 }
799
800 if(v) {
801 s << *v << ' ';
802 }
803 else {
804 s << "(null) ";
805 }
806
807 if(f) {
808 if(f == OksQuery::equal_cmp) s << OksQuery::EQ;
809 else if(f == OksQuery::not_equal_cmp) s << OksQuery::NE;
810 else if(f == OksQuery::reg_exp_cmp) s << OksQuery::RE;
811 else if(f == OksQuery::less_or_equal_cmp) s << OksQuery::LE;
812 else if(f == OksQuery::greater_or_equal_cmp) s << OksQuery::GE;
813 else if(f == OksQuery::less_cmp) s << OksQuery::LS;
814 else if(f == OksQuery::greater_cmp) s << OksQuery::GT;
815 }
816 else
817 s << "(null)";
818
819 break; }
820
821 case OksQuery::relationship_type: {
822 OksRelationshipExpression *re = (OksRelationshipExpression *)&qe;
823 const OksRelationship *r = re->GetRelationship();
824 bool b = re->IsCheckAllObjects();
825 OksQueryExpression *rqe = re->get();
826
827 if(r)
828 s << '\"' << r->get_name() << "\" ";
829 else
830 s << "(null) ";
831
832 s << (b == true ? OksQuery::ALL_SUBCLASSES : OksQuery::SOME) << ' ';
833
834 if(rqe) s << *rqe;
835 else s << "(null)";
836
837 break; }
838
839 case OksQuery::not_type:
840 s << OksQuery::NOT << ' ' << *(((OksNotExpression *)&qe)->get());
841
842 break;
843
844 case OksQuery::and_type: {
845 s << OksQuery::AND << ' ';
846
847 const std::list<OksQueryExpression *> & elist = ((OksAndExpression *)&qe)->expressions();
848
849 if(!elist.empty()) {
850 const OksQueryExpression * last = elist.back();
851
852 for(std::list<OksQueryExpression *>::const_iterator i = elist.begin(); i != elist.end(); ++i) {
853 s << *(*i);
854 if(*i != last) s << ' ';
855 }
856 }
857
858 break;
859 }
860
861 case OksQuery::or_type: {
862 s << OksQuery::OR << ' ';
863
864 const std::list<OksQueryExpression *> & elist = ((OksOrExpression *)&qe)->expressions();
865
866 if(!elist.empty()) {
867 const OksQueryExpression * last = elist.back();
868
869 for(std::list<OksQueryExpression *>::const_iterator i = elist.begin(); i != elist.end(); ++i) {
870 s << *(*i);
871 if(*i != last) s << ' ';
872 }
873 }
874
875 break;
876 }
877
878 case OksQuery::unknown_type: {
879 s << "(unknown)";
880
881 break;
882 }
883 }
884
885 s << ')';
886
887 return s;
888}
OKS attribute class.
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
OksQuery::QueryType type() const
Definition query.hpp:114

◆ operator<<() [17/19]

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

Definition at line 98 of file relationship.cpp.

100{
101 s << "Relationship name: \"" << r.p_name << "\"\n"
102 " class type: \"" << r.p_rclass << "\"\n"
103 " low cardinality constraint is " << OksRelationship::card2str(r.p_low_cc) << "\n"
104 " high cardinality constraint is " << OksRelationship::card2str(r.p_high_cc) << "\n"
105 " is" << (r.p_composite == true ? "" : " not") << " composite reference\n"
106 " is" << (r.p_exclusive == true ? "" : " not") << " exclusive reference\n"
107 " is " << (r.p_dependent == true ? "dependent" : "shared") << " reference\n"
108 " has description: \"" << r.p_description << "\"\n"
109 " is " << (r.p_ordered == true ? "ordered" : "unordered") << std::endl;
110
111 return s;
112}

◆ operator<<() [18/19]

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

Implementation of OksString out stream operator.

Definition at line 423 of file object.hpp.

425{
426 s << *(static_cast<const std::string *>(&str));
427
428 return s;
429}

◆ operator<<() [19/19]

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

Definition at line 1491 of file kernel.cpp.

1493{
1494 OSK_PROFILING(OksProfiler::KernelOperatorOut, &k)
1495
1496 s << "OKS KERNEL DUMP:\n" << "OKS VERSION: " << k.GetVersion() << std::endl;
1497
1498 if (!k.p_schema_files.empty())
1499 {
1500 s << " Loaded schema:\n";
1501
1502 for (const auto& i : k.p_schema_files)
1503 s << " " << i.second->get_full_file_name() << std::endl;
1504
1505 if (!k.p_data_files.empty())
1506 {
1507 s << " Loaded data:\n";
1508
1509 for (const auto& j : k.p_data_files)
1510 s << " " << j.second->get_full_file_name() << std::endl;
1511 }
1512 else
1513 s << " No loaded data files\n";
1514
1515 if (!k.p_classes.empty())
1516 {
1517 s << " The classes:\n";
1518
1519 for (const auto& j : k.p_classes)
1520 s << *j.second;
1521 }
1522 }
1523 else
1524 s << " No loaded schema files\n";
1525
1526 s << "END OF OKS KERNEL DUMP.\n";
1527
1528 return s;
1529}
OksClass::Map p_classes
Definition kernel.hpp:2066
OksFile::Map p_schema_files
Definition kernel.hpp:2050
static const char * GetVersion()
Get OKS version. The method returns string containing CVS tag and date of OKS build.
Definition kernel.cpp:297
OksFile::Map p_data_files
Definition kernel.hpp:2051

◆ operator==() [1/3]

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

Implementation of OksString logical equality operator.

Definition at line 406 of file object.hpp.

407{
408 return (*(static_cast<const std::string *>(&s1)) == s2);
409}

◆ operator==() [2/3]

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

Implementation of OksString logical equality operator.

Definition at line 388 of file object.hpp.

389{
390 return ( *(static_cast<const std::string *>(&s1)) == *(static_cast<const std::string *>(&s2)) );
391}

◆ operator==() [3/3]

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

Implementation of OksString logical equality operator.

Definition at line 397 of file object.hpp.

398{
399 return ( *(static_cast<const std::string *>(&s1)) == s2 );
400}

◆ printTableLine()

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

Definition at line 76 of file profiler.cpp.

77{
78 s << '+';
79 s.fill(c);
80 s.width(76);
81 s << "" << '+' << std::endl;
82}

◆ printTableSeparator()

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

Definition at line 66 of file profiler.cpp.

67{
68 s << '+';
69 s.fill(c);
70 s.width(41); s << "" << '+';
71 s.width(12); s << "" << '+';
72 s.width(10); s << "" << '+';
73 s.width(10); s << "" << '+' << std::endl;
74}

◆ reference()

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

Definition at line 135 of file kernel.cpp.

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

◆ remove_super_class_error()

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

Definition at line 921 of file class.cpp.

922{
923 return (std::string("cannot remove superclass \"") + c1 + "\" from class \"" + c2 + '\"');
924}

◆ replace_datetime_spaces()

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

Definition at line 5477 of file kernel.cpp.

5478{
5479 std::string out(in);
5480 std::replace(out.begin(), out.end(), ' ', 'T');
5481 return out;
5482}
FELIX Initialization std::string initerror FELIX queue timed out

◆ report_unexpected()

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

Definition at line 79 of file xml.cpp.

80{
81 std::string s;
82
83 if(what) {
84 s += "Failed to read ";
85 s += what;
86 s += ": ";
87 }
88
89 s += "symbol \'";
90 s += expected;
91 s += "\' is expected instead of \'";
92 s += read;
93 s += '\'';
94
95 return s;
96}

◆ 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 114 of file kernel.cpp.

115{
116 char buffer[1024];
117 buffer[0] = 0;
118 return std::string(strerror_r(error, buffer, 1024));
119}
Factory couldn t std::string alg_name Invalid configuration error
Definition Issues.hpp:34

◆ test_dangling_references()

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

Definition at line 2941 of file object.cpp.

2942{
2943 if(d.type == OksData::uid_type || d.type == OksData::uid2_type) {
2944 std::ostringstream text;
2945
2946 if(result.empty()) {
2947 text << " * object " << obj << " has dangling references:\n";
2948 }
2949
2950 text << " - object " << d << " referenced via \'" << r.get_name() << "\'\n";
2951
2952 result += text.str();
2953 }
2954}

◆ test_file_existence()

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

Definition at line 1595 of file kernel.cpp.

1596{
1597 // test file existence
1598
1599 bool file_exists = false;
1600
1601 {
1602 struct stat buf;
1603 if(stat(file_name.c_str(), &buf) == 0) {
1604 if(!silence) {
1605 Oks::warning_msg(fname) << " File \"" << file_name << "\" already exists\n";
1606 }
1607 file_exists = true;
1608 }
1609 }
1610
1611
1612 // test file permissions
1613
1614 {
1615 std::ofstream f(file_name.c_str());
1616
1617 if(!f) {
1618 if(!silence) {
1619 if(file_exists) {
1620 throw std::runtime_error("cannot open file in write mode");
1621 }
1622 else {
1623 throw std::runtime_error("cannot create file");
1624 }
1625 }
1626 }
1627 }
1628
1629 if(!silence)
1630 std::cout << "Creating new " << msg << " file \"" << file_name << "\"..." << std::endl;
1631}

◆ throw_validate_not_empty()

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

Definition at line 44 of file xml.cpp.

45 {
46 std::string text(name);
47 text += " is not set";
48 throw std::runtime_error(text.c_str());
49 }

◆ trim_dangling()

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

Definition at line 1713 of file object.cpp.

1714{
1715 if (d.type == OksData::object_type)
1716 {
1717 if (d.data.OBJECT && kernel.is_dangling(d.data.OBJECT))
1718 {
1719 d.data.OBJECT = nullptr;
1720 }
1721
1722 return (d.data.OBJECT != nullptr);
1723 }
1724 else if(d.type == OksData::list_type)
1725 {
1726 if (d.data.LIST)
1727 {
1728 for (OksData::List::iterator i = d.data.LIST->begin(); i != d.data.LIST->end();)
1729 {
1730 OksData * d2 = *i;
1731 if (d2->type == OksData::object_type)
1732 {
1733 if (d2->data.OBJECT == nullptr || kernel.is_dangling(d2->data.OBJECT))
1734 {
1735 i = d.data.LIST->erase(i);
1736 delete d2;
1737 continue;
1738 }
1739 }
1740 ++i;
1741 }
1742
1743 return (!d.data.LIST->empty());
1744 }
1745 else
1746 return false;
1747 }
1748
1749 return true;
1750}
bool is_dangling(OksClass *class_ptr) const
Check pointer on oks class.
Definition kernel.cpp:4638

◆ validate_init2range()

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

Definition at line 186 of file attribute.cpp.

187{
188 if (!a->get_range().empty() && a->get_data_type() != OksData::class_type)
189 {
190 try
191 {
192 OksData d;
193 d.set_init_value(a, false);
194 d.check_range(a);
195 }
196 catch (std::exception& ex)
197 {
198 std::ostringstream text;
199 text << "failed to set initial value \'" << a->get_init_value() << "\' of attribute \'" << a->get_name() << "\':\n" << ex.what();
200 throw std::runtime_error(text.str().c_str());
201 }
202 }
203}
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 46 of file exceptions.hpp.

46 {
47 if(value.empty()) throw_validate_not_empty(name);
48 }
void throw_validate_not_empty(const char *name)
Definition xml.cpp:44

Variable Documentation

◆ _empty_str

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

Definition at line 342 of file file.cpp.

◆ BindError

dunedaq::oks::BindError

Definition at line 134 of file kernel.cpp.

◆ OksProfilerFunctionsStr

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

Definition at line 9 of file profiler.cpp.

9 {
10 "OksKernel::Destructor",
11 "OksKernel::operator<<",
12 "OksKernel::load_schema",
13 "OksKernel::save_schema",
14 "OksKernel::close_schema",
15 "OksKernel::CreateSchemaClassList",
16 "OksKernel::load_data",
17 "OksKernel::save_data",
18 "OksKernel::close_data",
19 "OksKernel::CreateDataObjectList",
20 "OksKernel::is_danglingObject",
21 "OksKernel::is_danglingClass",
22 "OksObject::StreamConstructor",
23 "OksObject::NormalConstructor",
24 "OksObject::CopyConstructor",
25 "OksObject::Destructor",
26 "OksObject::operator==",
27 "OksObject::operator<<",
28 "OksObject::SatisfiesQueryExpression",
29 "OksObject::GetFreeObjectId",
30 "OksObject::PutObject",
31 "OksClass::Constructor",
32 "OksClass::Destructor",
33 "OksClass::operator<<",
34 "OksClass::GetObject",
35 "OksClass::execute_query",
36 "OksClass::RegistrateClass",
37 "OksClass::RegistrateClassChange",
38 "OksClass::RegistrateAttributeChange",
39 "OksClass::RegistrateRelationshipChange",
40 "OksClass::RegistrateInstances",
41 "OksClass::CreateSubClassesList",
42 "oksStringToQuery",
43 "oksStringToQueryExpression",
44 "OksQuery::operator<<"
45};

◆ s_get_cwd_mutex

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

Definition at line 52 of file kernel.cpp.

◆ s_git_folders

GitFoldersHolder dunedaq::oks::s_git_folders
static

Definition at line 110 of file kernel.cpp.