ATLAS Offline Software
Loading...
Searching...
No Matches
L1TopoConfigAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef L1TOPOCONFIG_L1TOPOCONFIGALG_H
6#define L1TOPOCONFIG_L1TOPOCONFIGALG_H
7
8#include <iostream>
9#include <vector>
10#include <string>
11
12namespace TXC {
13 class L1TopoConfigAlg;
14}
15
16namespace TXC {
17
18std::ostream & operator<<(std::ostream &, const TXC::L1TopoConfigAlg &);
19
20 struct InputElement {
21 InputElement(const std::string & name, const std::string & value, unsigned int position) :
23 std::string name {""};
24 std::string value {""};
25 unsigned int position {0};
26 };
27
29 OutputElement(const std::string & name, const std::string & value, unsigned int bits, const std::string & outname, unsigned int position) :
31 std::string name {""};
32 std::string value {""};
33 unsigned int nbits {0};
34 std::string outname {""};
35 unsigned int position {0};
36 };
37
39 FixedParameter(const std::string & name, const std::string & value) :
40 name(name), value(value) {}
41 std::string name {""};
42 std::string value {""};
43 };
44
46 RegisterParameter(const std::string & name, const std::string & value, unsigned int position, unsigned int selection) :
48 std::string name {""};
49 std::string value {""};
50 unsigned int position {0};
51 unsigned int selection {0};
52 };
53
54
55
57 public:
58
59 enum AlgKind { NONE = 0, SORT = 1, DECISION = 2 };
60
61 // default constructor
62 L1TopoConfigAlg(const std::string & name, const std::string & type);
63
64 // move constructor
65 L1TopoConfigAlg(L1TopoConfigAlg&&) noexcept = default;
66 L1TopoConfigAlg& operator=(L1TopoConfigAlg&&) noexcept = default;
67
68 // destructor
69 virtual ~L1TopoConfigAlg();
70
71 // accessors for algo
72 const std::string & name() const { return m_name; }
73 unsigned int algoID() const { return m_algoID; }
74 std::string fullname() const;
75
76 const std::string & type() const { return m_type; }
77 const std::string & output() const { return m_output; }
78 bool isSortAlg() const { return m_kind == SORT; }
79 bool isDecAlg() const { return m_kind == DECISION; }
80
81 // accessors for algo inputs
82 const std::vector<InputElement> & getInputs() const { return m_inputElements; }
83 std::vector<std::string> getInputNames() const;
84
85 // accessors for algo outputs
86 const std::vector<OutputElement> & getOutputs() const { return m_outputElements; }
87 std::vector<std::string> getOutputNames() const;
88
89 // accessors for fixed paramters (those which can not be changed through registers)
90 const std::vector<FixedParameter> & getFixedParameters() const { return m_fixedParameters; }
91
92 // accessors for algo parameters
93 const std::vector<RegisterParameter> & getParameters() const { return m_variableParameters; }
94
95
96 // algorithm setters
97 void setAlgName(const std::string & name) { m_name = name; }
98 void setAlgType(const std::string & type) { m_type = type; }
99 void setAlgOutput(const std::string & output) { m_output = output; }
100 void setAlgoID( unsigned int algoID) { m_algoID = algoID; }
101 void setAlgKind(AlgKind kind) { m_kind = kind; }
102
103 // algorithm parameter setters
104 void addInput(const std::string & name, const std::string &value, unsigned int position);
105 void addOutput(const std::string &name, const std::string &value, unsigned int bits, const std::string & outname, unsigned int position);
106 void addFixedParameter(const std::string &name, const std::string &value);
107 void addParameter(const std::string &name, const std::string &value, unsigned int position, unsigned int selection);
108
109 private:
110
112
113 friend std::ostream & operator<<(std::ostream &, const TXC::L1TopoConfigAlg &);
114
115 // algorithm attributes
116 std::string m_name {""};
117 std::string m_type {""};
118 std::string m_output {""};
119 unsigned int m_algoID {0};
121
122 // parameter attributes
123 std::vector<TXC::InputElement> m_inputElements;
124 std::vector<TXC::OutputElement> m_outputElements;
125 std::vector<TXC::FixedParameter> m_fixedParameters;
126 std::vector<TXC::RegisterParameter> m_variableParameters;
127
128 };
129
130std::ostream & operator<<(std::ostream &, const InputElement&);
131std::ostream & operator<<(std::ostream &, const OutputElement&);
132std::ostream & operator<<(std::ostream &, const FixedParameter&);
133std::ostream & operator<<(std::ostream &, const RegisterParameter&);
134
135}
136
137
138#endif /* defined(L1TOPOCONFIG_L1TOPOCONFIGALG_H) */
unsigned int algoID() const
void setAlgOutput(const std::string &output)
L1TopoConfigAlg(L1TopoConfigAlg &&) noexcept=default
void addFixedParameter(const std::string &name, const std::string &value)
const std::string & name() const
std::vector< TXC::FixedParameter > m_fixedParameters
std::vector< std::string > getOutputNames() const
const std::vector< FixedParameter > & getFixedParameters() const
void addOutput(const std::string &name, const std::string &value, unsigned int bits, const std::string &outname, unsigned int position)
void addInput(const std::string &name, const std::string &value, unsigned int position)
std::vector< TXC::InputElement > m_inputElements
std::string fullname() const
friend std::ostream & operator<<(std::ostream &, const TXC::L1TopoConfigAlg &)
const std::vector< OutputElement > & getOutputs() const
void setAlgName(const std::string &name)
std::vector< TXC::RegisterParameter > m_variableParameters
std::vector< std::string > getInputNames() const
const std::string & type() const
const std::vector< InputElement > & getInputs() const
void setAlgKind(AlgKind kind)
void setAlgoID(unsigned int algoID)
L1TopoConfigAlg(const std::string &name, const std::string &type)
class L1TopoConfigAlg
void setAlgType(const std::string &type)
const std::vector< RegisterParameter > & getParameters() const
std::vector< TXC::OutputElement > m_outputElements
void addParameter(const std::string &name, const std::string &value, unsigned int position, unsigned int selection)
const std::string & output() const
const std::string selection
std::ostream & operator<<(std::ostream &, const TXC::L1TopoConfigAlg &)
STL namespace.
FixedParameter(const std::string &name, const std::string &value)
InputElement(const std::string &name, const std::string &value, unsigned int position)
unsigned int position
OutputElement(const std::string &name, const std::string &value, unsigned int bits, const std::string &outname, unsigned int position)
unsigned int position
RegisterParameter(const std::string &name, const std::string &value, unsigned int position, unsigned int selection)