DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
#include <relationship.hpp>
Public Types | |
enum | CardinalityConstraint { Zero , One , Many } |
Public Member Functions | |
OksRelationship (const std::string &name, OksClass *p=nullptr) | |
OKS relationship simple constructor. | |
OksRelationship (const std::string &name, const std::string &type, CardinalityConstraint low_cc, CardinalityConstraint high_cc, bool composite, bool exclusive, bool dependent, const std::string &description, OksClass *p=nullptr) | |
OKS relationship complete constructor. | |
bool | operator== (const class OksRelationship &) const |
const std::string & | get_name () const noexcept |
void | set_name (const std::string &) |
Set relationship name. | |
OksClass * | get_class_type () const noexcept |
const std::string & | get_type () const noexcept |
void | set_type (const std::string &type) |
Set relationship type. | |
const std::string & | get_description () const noexcept |
void | set_description (const std::string &description) |
Set relationship description. | |
CardinalityConstraint | get_low_cardinality_constraint () const noexcept |
Get relationship low cardinality constraint. | |
void | set_low_cardinality_constraint (CardinalityConstraint cc) |
Set relationship low cardinality constraint. | |
CardinalityConstraint | get_high_cardinality_constraint () const noexcept |
Get relationship high cardinality constraint. | |
void | set_high_cardinality_constraint (CardinalityConstraint) |
Set relationship high cardinality constraint. | |
bool | get_is_composite () const noexcept |
void | set_is_composite (bool composite) |
Set the composite relationship property. | |
bool | get_is_exclusive () const noexcept |
void | set_is_exclusive (bool exclusive) |
Set the composite relationship exclusive property. | |
bool | get_is_dependent () const noexcept |
void | set_is_dependent (bool dependent) |
Set the composite relationship dependent property. | |
Static Public Member Functions | |
static CardinalityConstraint | str2card (const char *) noexcept |
static const char * | card2str (CardinalityConstraint) noexcept |
Private Member Functions | |
OksRelationship (OksXmlInputStream &, OksClass *) | |
void | save (OksXmlOutputStream &) const |
private constructor from XML stream | |
Private Attributes | |
std::string | p_name |
std::string | p_rclass |
CardinalityConstraint | p_low_cc |
CardinalityConstraint | p_high_cc |
bool | p_composite |
bool | p_exclusive |
bool | p_dependent |
std::string | p_description |
OksClass * | p_class |
OksClass * | p_class_type |
bool | p_ordered |
Static Private Attributes | |
static const char | relationship_xml_tag [] = "relationship" |
private method to save in XML stream | |
static const char | name_xml_attr [] = "name" |
static const char | description_xml_attr [] = "description" |
static const char | class_type_xml_attr [] = "class-type" |
static const char | low_cc_xml_attr [] = "low-cc" |
static const char | high_cc_xml_attr [] = "high-cc" |
static const char | is_composite_xml_attr [] = "is-composite" |
static const char | is_exclusive_xml_attr [] = "is-exclusive" |
static const char | is_dependent_xml_attr [] = "is-dependent" |
static const char | mv_implement_xml_attr [] |
static const char | ordered_xml_attr [] = "ordered" |
Friends | |
class | OksKernel |
class | OksClass |
struct | OksData |
class | OksObject |
std::ostream & | operator<< (std::ostream &s, const OksRelationship &r) |
@ingroup oks \brief OKS relationship class. The class implements OKS relationship that is a part of an OKS class. A relationship has name, class type and description. A relationship is [zero|one]-to-one or [zero|one]-to-many. There are two basic types of OKS relationships: - \b weak or \b general reference (relationship): default reference between two objects, it carries no special semantic; - \b strong or \b composite reference (relationship): the objects connected by composite references are considered as a whole object. A composite reference may be exclusive or shared (an exclusive object is component of only one object, a shared object may be referenced by more than one object). As well a composite reference can be dependent or independent. The existence of object, referenced thought dependent composite reference, is dependent from existence of their composite parents. The deleting of all composite parents results the deleting of their composite dependent child objects (i.e. reference count is zero). \paragraph ex Example The following code:
produces:
Definition at line 93 of file relationship.hpp.
Valid cardinality constraint types
Enumerator | |
---|---|
Zero | |
One | |
Many |
Definition at line 107 of file relationship.hpp.
dunedaq::oks::OksRelationship::OksRelationship | ( | const std::string & | name, |
OksClass * | p = nullptr ) |
OKS relationship simple constructor.
Create new OKS relationship providing name.
The parameter is:
name | name of the attribute |
p | containing parent class |
oks::exception | is thrown in case of problems. |
Definition at line 46 of file relationship.cpp.
dunedaq::oks::OksRelationship::OksRelationship | ( | const std::string & | name, |
const std::string & | type, | ||
CardinalityConstraint | low_cc, | ||
CardinalityConstraint | high_cc, | ||
bool | composite, | ||
bool | exclusive, | ||
bool | dependent, | ||
const std::string & | description, | ||
OksClass * | p = nullptr ) |
OKS relationship complete constructor.
Create new OKS relationship providing all properties.
The parameters are:
name | name of the attribute (max 128 bytes, see #s_max_name_length variable) |
type | class type of relationship (i.e. name of existing OKS class) |
low_cc | lowest possible number of objects linked via this relationship ("zero" or "one") |
high_cc | highest possible number of objects linked via this relationship ("one" or "many") |
composite | if true, set strong dependency on children objects |
exclusive | if true, guaranty unique reference on children objects via such relationship by any object |
dependent | if true, existence of children objects depends on existence of parent |
description | description of the method (max 2000 bytes, see #s_max_description_length variable) |
p | containing parent class |
oks::exception | is thrown in case of problems. |
Definition at line 60 of file relationship.cpp.
|
private |
To be used by OksClass only
Definition at line 141 of file relationship.cpp.
|
staticnoexcept |
Helper method to convert cardinality constraint to string
Definition at line 37 of file relationship.cpp.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Get relationship high cardinality constraint.
See set_high_cardinality_constraint() for more information.
Definition at line 258 of file relationship.hpp.
|
inlinenoexcept |
Returns the true, if relationship is composite and false, if not.
Definition at line 278 of file relationship.hpp.
|
inlinenoexcept |
Returns the true, if relationship is dependent and false, if not.
Definition at line 329 of file relationship.hpp.
|
inlinenoexcept |
Returns the true, if relationship is exclusive and false, if not.
Definition at line 310 of file relationship.hpp.
|
inlinenoexcept |
Get relationship low cardinality constraint.
See set_low_cardinality_constraint() for more information.
Definition at line 232 of file relationship.hpp.
|
inlinenoexcept |
|
inlinenoexcept |
bool dunedaq::oks::OksRelationship::operator== | ( | const class OksRelationship & | r | ) | const |
Definition at line 80 of file relationship.cpp.
|
private |
private constructor from XML stream
Definition at line 116 of file relationship.cpp.
void dunedaq::oks::OksRelationship::set_description | ( | const std::string & | description | ) |
Set relationship description.
description | new description of relationship (max 2000 bytes, see #s_max_description_length variable) |
In case of problems the oks::exception is thrown.
Definition at line 279 of file relationship.cpp.
void dunedaq::oks::OksRelationship::set_high_cardinality_constraint | ( | CardinalityConstraint | h_cc | ) |
Set relationship high cardinality constraint.
The high cardinality constraint defiles highest possible number of objects linked via this relationship. It must be OksRelationship::One or OksRelationship::Many.
cc | the high cardinality constraint |
In case of problems the oks::exception is thrown.
Definition at line 309 of file relationship.cpp.
void dunedaq::oks::OksRelationship::set_is_composite | ( | bool | composite | ) |
Set the composite relationship property.
If relationship is composite, the parent object sets strong references on children objects and it is considered as composite or compound object.
The composite relationships are presented in a special way (as a diamond) by the OKS data editor graphical views, e.g. document is compound of sections:
Also, the oksdalgen package generates print() method of data access library in a different way depending on the composite relationship state:
composite | pass true to make relationship composite |
In case of problems the oks::exception is thrown.
Definition at line 327 of file relationship.cpp.
void dunedaq::oks::OksRelationship::set_is_dependent | ( | bool | dependent | ) |
Set the composite relationship dependent property.
If relationship is dependent, the child object will be removed when its parent object is removed and the child is not referenced by another parents via dependent composite relationships.
dependent | pass true to make relationship dependent |
In case of problems the oks::exception is thrown.
Definition at line 351 of file relationship.cpp.
void dunedaq::oks::OksRelationship::set_is_exclusive | ( | bool | exclusive | ) |
Set the composite relationship exclusive property.
If relationship is exclusive, the child object can only be referenced by single parent via given relationship.
exclusive | pass true to make relationship exclusive |
In case of problems the oks::exception is thrown.
Definition at line 339 of file relationship.cpp.
void dunedaq::oks::OksRelationship::set_low_cardinality_constraint | ( | CardinalityConstraint | cc | ) |
Set relationship low cardinality constraint.
The low cardinality constraint defiles lowest possible number of objects linked via this relationship. It must be OksRelationship::Zero or OksRelationship::One.
cc | the low cardinality constraint |
In case of problems the oks::exception is thrown.
Definition at line 291 of file relationship.cpp.
void dunedaq::oks::OksRelationship::set_name | ( | const std::string & | new_name | ) |
Set relationship name.
Relationships linked with the same class shall have different names.
name | new name of relationship (max 128 bytes, see #s_max_name_length variable) |
In case of problems the oks::exception is thrown.
Definition at line 201 of file relationship.cpp.
void dunedaq::oks::OksRelationship::set_type | ( | const std::string & | type | ) |
Set relationship type.
The type is a name of existing OKS class. The value of relationship can point on objects of that class or any objects of classes derived from this one.
type | new type of relationship |
In case of problems the oks::exception is thrown.
Definition at line 257 of file relationship.cpp.
|
staticnoexcept |
Helper method to convert valid string to cardinality constraint
Definition at line 27 of file relationship.cpp.
|
friend |
Definition at line 96 of file relationship.hpp.
|
friend |
Definition at line 97 of file relationship.hpp.
|
friend |
Definition at line 95 of file relationship.hpp.
|
friend |
Definition at line 98 of file relationship.hpp.
|
friend |
Definition at line 98 of file relationship.cpp.
|
staticprivate |
Definition at line 388 of file relationship.hpp.
|
staticprivate |
Definition at line 387 of file relationship.hpp.
|
staticprivate |
Definition at line 390 of file relationship.hpp.
|
staticprivate |
Definition at line 391 of file relationship.hpp.
|
staticprivate |
Definition at line 393 of file relationship.hpp.
|
staticprivate |
Definition at line 392 of file relationship.hpp.
|
staticprivate |
Definition at line 389 of file relationship.hpp.
|
staticprivate |
Definition at line 394 of file relationship.hpp.
|
staticprivate |
Definition at line 386 of file relationship.hpp.
|
staticprivate |
Definition at line 395 of file relationship.hpp.
|
private |
Definition at line 367 of file relationship.hpp.
|
private |
Definition at line 368 of file relationship.hpp.
|
private |
Definition at line 363 of file relationship.hpp.
|
private |
Definition at line 365 of file relationship.hpp.
|
private |
Definition at line 366 of file relationship.hpp.
|
private |
Definition at line 364 of file relationship.hpp.
|
private |
Definition at line 362 of file relationship.hpp.
|
private |
Definition at line 361 of file relationship.hpp.
|
private |
Definition at line 359 of file relationship.hpp.
|
private |
Definition at line 369 of file relationship.hpp.
|
private |
Definition at line 360 of file relationship.hpp.
|
staticprivate |
private method to save in XML stream
Valid xml tags and attributes
Definition at line 385 of file relationship.hpp.