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 "bf-p4c/phv/phv_fields.h"
26
27namespace PHV {
28namespace v2 {
29
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};
38std::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_ */
The namespace encapsulating PHV-related stuff.
Definition gateway.h:32
Size
all possible PHV container sizes in BFN devices
Definition phv.h:110
Kind
Definition phv.h:44
Definition kind_size_indexed_map.h:30