HAL
ram_component.cpp
Go to the documentation of this file.
2 
3 namespace hal
4 {
5  RAMComponent::RAMComponent(std::unique_ptr<GateTypeComponent> component, const u32 bit_size) : m_component(std::move(component)), m_bit_size(bit_size)
6  {
7  }
8 
10  {
11  return m_type;
12  }
13 
15  {
16  return component->get_type() == m_type;
17  }
18 
19  std::vector<GateTypeComponent*> RAMComponent::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_bit_size;
45  }
46 
47  void RAMComponent::set_bit_size(const u32 bit_size)
48  {
49  m_bit_size = bit_size;
50  }
51 } // namespace hal
virtual ComponentType get_type() const =0
ComponentType get_type() const override
static bool is_class_of(const GateTypeComponent *component)
u32 get_bit_size() const
std::vector< GateTypeComponent * > get_components(const std::function< bool(const GateTypeComponent *)> &filter=nullptr) const override
RAMComponent(std::unique_ptr< GateTypeComponent > component, const u32 bit_size)
void set_bit_size(const u32 bit_size)
quint32 u32