25#include <boost/date_time/gregorian/greg_date.hpp>
26#include <boost/date_time/posix_time/ptime.hpp>
27#include <boost/pool/pool_alloc.hpp>
29#include <unordered_map>
30#include <unordered_set>
47class OksQueryExpression;
49class OksXmlOutputStream;
50class OksXmlInputStream;
57 class QueryPathExpression;
78 static std::string
fill(
const OksObject * o,
const std::string& reason);
99 static std::string
fill(
const OksObject * o,
const std::string&
what,
const std::string& reason);
120 static std::string
fill(
const OksObject * o,
const std::string& reason);
142 static std::string
fill(
const OksObject * o,
const std::string& reason);
164 static std::string
fill(
const OksObject * o,
const std::string& reason);
211 static std::string
fill(
const char * value,
const char * type,
const std::string& reason);
212 static std::string
fill(
const char * type,
const std::string& reason);
234 static std::string
fill(
const OksObject * obj,
bool is_rel,
const std::string& name,
const std::string& reason);
256 static std::string
fill(
const OksObject * obj,
bool is_rel,
const std::string& name,
const std::string& reason);
278 static std::string
fill(
const OksObject * obj,
const std::string& why,
const std::string& reason);
292 exception (
fill(obj, rel, why, reason.what()), reason.level() + 1),
346 typedef std::map<std::string, OksDataInfo *>
Map;
378 OksString (
const std::string&s, std::string::size_type n) :
std::string(s,0,n) {;}
380 void *
operator new(size_t) {
return boost::fast_pool_allocator<OksString>::allocate();}
381 void operator delete(
void *ptr) {boost::fast_pool_allocator<OksString>::deallocate(
reinterpret_cast<OksString*
>(ptr));}
390 return ( *(
static_cast<const std::string *
>(&s1)) == *(
static_cast<const std::string *
>(&s2)) );
399 return ( *(
static_cast<const std::string *
>(&s1)) == s2 );
408 return (*(
static_cast<const std::string *
>(&s1)) == s2);
417 return ( *(
static_cast<const std::string *
>(&s1)) < *(
static_cast<const std::string *
>(&s2)) );
426 s << *(static_cast<const std::string *>(&str));
434 struct ReloadObjects;
435 struct ReadFileParams;
455 typedef std::list<OksData *, boost::fast_pool_allocator<OksData *> >
List;
616 boost::gregorian::date
date() const noexcept;
617 boost::posix_time::ptime time() const noexcept;
696 void*
operator new(size_t) {
return boost::fast_pool_allocator<OksData>::allocate();}
697 void operator delete(
void *ptr) {boost::fast_pool_allocator<OksData>::deallocate(
reinterpret_cast<OksData*
>(ptr));}
699 void sort(
bool ascending =
true);
742 const std::string&
__cn()
const;
770 void *
operator new(size_t) {
return boost::fast_pool_allocator<OksRCR>::allocate();}
771 void operator delete(
void *ptr) {boost::fast_pool_allocator<OksRCR>::deallocate(
reinterpret_cast<OksRCR*
>(ptr));}
781 return std::hash<std::string>()(*x);
787 inline bool operator()(
const std::string * __x,
const std::string * __y)
const {
788 return ((__x == __y) || (*__x == *__y));
795 return reinterpret_cast<size_t>(x);
809 return reinterpret_cast<size_t>(x);
820 typedef std::unordered_set<const OksClass *, oks::hash_class_ptr, oks::equal_class_ptr>
ClassSet;
853 bool operator() (
const std::string * s1,
const std::string * s2)
const {
860 typedef std::map<const std::string *, OksObject *, SortById>
SMap;
865 typedef std::unordered_map<const std::string *, OksObject *, oks::hash_str, oks::equal_str>
Map;
866 typedef std::unordered_set<OksObject *, oks::hash_obj_ptr, oks::equal_obj_ptr>
FSet;
871 typedef std::set<OksObject *, std::less<OksObject *> >
Set;
875 typedef std::list<OksObject *>
List;
877 typedef std::list<OksObject *, boost::fast_pool_allocator<OksObject *> >
FList;
895 OksObject (
const OksClass * oks_class,
const char * object_id = 0,
bool skip_init =
false);
960 void *
operator new(size_t) {
return boost::fast_pool_allocator<OksObject>::allocate();}
965 void operator delete(
void *ptr) {boost::fast_pool_allocator<OksObject>::deallocate(
reinterpret_cast<OksObject*
>(ptr));}
995 const std::string&
GetId()
const {
return uid.object_id;}
1008 void set_id(
const std::string &
id);
1270 void SetRelationshipValue(
const std::string& rel_name,
const std::string& class_name,
const std::string& object_id);
1286 void AddRelationshipValue(
const std::string& rel_name,
const std::string& class_name,
const std::string& object_i);
1302 void RemoveRelationshipValue(
const std::string& rel_name,
const std::string& class_name,
const std::string& object_i);
1380 bool is_consistent(
const std::set<OksFile *>&,
const char * msg)
const;
1450 OksObject (
OksClass * c,
const std::string&
id,
void * user_data, int32_t object_id, int32_t duplicated_object_id_idx,
OksFile * f);
1460 void init2(
bool skip_init =
false);
AddRcrError(const OksObject *obj, const std::string &name, const OksObject *p1, const OksObject *p2) noexcept
static std::string fill(const OksObject *obj, const std::string &name, const OksObject *p1, const OksObject *p2)
virtual ~AddRcrError() noexcept
static std::string fill(const OksData *d, const std::string &range)
AttributeRangeError(const OksData *d, const std::string &range) noexcept
virtual ~AttributeRangeError() noexcept
AttributeReadError(const char *type, const std::string &reason) noexcept
AttributeReadError(const char *value, const char *type, const std::string &reason) noexcept
virtual ~AttributeReadError() noexcept
static std::string fill(const char *type, const std::string &reason)
AttributeReadError(const char *type, const exception &reason) noexcept
static std::string fill(const char *value, const char *type, const std::string &reason)
AttributeReadError(const char *value, const char *type, const exception &reason) noexcept
FailedCreateObject(const OksObject *o, const exception &reason) noexcept
virtual ~FailedCreateObject() noexcept
FailedCreateObject(const OksObject *o, const std::string &reason) noexcept
static std::string fill(const OksObject *o, const std::string &reason)
virtual ~FailedDestoyObject() noexcept
FailedDestoyObject(const OksObject *o, const std::string &reason) noexcept
FailedDestoyObject(const OksObject *o, const exception &reason) noexcept
static std::string fill(const OksObject *o, const std::string &reason)
FailedReadObject(const OksObject *o, const std::string &what, const exception &reason) noexcept
FailedReadObject(const OksObject *o, const std::string &what, const std::string &reason) noexcept
virtual ~FailedReadObject() noexcept
static std::string fill(const OksObject *o, const std::string &what, const std::string &reason)
static std::string fill(const OksObject *o, const std::string &reason)
FailedRenameObject(const OksObject *o, const std::string &reason) noexcept
FailedRenameObject(const OksObject *o, const exception &reason) noexcept
virtual ~FailedRenameObject() noexcept
virtual ~FailedSaveObject() noexcept
static std::string fill(const OksObject *o, const std::string &reason)
FailedSaveObject(const OksObject *o, const exception &reason) noexcept
FailedSaveObject(const OksObject *o, const std::string &reason) noexcept
ObjectBindError(const OksObject *obj, const OksData *data, const OksRelationship *rel, bool is_error, const std::string &why, const exception &reason) noexcept
virtual ~ObjectBindError() noexcept
std::string fill(const OksObject *obj, const OksRelationship *rel, const std::string &why, const std::string &reason)
const OksRelationship * p_rel
ObjectBindError(const OksObject *obj, const OksData *data, const OksRelationship *rel, bool is_error, const std::string &why, const std::string &reason) noexcept
virtual ~ObjectGetError() noexcept
ObjectGetError(const OksObject *obj, bool is_rel, const std::string &name, const exception &reason) noexcept
ObjectGetError(const OksObject *obj, bool is_rel, const std::string &name, const std::string &reason) noexcept
static std::string fill(const OksObject *obj, bool is_rel, const std::string &name, const std::string &reason)
virtual ~ObjectInitError() noexcept
ObjectInitError(const OksObject *obj, const std::string &why, const std::string &reason) noexcept
ObjectInitError(const OksObject *obj, const std::string &why, const exception &reason) noexcept
static std::string fill(const OksObject *obj, const std::string &why, const std::string &reason)
ObjectSetError(const OksObject *obj, bool is_rel, const std::string &name, const std::string &reason) noexcept
virtual ~ObjectSetError() noexcept
ObjectSetError(const OksObject *obj, bool is_rel, const std::string &name, const exception &reason) noexcept
static std::string fill(const OksObject *obj, bool is_rel, const std::string &name, const std::string &reason)
Provides interface to the OKS XML schema and data files.
Provides interface to the OKS kernel.
OksObject describes instance of OksClass.
struct dunedaq::oks::OksObject::OksUid uid
bool operator!=(const OksObject &) const =delete
static void destroy(OksObject *obj, bool fast=false)
Destroy OKS object.
void AddRelationshipValue(const std::string &name, OksObject *object)
Add object value to multi-value relationship by name.
void RemoveRelationshipValue(const std::string &name, OksObject *object)
Remove object value from multi-value relationship by name.
void __report_type_cvt_warning(const oks::ReadFileParams &, const OksAttribute &, const OksData &, const OksData::Type, int32_t) const
void check_file_lock(const OksAttribute *, const OksRelationship *)
void put(OksXmlOutputStream &, bool force_defaults) const
std::list< OksRCR * > * p_rcr
const std::list< OksRCR * > * reverse_composite_rels() const
Return information about composite parents. The method returns list of the OKS object's reverse compo...
std::set< OksObject *, std::less< OksObject * > > Set
std::unordered_map< const std::string *, OksObject *, oks::hash_str, oks::equal_str > Map
std::list< OksObject * > List
OksData * GetRelationshipValue(const std::string &) const
Get value of relationship by name.
std::unordered_set< OksObject *, oks::hash_obj_ptr, oks::equal_obj_ptr > FSet
bool is_duplicated() const
void check_class_type(const OksRelationship *r, const OksObject *o)
static const char class2_xml_attribute[]
friend std::ostream & operator<<(std::ostream &out, const OksObject &obj)
Detailed stream operator.
static const char relationship_xml_tag[]
void references(OksObject::FSet &refs, unsigned long recursion_depth, bool add_self=false, oks::ClassSet *classes=0) const
OksFile * get_file() const
void init1(const OksFile *=0)
static const char attribute_xml_tag[]
static const char obj2_xml_tag[]
std::map< const std::string *, OksObject *, SortById > SMap
OksData * GetRelationshipValue(const OksDataInfo *i) const noexcept
Get value of relationship by offset.
static void put_object_attributes(OksXmlOutputStream &, const OksData &)
void __report_cardinality_cvt_warning(const oks::ReadFileParams &, const OksRelationship &) const
static const char value_xml_attribute[]
std::string report_dangling_references() const
void SetRelationshipValue(const std::string &name, OksData *data, bool skip_non_null_check=false)
Set value of relationship by name.
void read_body(const oks::ReadFileParams &, bool)
int32_t __get_num(const oks::ReadFileParams ¶ms)
void add_RCR(OksObject *, const OksRelationship *)
void check_class_type(const OksRelationship *, const OksClass *)
static const char id_xml_attribute[]
void set_file(OksFile *file, bool update_owner=true)
Move object to different file.
bool satisfies(const OksObject *goal, const oks::QueryPathExpression &expresssion, OksObject::List &path) const
OksObject & operator=(const OksObject &)
static const char obj_xml_tag[]
static OksObject * read(const oks::ReadFileParams &)
FList * get_all_rels(const std::string &name="*") const
Return objects referencing this one via relationship with given name.
void * GetTransientData() const
Get transient user data associated with given object. Return data set using SetTransientData() method...
void check_non_null(const OksRelationship *, const OksObject *)
void unbind_file(const OksFile *)
OksObject(const OksClass *oks_class, const char *object_id=0, bool skip_init=false)
OKS object constructor.
static const char id2_xml_attribute[]
static const char num_xml_attribute[]
const OksClass * GetClass() const
static bool are_equal_fast(const OksObject *o1, const OksObject *o2)
The fast equal method.
static const char class_xml_attribute[]
static void bind(OksData *, const BindInfo &)
OksObject::List * find_path(const oks::QueryPath &query) const
void set_int32_id(int32_t object_id)
Set object id is used to assign an object unique integer number. Such data are not stored on file and...
static const char name_xml_attribute[]
void set_id(const std::string &id)
Set object ID.
void remove_RCR(OksObject *, const OksRelationship *) noexcept
static const char type_xml_attribute[]
notify_obj get_change_notify() const
static const char data_xml_tag[]
void init2(bool skip_init=false)
bool is_consistent(const std::set< OksFile * > &, const char *msg) const
void SetAttributeValue(const std::string &name, OksData *data)
Set value of attribute by name.
bool check_links_and_report(const OksObject *, const std::set< OksFile * > &, const std::string &, const char *) const
void(*) notify_obj(OksObject *, void *)
bool SatisfiesQueryExpression(OksQueryExpression *query_exp) const
Check if object satisfies query expression.
std::list< OksObject *, boost::fast_pool_allocator< OksObject * > > FList
bool operator==(const OksObject &) const
The equality operator.
OksData * GetAttributeValue(const OksDataInfo *i) const noexcept
Get value of attribute by offset.
void SetTransientData(void *d) const
Set transient user data associated with given object. Such data are not stored on file and only exist...
static const char ref_xml_tag[]
const std::string & GetId() const
int32_t get_int32_id() const
Get object id associated with given object. Return integer number set using set_int32_id() method.
int32_t p_duplicated_object_id_idx
OksData * GetAttributeValue(const std::string &name) const
Get value of attribute by name.
OKS query expression class.
OksString()
to deallocate memory when destroyed
OksString(const std::string &s, std::string::size_type n)
OksString(const char *s, size_t n)
OksString(const std::string &s)
virtual const char * what() const noexcept
caught dunedaq::conffwk::Exception exception
bool operator<(const OksString &s1, const OksString &s2)
Implementation of OksString logical less operator.
bool operator==(const OksString &s1, const OksString &s2)
Implementation of OksString logical equality operator.
std::ostream & operator<<(std::ostream &s, const oks::exception &ex)
std::unordered_set< const OksClass *, oks::hash_class_ptr, oks::equal_class_ptr > ClassSet
DAC value out of range
Message.
FELIX Initialization std::string initerror FELIX queue timed out
The struct OksAliasTable is used to support aliases.
Struct OKS data information.
OksDataInfo(size_t o, const OksRelationship *r)
std::map< std::string, OksDataInfo * > Map
Declare map of pointers to OksDataInfo (unsorted by name)
OksDataInfo(size_t o, const OksAttribute *a)
Constructors.
const OksAttribute * attribute
const OksRelationship * relationship
the structure to pass common parameters to various read() methods of OksData and OksObject class
OksData(const OksClass *c, const OksString &o)
void Set(const OksClass *c, const OksString &s)
OksData(const OksRelationship *r, const oks::ReadFileParams ¶ms)
void sort(bool ascending=true)
OksData(boost::gregorian::date d)
OksData(const oks::ReadFileParams ¶ms, const OksRelationship *r)
void SetNullValue(const OksAttribute *a)
friend std::ostream & operator<<(std::ostream &, const OksData &)
std::string str(int base=0) const
void cvt(OksData *to, const OksAttribute *attr) const
Convert data to new type.
void Set(const OksString &c, const OksString &s)
void WriteTo(OksXmlOutputStream &, OksKernel *, OksAliasTable *, bool, bool) const
void read(const OksAttribute *, const oks::ReadFileParams &)
union dunedaq::oks::OksData::Data data
boost::gregorian::date date() const noexcept
void Set(boost::gregorian::date d)
void copy(const OksData &)
OksData(const OksData &d)
void read(const OksRelationship *, const OksXmlRelValue &)
OksData(const OksAttribute *a, const oks::ReadFileParams ¶ms)
void Set(const OksClass *c, OksString *s)
void Set(const double &d)
std::list< OksData *, boost::fast_pool_allocator< OksData * > > List
bool operator>=(const OksData &) const
void read(const OksRelationship *, const oks::ReadFileParams &)
void SetE(OksString *s, const OksAttribute *a)
OksData(const OksString &s)
void Set(boost::posix_time::ptime t)
void read(const oks::ReadFileParams &, const OksRelationship *)
OksData(const oks::ReadFileParams ¶ms, const OksAttribute *a, int32_t n)
void SetValue(const char *s, const OksAttribute *a)
void read(const oks::ReadFileParams &, const OksAttribute *)
OksData(const OksClass *c)
void read(const oks::ReadFileParams &, const OksAttribute *, int32_t)
private methods which can be used by OksObject class only
void read(const OksAttribute *, const OksXmlValue &)
void read(const oks::ReadFileParams &, const OksRelationship *, int32_t)
OksData(const OksClass *c, const char *o)
void WriteTo(OksXmlOutputStream &, bool) const
void Set(const OksClass *c)
const std::string & __oid() const
bool is_g(const OksData &) const noexcept
bool operator>(const OksData &) const
OksData(const oks::ReadFileParams ¶ms, const OksAttribute *a)
const std::string & __cn() const
void SetValues(const char *, const OksAttribute *a)
OksData(const std::string &c, const std::string &o)
enum dunedaq::oks::OksData::Type type
void Set(const OksString &s)
void Set(OksString *c, OksString *s)
void ConvertTo(OksData *, const OksRelationship *) const
void Set(const std::string &s)
static bool is_object(Type t)
OksData(const char *s, size_t len, const OksAttribute *a)
OksData(const OksRelationship *r, const OksXmlRelValue &value)
void SetFast(boost::posix_time::ptime t)
void check_range(const OksAttribute *a) const
Check range of data.
void set_init_value(const OksAttribute *attr, bool skip_init)
Set value defined by initial value of attribute.
void SetFast(boost::gregorian::date d)
bool operator!=(const OksData &) const
OksData(const oks::ReadFileParams ¶ms, const OksRelationship *r, int32_t n)
bool operator==(const OksData &) const
bool is_le(const OksData &) const noexcept
OksData(const OksString &s, const OksAttribute *a)
OksData(const std::string &s, const OksAttribute *a)
bool IsConsistent(const OksRelationship *r, const OksObject *o, const char *msg)
OksData(const std::string &s)
void ReadFrom(const OksRelationship *) noexcept
void WriteTo(OksXmlOutputStream &) const
void ReadFrom(const char *, Type, const OksAttribute *)
bool is_l(const OksData &) const noexcept
bool is_ge(const OksData &) const noexcept
OksData(const OksAttribute *a, const OksXmlValue &value)
OksData(boost::posix_time::ptime t)
bool operator<=(const OksData &) const
bool operator<(const OksData &) const
const OksClass * class_id
bool operator()(const std::string *s1, const std::string *s2) const
The struct OksRCR describes Reverse Composite Relationship (i.e. back reference from child to composi...
OksRCR(OksObject *o, const OksRelationship *r)
const OksRelationship * relationship
bool operator()(const OksClass *__x, const OksClass *__y) const
bool operator()(const OksObject *__x, const OksObject *__y) const
bool operator()(const std::string *__x, const std::string *__y) const
size_t operator()(const OksClass *x) const
size_t operator()(const OksObject *x) const
size_t operator()(const std::string *x) const
const OksClass * class_id
struct dunedaq::oks::OksData::Data::@165 UID
struct dunedaq::oks::OksData::Data::@166 UID2
const std::string * ENUMERATION