DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::conffwk::attribute_t Struct Reference

#include <Schema.hpp>

Public Member Functions

 attribute_t (const std::string &name, type_t type, const std::string &range, int_format_t int_format, bool is_not_null, bool is_multi_value, const std::string &default_value, const std::string &description)
 
 attribute_t ()
 
void print (std::ostream &out, const std::string &prefix="") const
 

Static Public Member Functions

static const char * type2str (type_t type)
 
static const char * type (type_t type)
 
static const char * format2str (int_format_t format)
 

Public Attributes

std::string p_name
 
type_t p_type
 
std::string p_range
 
int_format_t p_int_format
 
bool p_is_not_null
 
bool p_is_multi_value
 
std::string p_default_value
 
std::string p_description
 

Detailed Description

The description of attribute.

Definition at line 52 of file Schema.hpp.

Constructor & Destructor Documentation

◆ attribute_t() [1/2]

dunedaq::conffwk::attribute_t::attribute_t ( const std::string & name,
type_t type,
const std::string & range,
int_format_t int_format,
bool is_not_null,
bool is_multi_value,
const std::string & default_value,
const std::string & description )

Create attribute description

Definition at line 12 of file ConfigurationImpl.cpp.

16 :
17 p_name (name),
18 p_type (type),
19 p_range (range),
20 p_int_format (int_format),
21 p_is_not_null (is_not_null),
22 p_is_multi_value (is_multi_value),
23 p_default_value (default_value),
24 p_description (description)
25 { ; }
DAC value out of range
Message.
Definition DACNode.hpp:32

◆ attribute_t() [2/2]

dunedaq::conffwk::attribute_t::attribute_t ( )
inline

Default constructor for Python binding

Definition at line 79 of file Schema.hpp.

79{ ; }

Member Function Documentation

◆ format2str()

const char * dunedaq::conffwk::attribute_t::format2str ( int_format_t format)
static

Return string corresponding to given integer value representation format

Parameters
formatthe integer value representation format

Definition at line 73 of file ConfigurationImpl.cpp.

74 {
75 switch(type) {
76 case oct_int_format: return "octal";
77 case dec_int_format: return "decimal";
78 case hex_int_format: return "hexadecimal";
79 default: return "not applicable";
80 }
81 }

◆ print()

void dunedaq::conffwk::attribute_t::print ( std::ostream & out,
const std::string & prefix = "" ) const

Print description of attribute to stream.

Parameters
outthe output stream
prefixoptional shift output using prefix

Definition at line 83 of file ConfigurationImpl.cpp.

84 {
85 out
86 << prefix << "attribute \'" << p_name << "\'\n"
87 << prefix << " type: \'" << type2str(p_type) << "\'\n"
88 << prefix << " range: \'" << p_range << "\'\n";
89
91 out << prefix << " integer format: \'" << format2str(p_int_format) << "\'\n";
92 }
93
94 out
95 << prefix << " is not null: " << bool2str(p_is_not_null) << '\n'
96 << prefix << " is multi-value: " << bool2str(p_is_multi_value) << '\n'
97 << prefix << " default value: \'" << p_default_value << "\'\n"
98 << prefix << " description: \'" << p_description << '\'';
99 }
const char * bool2str(bool value)
FELIX Initialization std::string initerror FELIX queue timed out
static const char * type2str(type_t type)
static const char * format2str(int_format_t format)

◆ type()

const char * dunedaq::conffwk::attribute_t::type ( type_t type)
static

Return short string (oks data type) corresponding to given data type

Parameters
typethe data type

Definition at line 50 of file ConfigurationImpl.cpp.

51 {
52 switch(type) {
53 case bool_type: return "bool";
54 case s8_type: return "s8";
55 case u8_type: return "u8";
56 case s16_type: return "s16";
57 case u16_type: return "u16";
58 case s32_type: return "s32";
59 case u32_type: return "u32";
60 case s64_type: return "s64";
61 case u64_type: return "u64";
62 case float_type: return "float";
63 case double_type: return "double";
64 case date_type: return "date";
65 case time_type: return "time";
66 case string_type: return "string";
67 case enum_type: return "enum";
68 case class_type: return "class";
69 default: return "unknown";
70 }
71 }

◆ type2str()

const char * dunedaq::conffwk::attribute_t::type2str ( type_t type)
static

Return string corresponding to given data type

Parameters
typethe data type

Definition at line 27 of file ConfigurationImpl.cpp.

28 {
29 switch(type) {
30 case bool_type: return "boolean";
31 case s8_type: return "8-bits signed integer";
32 case u8_type: return "8-bits unsigned integer";
33 case s16_type: return "16-bits signed integer";
34 case u16_type: return "16-bits unsigned integer";
35 case s32_type: return "32-bits signed integer";
36 case u32_type: return "32-bits unsigned integer";
37 case s64_type: return "64-bits signed integer";
38 case u64_type: return "64-bits unsigned integer";
39 case float_type: return "float";
40 case double_type: return "double";
41 case date_type: return "date";
42 case time_type: return "time";
43 case string_type: return "string";
44 case enum_type: return "enumeration";
45 case class_type: return "class reference";
46 default: return "unknown";
47 }
48 }

Member Data Documentation

◆ p_default_value

std::string dunedaq::conffwk::attribute_t::p_default_value

the default value of attribute

Definition at line 60 of file Schema.hpp.

◆ p_description

std::string dunedaq::conffwk::attribute_t::p_description

the description text of attribute

Definition at line 61 of file Schema.hpp.

◆ p_int_format

int_format_t dunedaq::conffwk::attribute_t::p_int_format

the representation format for integer values

Definition at line 57 of file Schema.hpp.

◆ p_is_multi_value

bool dunedaq::conffwk::attribute_t::p_is_multi_value

if true, the value of attribute is a list of primitive values (e.g. list of strings, list of integer numbers, etc.)

Definition at line 59 of file Schema.hpp.

◆ p_is_not_null

bool dunedaq::conffwk::attribute_t::p_is_not_null

if true, the value of attribute cannot be null

Definition at line 58 of file Schema.hpp.

◆ p_name

std::string dunedaq::conffwk::attribute_t::p_name

the attribute name

Definition at line 54 of file Schema.hpp.

◆ p_range

std::string dunedaq::conffwk::attribute_t::p_range

the attribute range in UML syntax (e.g.: "A,B,C..D,*..F,G..*" => value can be A, B, greater or equal to C and less or equal to D, less or equal to F, greater or equal to G)

Definition at line 56 of file Schema.hpp.

◆ p_type

type_t dunedaq::conffwk::attribute_t::p_type

the attribute type

Definition at line 55 of file Schema.hpp.


The documentation for this struct was generated from the following files: