-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dynamic link, realtime simulation, etc
- Loading branch information
Showing
10 changed files
with
135 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,45 @@ | ||
#include "Pin.hpp" | ||
|
||
namespace nts | ||
{ | ||
Pin::Pin(Mode _mode) : mode(_mode), component(0), state(UNDEFINED), target_pin(0) | ||
{ | ||
namespace nts { | ||
Pin::Pin(Mode _mode) : mode(_mode), component(0), state(UNDEFINED), target_pin(0) { | ||
} | ||
|
||
Pin::Pin(const Pin &other) : mode(other.getMode()), component(&other.getComponent()), state(other.getState()), target_pin(other.getTargetPin()) | ||
{ | ||
Pin::Pin(const Pin &other) : mode(other.getMode()), component(&other.getComponent()), state(other.getState()), | ||
target_pin(other.getTargetPin()) { | ||
} | ||
|
||
Pin::~Pin() | ||
{ | ||
Pin::~Pin() { | ||
} | ||
|
||
const Pin &Pin::operator=(const Pin &other) | ||
{ | ||
const Pin &Pin::operator=(const Pin &other) { | ||
this->component = &other.getComponent(); | ||
this->state = other.getState(); | ||
this->target_pin = other.getTargetPin(); | ||
return (*this); | ||
} | ||
|
||
void Pin::setComponent(IComponent &_component) {this->component = &_component;} | ||
void Pin::setComponent(IComponent &_component) { | ||
printf("setComponent %p\n", &_component); | ||
this->component = &_component; | ||
} | ||
|
||
void Pin::setTarget(std::size_t _target_pin) {this->target_pin = _target_pin;} | ||
void Pin::setTarget(std::size_t _target_pin) { this->target_pin = _target_pin; } | ||
|
||
void Pin::setState(Tristate _state) {this->state = _state;} | ||
void Pin::setState(Tristate _state) { this->state = _state; } | ||
|
||
void Pin::setMode(Mode _mode) {this->mode = _mode;} | ||
void Pin::setMode(Mode _mode) { this->mode = _mode; } | ||
|
||
IComponent &Pin::getComponent() const {return (*this->component);} | ||
IComponent &Pin::getComponent() const { return (*this->component); } | ||
|
||
std::size_t Pin::getTargetPin() const {return (this->target_pin);} | ||
std::size_t Pin::getTargetPin() const { return (this->target_pin); } | ||
|
||
Tristate Pin::getState() const {return (this->state);} | ||
Tristate Pin::getState() const { return (this->state); } | ||
|
||
nts::Tristate Pin::compute() {return (this->component->Compute(this->target_pin));} | ||
nts::Tristate Pin::compute() { | ||
if (this->component == NULL) | ||
return nts::Tristate::UNDEFINED; | ||
return (this->component->Compute(this->target_pin)); | ||
} | ||
|
||
Pin::Mode Pin::getMode() const {return (this->mode);} | ||
Pin::Mode Pin::getMode() const { return (this->mode); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.