13 #include "CallbackStore.h"
14 #include "mockdata/DIOData.h"
20 explicit DIOSim(
int index) { m_index = index; }
22 std::unique_ptr<CallbackStore> RegisterInitializedCallback(
23 NotifyCallback callback,
bool initialNotify) {
24 auto store = std::make_unique<CallbackStore>(
25 m_index, -1, callback, &HALSIM_CancelDIOInitializedCallback);
26 store->SetUid(HALSIM_RegisterDIOInitializedCallback(
27 m_index, &CallbackStoreThunk, store.get(), initialNotify));
31 bool GetInitialized()
const {
return HALSIM_GetDIOInitialized(m_index); }
33 void SetInitialized(
bool initialized) {
34 HALSIM_SetDIOInitialized(m_index, initialized);
37 std::unique_ptr<CallbackStore> RegisterValueCallback(NotifyCallback callback,
39 auto store = std::make_unique<CallbackStore>(
40 m_index, -1, callback, &HALSIM_CancelDIOValueCallback);
41 store->SetUid(HALSIM_RegisterDIOValueCallback(m_index, &CallbackStoreThunk,
42 store.get(), initialNotify));
46 bool GetValue()
const {
return HALSIM_GetDIOValue(m_index); }
48 void SetValue(
bool value) { HALSIM_SetDIOValue(m_index, value); }
50 std::unique_ptr<CallbackStore> RegisterPulseLengthCallback(
51 NotifyCallback callback,
bool initialNotify) {
52 auto store = std::make_unique<CallbackStore>(
53 m_index, -1, callback, &HALSIM_CancelDIOPulseLengthCallback);
54 store->SetUid(HALSIM_RegisterDIOPulseLengthCallback(
55 m_index, &CallbackStoreThunk, store.get(), initialNotify));
59 double GetPulseLength()
const {
return HALSIM_GetDIOPulseLength(m_index); }
61 void SetPulseLength(
double pulseLength) {
62 HALSIM_SetDIOPulseLength(m_index, pulseLength);
65 std::unique_ptr<CallbackStore> RegisterIsInputCallback(
66 NotifyCallback callback,
bool initialNotify) {
67 auto store = std::make_unique<CallbackStore>(
68 m_index, -1, callback, &HALSIM_CancelDIOIsInputCallback);
69 store->SetUid(HALSIM_RegisterDIOIsInputCallback(
70 m_index, &CallbackStoreThunk, store.get(), initialNotify));
74 bool GetIsInput()
const {
return HALSIM_GetDIOIsInput(m_index); }
76 void SetIsInput(
bool isInput) { HALSIM_SetDIOIsInput(m_index, isInput); }
78 std::unique_ptr<CallbackStore> RegisterFilterIndexCallback(
79 NotifyCallback callback,
bool initialNotify) {
80 auto store = std::make_unique<CallbackStore>(
81 m_index, -1, callback, &HALSIM_CancelDIOFilterIndexCallback);
82 store->SetUid(HALSIM_RegisterDIOFilterIndexCallback(
83 m_index, &CallbackStoreThunk, store.get(), initialNotify));
87 int GetFilterIndex()
const {
return HALSIM_GetDIOFilterIndex(m_index); }
89 void SetFilterIndex(
int filterIndex) {
90 HALSIM_SetDIOFilterIndex(m_index, filterIndex);
93 void ResetData() { HALSIM_ResetDIOData(m_index); }