-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAComponent.cpp
More file actions
44 lines (37 loc) · 999 Bytes
/
AComponent.cpp
File metadata and controls
44 lines (37 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
** EPITECH PROJECT, 2025
** nanoTekSpice
** File description:
** AComponent
*/
#include "../include/AComponent.hpp"
#include "../include/specialComponents/True.hpp"
#include "../include/specialComponents/False.hpp"
namespace nts
{
AComponent::AComponent(const std::string &name, std::size_t nbPins) : _name(name), _lastTick(1), _nbPins(nbPins), _state(nts::UNDEFINED)
{
_pins = std::vector<std::weak_ptr<nts::IComponent>>(nbPins);
}
AComponent::~AComponent()
{
}
void AComponent::simulate(std::size_t tick)
{
(void)tick;
}
nts::Tristate AComponent::compute(std::size_t tick)
{
(void)tick;
return _state;
}
void AComponent::setState(nts::Tristate state)
{
_state = state;
}
}
bool isTrueFalseComponent(const nts::IComponent& component)
{
return dynamic_cast<const nts::TrueComponent*>(&component) != nullptr
|| dynamic_cast<const nts::FalseComponent*>(&component) != nullptr;
}