HAL
latch_component.cpp
Go to the documentation of this file.
2 
3 namespace hal
4 {
5  LatchComponent::LatchComponent(std::unique_ptr<GateTypeComponent> component) : m_component(std::move(component))
6  {
7  }
8 
10  {
11  return m_type;
12  }
13 
15  {
16  return component->get_type() == m_type;
17  }
18 
19  std::vector<GateTypeComponent*> LatchComponent::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_data_in_bf.clone();
45  }
46 
48  {
49  m_data_in_bf = data_in_bf.clone();
50  }
51 
53  {
54  return m_enable_bf.clone();
55  }
56 
58  {
59  m_enable_bf = enable_bf.clone();
60  }
61 
63  {
64  return m_async_reset_bf.clone();
65  }
66 
68  {
69  m_async_reset_bf = async_reset_bf.clone();
70  }
71 
73  {
74  return m_async_set_bf.clone();
75  }
76 
78  {
79  m_async_set_bf = async_set_bf.clone();
80  }
81 
82  const std::pair<AsyncSetResetBehavior, AsyncSetResetBehavior>& LatchComponent::get_async_set_reset_behavior() const
83  {
84  return m_async_set_reset_behavior;
85  }
86 
88  {
89  m_async_set_reset_behavior = std::make_pair(behav_state, behav_neg_state);
90  }
91 
92 } // namespace hal
BooleanFunction clone() const
virtual ComponentType get_type() const =0
BooleanFunction get_async_reset_function() const
void set_async_reset_function(const BooleanFunction &async_reset_bf)
void set_async_set_reset_behavior(AsyncSetResetBehavior behav_state, AsyncSetResetBehavior behav_neg_state)
ComponentType get_type() const override
std::vector< GateTypeComponent * > get_components(const std::function< bool(const GateTypeComponent *)> &filter=nullptr) const override
static bool is_class_of(const GateTypeComponent *component)
LatchComponent(std::unique_ptr< GateTypeComponent > component)
const std::pair< AsyncSetResetBehavior, AsyncSetResetBehavior > & get_async_set_reset_behavior() const
void set_enable_function(const BooleanFunction &enable_bf)
void set_async_set_function(const BooleanFunction &async_set_bf)
BooleanFunction get_async_set_function() const
BooleanFunction get_enable_function() const
BooleanFunction get_data_in_function() const
void set_data_in_function(const BooleanFunction &data_in_bf)