P4C
The P4 Compiler
Loading...
Searching...
No Matches
arch_spec.h
1#ifndef BACKENDS_P4TOOLS_COMMON_LIB_ARCH_SPEC_H_
2#define BACKENDS_P4TOOLS_COMMON_LIB_ARCH_SPEC_H_
3
4#include <cstddef>
5#include <map>
6#include <vector>
7
8#include "lib/cstring.h"
9
10namespace P4::P4Tools {
11
13class ArchSpec {
14 public:
16 struct ArchMember {
17 cstring blockName;
18 std::vector<cstring> blockParams;
19 };
20
21 private:
23 cstring packageName;
24
26 std::vector<ArchMember> archVector;
27
30 std::map<cstring, size_t> blockIndices;
31
32 public:
33 explicit ArchSpec(cstring packageName, const std::vector<ArchMember> &archVectorInput);
34
37 [[nodiscard]] size_t getBlockIndex(cstring blockName) const;
38
41 [[nodiscard]] const ArchMember *getArchMember(size_t blockIndex) const;
42
45 [[nodiscard]] cstring getParamName(size_t blockIndex, size_t paramIndex) const;
46
50 [[nodiscard]] cstring getParamName(cstring blockName, size_t paramIndex) const;
51
53 [[nodiscard]] size_t getArchVectorSize() const;
54
56 [[nodiscard]] cstring getPackageName() const;
57};
58
59} // namespace P4::P4Tools
60
61#endif /* BACKENDS_P4TOOLS_COMMON_LIB_ARCH_SPEC_H_ */
Specifies a canonical representation of the target pipeline as documented in P4 code.
Definition arch_spec.h:13
size_t getArchVectorSize() const
Definition arch_spec.cpp:50
cstring getPackageName() const
Definition arch_spec.cpp:52
size_t getBlockIndex(cstring blockName) const
Definition arch_spec.cpp:19
const ArchMember * getArchMember(size_t blockIndex) const
Definition arch_spec.cpp:44
cstring getParamName(size_t blockIndex, size_t paramIndex) const
Definition arch_spec.cpp:35
An ArchMember represents a construct in the pipe. It has a name and parameters.
Definition arch_spec.h:16
Definition cstring.h:85
Definition common/compiler/compiler_result.cpp:3