bmv2
Designing your own switch target with bmv2
control_flow.h
1 /* Copyright 2013-present Barefoot Networks, Inc.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /*
17  * Antonin Bas (antonin@barefootnetworks.com)
18  *
19  */
20 
21 #ifndef BM_BM_SIM_CONTROL_FLOW_H_
22 #define BM_BM_SIM_CONTROL_FLOW_H_
23 
24 #include <memory>
25 #include <string>
26 #include <utility>
27 
28 #include "named_p4object.h"
29 
30 namespace bm {
31 
32 class Packet;
33 
34 class ControlFlowNode : public NamedP4Object {
35  public:
36  ControlFlowNode(const std::string &name, p4object_id_t id)
37  : NamedP4Object(name, id) { }
38  ControlFlowNode(const std::string &name, p4object_id_t id,
39  std::unique_ptr<SourceInfo> source_info)
40  : NamedP4Object(name, id, std::move(source_info)) {}
41 
42  virtual ~ControlFlowNode() = default;
43 
44  virtual const ControlFlowNode *operator()(Packet *pkt) const = 0;
45 
47  ControlFlowNode(const ControlFlowNode &other) = delete;
49  ControlFlowNode &operator=(const ControlFlowNode &other) = delete;
50 
51  // The following are implictly deleted otherwise because of the user-defined
52  // virtual destructor.
53 
55  ControlFlowNode(ControlFlowNode &&other) = default;
57  ControlFlowNode &operator=(ControlFlowNode &&other) = default;
58 };
59 
60 } // namespace bm
61 
62 #endif // BM_BM_SIM_CONTROL_FLOW_H_
named_p4object.h
bm::NamedP4Object::operator=
NamedP4Object & operator=(const NamedP4Object &other)=delete
Deleted copy assignment operator.