Browse Source

Added the ability to manually block certain combinations of actions and sources

interpolate
Michael Uleysky 2 years ago
parent
commit
6ae6dcf0a1
  1. 25
      include/odm.h
  2. 2
      src/odm.cpp

25
include/odm.h

@ -7,14 +7,27 @@
using michlib::errmessage;
template<class T, ActionID id> consteval bool MustSupported()
template<class T, ActionID id> consteval bool MustSup()
{
static_assert(IsActionSupported<T, id>);
return true;
};
constexpr bool supported = MustSupported<NEMOData, ActionID::INFO>() && MustSupported<NEMOData, ActionID::TSC>() && MustSupported<NEMOData, ActionID::UV>() &&
MustSupported<HYCOMData, ActionID::INFO>() && MustSupported<HYCOMData, ActionID::TSC>() && MustSupported<HYCOMData, ActionID::UV>() &&
MustSupported<AVISOData, ActionID::INFO>() && MustSupported<AVISOData, ActionID::TSC>() && MustSupported<AVISOData, ActionID::UV>() &&
MustSupported<AVISOLOCALData, ActionID::INFO>() && MustSupported<AVISOLOCALData, ActionID::TSC>() && MustSupported<AVISOLOCALData, ActionID::UV>() &&
MustSupported<BINFILEData, ActionID::INFO>() && MustSupported<BINFILEData, ActionID::TSC>() && MustSupported<BINFILEData, ActionID::UV>();
constexpr bool NEMOsup =
MustSup<NEMOData, ActionID::INFO>() && MustSup<NEMOData, ActionID::TSC>() && MustSup<NEMOData, ActionID::UV>() && MustSup<NEMOData, ActionID::GENINTFILE>();
constexpr bool HYCOMsup =
MustSup<HYCOMData, ActionID::INFO>() && MustSup<HYCOMData, ActionID::TSC>() && MustSup<HYCOMData, ActionID::UV>() && MustSup<HYCOMData, ActionID::GENINTFILE>();
constexpr bool AVISOsup =
MustSup<AVISOData, ActionID::INFO>() && MustSup<AVISOData, ActionID::TSC>() && MustSup<AVISOData, ActionID::UV>() && MustSup<AVISOData, ActionID::GENINTFILE>();
constexpr bool AVISOLsup = MustSup<AVISOLOCALData, ActionID::INFO>() && MustSup<AVISOLOCALData, ActionID::TSC>() && MustSup<AVISOLOCALData, ActionID::UV>() &&
MustSup<AVISOLOCALData, ActionID::GENINTFILE>();
constexpr bool BINFILEsup = MustSup<BINFILEData, ActionID::INFO>() && MustSup<BINFILEData, ActionID::TSC>() && MustSup<BINFILEData, ActionID::UV>();
template<class T, ActionID id> static constexpr bool DisableAction = false;
// Exceptions
template<> constexpr bool DisableAction<BINFILEData, ActionID::GENINTFILE> = true;

2
src/odm.cpp

@ -87,7 +87,7 @@ int main(int argc, char** argv)
[&data = arg, &args = std::as_const(args)](const auto& arg)
{
using AT = std::decay_t<decltype(arg)>;
if constexpr(IsActionSupported<DT, AT::action>)
if constexpr(IsActionSupported<DT, AT::action> && !DisableAction<DT,AT::action>)
return DoAction<AT::action>(args, data);
else
return MString("Unsupported combination of action and source");

Loading…
Cancel
Save