|
|
|
#pragma once
|
|
|
|
#include "ParseArgs.h"
|
|
|
|
#include <concepts>
|
|
|
|
|
|
|
|
class BaseParameters;
|
|
|
|
using michlib::real;
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
concept InfoSupported = requires(T t) {
|
|
|
|
{
|
|
|
|
t.Info()
|
|
|
|
} -> std::convertible_to<MString>;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
concept ParametersSupported = requires(T t, michlib_internal::ParameterListEx& pars, const CLArgs& args) {
|
|
|
|
{
|
|
|
|
t.Parameters(pars, args).first
|
|
|
|
} -> std::convertible_to<const BaseParameters*>;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
concept ReadPSupported = requires(T t, const MString& vname, const BaseParameters* ip, size_t i) {
|
|
|
|
{
|
|
|
|
t.Read(vname, ip, i)(0)
|
|
|
|
} -> std::convertible_to<real>;
|
|
|
|
};
|
|
|
|
template<class T>
|
|
|
|
concept ReadSupported = requires(T t, const MString& vname, size_t i) {
|
|
|
|
{
|
|
|
|
t.Read(vname, i)(0)
|
|
|
|
} -> std::convertible_to<real>;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
concept IsUVData = requires(T t) {
|
|
|
|
{
|
|
|
|
t.U(0)
|
|
|
|
} -> std::convertible_to<real>;
|
|
|
|
{
|
|
|
|
t.V(0)
|
|
|
|
} -> std::convertible_to<real>;
|
|
|
|
{
|
|
|
|
t.U2(0)
|
|
|
|
} -> std::convertible_to<real>;
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace internal
|
|
|
|
{
|
|
|
|
template<class T>
|
|
|
|
concept HaveXYStep = requires(T t) {
|
|
|
|
{
|
|
|
|
t.XStep()
|
|
|
|
} -> std::convertible_to<real>;
|
|
|
|
{
|
|
|
|
t.YStep()
|
|
|
|
} -> std::convertible_to<real>;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace internal
|
|
|
|
{
|
|
|
|
template<typename...> using void_ = void;
|
|
|
|
|
|
|
|
template<class D, bool RP, bool R> struct GetReadType_;
|
|
|
|
|
|
|
|
template<class D, bool R> struct GetReadType_<D, true, R>
|
|
|
|
{
|
|
|
|
using p = BaseParameters*;
|
|
|
|
using type = decltype(D().Read(MString(), p(), 0));
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class D> struct GetReadType_<D, false, true>
|
|
|
|
{
|
|
|
|
using type = decltype(D().Read(MString(), 0));
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
|
|
|
|
template<class D> using ReadType = internal::GetReadType_<D, ReadPSupported<D>, ReadSupported<D>>::type;
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
concept ReadIsGrid = requires {
|
|
|
|
{
|
|
|
|
ReadType<T>().XStep()
|
|
|
|
} -> std::convertible_to<real>;
|
|
|
|
{
|
|
|
|
ReadType<T>().YStep()
|
|
|
|
} -> std::convertible_to<real>;
|
|
|
|
};
|