P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
metermap.h
1/*
2Copyright 2013-present Barefoot Networks, Inc.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17#ifndef BACKENDS_BMV2_COMMON_METERMAP_H_
18#define BACKENDS_BMV2_COMMON_METERMAP_H_
19
20#include "ir/ir.h"
21
22namespace BMV2 {
23
25 public:
27 const IR::Expression *destinationField;
28 const IR::P4Table *table;
29 unsigned tableSize;
30
31 DirectMeterInfo() : destinationField(nullptr), table(nullptr), tableSize(0) {}
32 };
33
34 private:
35 // key is declaration of direct meter
36 std::map<const IR::IDeclaration *, DirectMeterInfo *> directMeter;
37 DirectMeterInfo *createInfo(const IR::IDeclaration *meter);
38
39 public:
40 DirectMeterInfo *getInfo(const IR::IDeclaration *meter);
41 void setDestination(const IR::IDeclaration *meter, const IR::Expression *destination);
42 void setTable(const IR::IDeclaration *meter, const IR::P4Table *table);
43 void setSize(const IR::IDeclaration *meter, unsigned size);
44};
45
46} // namespace BMV2
47
48#endif /* BACKENDS_BMV2_COMMON_METERMAP_H_ */
Definition metermap.h:24
void setDestination(const IR::IDeclaration *meter, const IR::Expression *destination)
Definition metermap.cpp:73
void setTable(const IR::IDeclaration *meter, const IR::P4Table *table)
Definition metermap.cpp:39
void setSize(const IR::IDeclaration *meter, unsigned size)
Definition metermap.cpp:92
Definition sharedActionSelectorCheck.h:40