HAL
lut_component.cpp
Go to the documentation of this file.
2 
3 namespace hal
4 {
5  LUTComponent::LUTComponent(std::unique_ptr<GateTypeComponent> component, bool init_ascending) : m_component(std::move(component)), m_init_ascending(init_ascending)
6  {
7  }
8 
10  {
11  return m_type;
12  }
13 
15  {
16  return component->get_type() == m_type;
17  }
18 
19  std::vector<GateTypeComponent*> LUTComponent::get_components(const std::function<bool(const GateTypeComponent*)>& filter) const
20  {
21  if (m_component != nullptr)
22  {
23  std::vector<GateTypeComponent*> res = m_component->get_components(filter);
24  if (filter)
25  {
26  if (filter(m_component.get()))
27  {
28  res.push_back(m_component.get());
29  }
30  }
31  else
32  {
33  res.push_back(m_component.get());
34  }
35 
36  return res;
37  }
38 
39  return {};
40  }
41 
43  {
44  return m_init_ascending;
45  }
46 
48  {
49  m_init_ascending = ascending;
50  }
51 } // namespace hal
virtual ComponentType get_type() const =0
ComponentType get_type() const override
void set_init_ascending(bool init_ascending=true)
std::vector< GateTypeComponent * > get_components(const std::function< bool(const GateTypeComponent *)> &filter=nullptr) const override
bool is_init_ascending() const
static bool is_class_of(const GateTypeComponent *component)
LUTComponent(std::unique_ptr< GateTypeComponent > component, bool init_ascending)
bool ascending