P4C
The P4 Compiler
Loading...
Searching...
No Matches
kind_size_indexed_map.h
1
19
#ifndef BF_P4C_PHV_V2_KIND_SIZE_INDEXED_MAP_H_
20
#define BF_P4C_PHV_V2_KIND_SIZE_INDEXED_MAP_H_
21
22
#include <map>
23
#include <optional>
24
25
#include "backends/tofino/bf-p4c/phv/phv_fields.h"
26
27
namespace
PHV
{
28
namespace
v2 {
29
30
struct
KindSizeIndexedMap
{
31
std::map<std::pair<PHV::Kind, PHV::Size>,
int
> m;
32
int
&operator[](
const
std::pair<PHV::Kind, PHV::Size> &ks) {
return
m[ks]; }
33
int
sum(
const
PHV::Kind
&k)
const
;
34
int
sum(
const
PHV::Size
&k)
const
;
35
std::optional<int> get(
const
PHV::Kind
&k,
const
PHV::Size
&s)
const
;
36
int
get_or(
const
PHV::Kind
&k,
const
PHV::Size
&s,
int
default_val)
const
;
37
};
38
std::ostream &operator<<(std::ostream &,
const
KindSizeIndexedMap
&);
39
40
}
// namespace v2
41
}
// namespace PHV
42
43
#endif
/* BF_P4C_PHV_V2_KIND_SIZE_INDEXED_MAP_H_ */
PHV
The namespace encapsulating PHV-related stuff.
Definition
gateway.h:32
PHV::Size
Size
all possible PHV container sizes in BFN devices
Definition
phv.h:110
PHV::Kind
Kind
Definition
phv.h:44
PHV::v2::KindSizeIndexedMap
Definition
kind_size_indexed_map.h:30
backends
tofino
bf-p4c
phv
v2
kind_size_indexed_map.h
Generated by
1.12.0