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 59 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 23 of file ConfigurationImpl.cpp.

31 : p_name(name)
32 , p_type(type)
33 , p_range(range)
34 , p_int_format(int_format)
35 , p_is_not_null(is_not_null)
36 , p_is_multi_value(is_multi_value)
37 , p_default_value(default_value)
38 , p_description(description)
39{
40 ;
41}
DAC value out of range
Message.
Definition DACNode.hpp:32
static const char * type(type_t type)

◆ attribute_t() [2/2]

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

Default constructor for Python binding

Definition at line 86 of file Schema.hpp.

86{ ; }

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 126 of file ConfigurationImpl.cpp.

127{
128 switch (type) {
129 case oct_int_format:
130 return "octal";
131 case dec_int_format:
132 return "decimal";
133 case hex_int_format:
134 return "hexadecimal";
135 default:
136 return "not applicable";
137 }
138}

◆ 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 141 of file ConfigurationImpl.cpp.

142{
143 out << prefix << "attribute \'" << p_name << "\'\n"
144 << prefix << " type: \'" << type2str(p_type) << "\'\n"
145 << prefix << " range: \'" << p_range << "\'\n";
146
148 out << prefix << " integer format: \'" << format2str(p_int_format) << "\'\n";
149 }
150
151 out << prefix << " is not null: " << bool2str(p_is_not_null) << '\n'
152 << prefix << " is multi-value: " << bool2str(p_is_multi_value) << '\n'
153 << prefix << " default value: \'" << p_default_value << "\'\n"
154 << prefix << " description: \'" << p_description << '\'';
155}
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 85 of file ConfigurationImpl.cpp.

86{
87 switch (type) {
88 case bool_type:
89 return "bool";
90 case s8_type:
91 return "s8";
92 case u8_type:
93 return "u8";
94 case s16_type:
95 return "s16";
96 case u16_type:
97 return "u16";
98 case s32_type:
99 return "s32";
100 case u32_type:
101 return "u32";
102 case s64_type:
103 return "s64";
104 case u64_type:
105 return "u64";
106 case float_type:
107 return "float";
108 case double_type:
109 return "double";
110 case date_type:
111 return "date";
112 case time_type:
113 return "time";
114 case string_type:
115 return "string";
116 case enum_type:
117 return "enum";
118 case class_type:
119 return "class";
120 default:
121 return "unknown";
122 }
123}

◆ 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 44 of file ConfigurationImpl.cpp.

45{
46 switch (type) {
47 case bool_type:
48 return "boolean";
49 case s8_type:
50 return "8-bits signed integer";
51 case u8_type:
52 return "8-bits unsigned integer";
53 case s16_type:
54 return "16-bits signed integer";
55 case u16_type:
56 return "16-bits unsigned integer";
57 case s32_type:
58 return "32-bits signed integer";
59 case u32_type:
60 return "32-bits unsigned integer";
61 case s64_type:
62 return "64-bits signed integer";
63 case u64_type:
64 return "64-bits unsigned integer";
65 case float_type:
66 return "float";
67 case double_type:
68 return "double";
69 case date_type:
70 return "date";
71 case time_type:
72 return "time";
73 case string_type:
74 return "string";
75 case enum_type:
76 return "enumeration";
77 case class_type:
78 return "class reference";
79 default:
80 return "unknown";
81 }
82}

Member Data Documentation

◆ p_default_value

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

the default value of attribute

Definition at line 70 of file Schema.hpp.

◆ p_description

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

the description text of attribute

Definition at line 71 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 66 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 68 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 67 of file Schema.hpp.

◆ p_name

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

the attribute name

Definition at line 62 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 64 of file Schema.hpp.

◆ p_type

type_t dunedaq::conffwk::attribute_t::p_type

the attribute type

Definition at line 63 of file Schema.hpp.


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