Spicy
port.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <utility>
6 
7 #include <hilti/rt/types/port.h>
8 
9 #include <hilti/ast/ctor.h>
10 #include <hilti/ast/types/port.h>
11 
12 namespace hilti::ctor {
13 
15 class Port : public NodeBase, public hilti::trait::isCtor {
16 public:
17  using Value = hilti::rt::Port;
18 
19  Port(const Value& port, const Meta& m = Meta()) : NodeBase(nodes(type::Port(m)), m), _port(port) {}
20 
21  const auto& value() const { return _port; }
22 
23  bool operator==(const Port& other) const { return value() == other.value(); }
24 
26  const auto& type() const { return child<Type>(0); }
28  bool isConstant() const { return true; }
30  auto isLhs() const { return false; }
32  auto isTemporary() const { return true; }
34  auto isEqual(const Ctor& other) const { return node::isEqual(this, other); }
36  auto properties() const { return node::Properties{{"port", to_string(_port)}}; }
37 
38 private:
39  Value _port;
40 };
41 
42 } // namespace hilti::ctor
bool isConstant() const
Definition: port.h:28
Definition: port.h:22
const auto & type() const
Definition: port.h:26
Definition: port.h:15
auto isEqual(const Ctor &other) const
Definition: port.h:34
Definition: meta.h:19
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:98
auto properties() const
Definition: port.h:36
auto isLhs() const
Definition: port.h:30
Definition: ctor.h:15
auto isTemporary() const
Definition: port.h:32
Definition: node.h:360
Definition: port.h:12