Skip to content

Commit

Permalink
virtual classes
Browse files Browse the repository at this point in the history
  • Loading branch information
ogamespec committed Aug 24, 2023
1 parent 6c04845 commit 1a73083
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 9 deletions.
17 changes: 8 additions & 9 deletions IO/AbstractIODevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,20 @@ namespace IO
/// </summary>
class IODevice
{

protected:
std::map<size_t, IOState> states;

public:
IODevice();
virtual ~IODevice();
IODevice() {}
virtual ~IODevice() {}

virtual uint32_t GetID();
virtual std::string GetName();
virtual void GetIOStates(std::list<size_t>& io_states);
virtual uint32_t GetID() { return DeviceID::Abstract; }
virtual std::string GetName() { return "Abstract"; }
virtual void GetIOStates(std::list<size_t>& io_states) {}

virtual void SetState(size_t io_state, uint32_t value);
virtual uint32_t GetState(size_t io_state);
virtual void SetState(size_t io_state, uint32_t value) {}
virtual uint32_t GetState(size_t io_state) { return 0; }

virtual void sim(BaseLogic::TriState inputs[], BaseLogic::TriState outputs[]);
virtual void sim(BaseLogic::TriState inputs[], BaseLogic::TriState outputs[]) {}
};
}
47 changes: 47 additions & 0 deletions IO/IO.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
#include "pch.h"

namespace IO
{
IOSubsystem::IOSubsystem()
{
}

IOSubsystem::~IOSubsystem()
{
}

int CreateInstance(DeviceID device_id)
{
return -1;
}

void Attach(int port, int handle)
{
}

void Detach(int port, int handle)
{
}

void SetState(int handle, size_t io_state, uint32_t value)
{
}

uint32_t GetState(int handle, size_t io_state)
{
return 0;
}

int GetPorts()
{
return 0;
}

void GetPortSupportedDevices(int port, std::list<DeviceID>& devices)
{
devices.clear();
}

void sim(int port, BaseLogic::TriState inputs[], BaseLogic::TriState outputs[])
{
}
}

0 comments on commit 1a73083

Please sign in to comment.