-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove get_type
func from RecordingDevice
#2770
Conversation
Could we think about/discuss a way to solve this at compile time? A function with the only function to solve type compatibility sounds a lot like traits. I have never used traits in practice though, only read about them, so I can't immediately make some working code suggestion. But I believe that the enroll function should be different depending on the traits of the RecordingDevice. |
Any traits Magic must know concrete the type of the device, but we want to make the recordingbackend unaware of such concrete types. |
Well, I disagree. Both RecordingDevices and RecordingBackends are known at compile time, so we should resolve their compatibility at compile time as well. That requires making the Backends aware of the concrete Devices they should support. Or not necessarily just support, but provide different implementations for different devices. void
nest::RecordingBackendMPI::enroll( const RecordingDevice& device, const DictionaryDatum& )
{
if ( device.is_recording_spikes() )
...
} template< typename RecordingDeviceT >
struct is_recording_spikes< RecordingDeviceT > : std::false_type {};
template<>
struct is_recording_spikes< spike_recorder > : std::true_type {};
template< typename RecordingDeviceT >
void
nest::RecordingBackendMPI::enroll( const RecordingDeviceT& device, const DictionaryDatum& )
{
if constexpr ( is_recording_spikes< RecordingDeviceT >::value )
...
} The |
The problem that the |
There are several ways around that. The easiest would be to just have a private |
It is now irrelevant as we are planning to refactor the |
Remove the
get_type
function from theRecordingDevice
class. The function is only required when using aRecordingBackEndMPI
with a device different from aspike_recoder
.The function is also being used in
RecordingBackEndSionLib
to store information about the device, but the information itself is useless to the user reading data from thebinary
file created byRecordingBackEndSionLib
.