Browse Source

Opening dataset is done in actions

interpolate
Michael Uleysky 1 year ago
parent
commit
72d88e3c67
  1. 3
      actions/actiongenintfile.h
  2. 4
      actions/actioninfo.h
  3. 3
      actions/actiontsc.h
  4. 5
      actions/actionuv.h
  5. 2
      src/data.cpp

3
actions/actiongenintfile.h

@ -11,6 +11,9 @@ ADD_ACTION(GenIntFile, genintfile, ReadIsGrid<Source>);
template<class D> MString ActionGenIntFile::DoAction(const CLArgs& args, D& ds) template<class D> MString ActionGenIntFile::DoAction(const CLArgs& args, D& ds)
{ {
auto resop = ds.Open(args);
if(resop.Exist()) return "Can't open source: " + resop;
michlib_internal::ParameterListEx pars; michlib_internal::ParameterListEx pars;
pars.UsePrefix(""); pars.UsePrefix("");
pars.SetParameter("source", args.at("source")); pars.SetParameter("source", args.at("source"));

4
actions/actioninfo.h

@ -6,8 +6,10 @@ using michlib::message;
ADD_ACTION(Info, info, InfoSupported<Source>); ADD_ACTION(Info, info, InfoSupported<Source>);
template<class D> MString ActionInfo::DoAction([[maybe_unused]] const CLArgs& args, D& data) template<class D> MString ActionInfo::DoAction(const CLArgs& args, D& data)
{ {
auto resop = data.Open(args);
if(resop.Exist()) return "Can't open source: " + resop;
auto info = data.Info(); auto info = data.Info();
if(!info.Exist()) return "No info"; if(!info.Exist()) return "No info";
message(info); message(info);

3
actions/actiontsc.h

@ -9,6 +9,9 @@ ADD_ACTION(TSC, tsc, ReadPSupported<Source> || ReadSupported<Source>);
template<class D> MString ActionTSC::DoAction(const CLArgs& args, D& ds) template<class D> MString ActionTSC::DoAction(const CLArgs& args, D& ds)
{ {
auto resop = ds.Open(args);
if(resop.Exist()) return "Can't open source: " + resop;
michlib_internal::ParameterListEx pars; michlib_internal::ParameterListEx pars;
pars.UsePrefix(""); pars.UsePrefix("");
pars.SetParameter("source", args.at("source")); pars.SetParameter("source", args.at("source"));

5
actions/actionuv.h

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "actiondep.h"
#include "BFileW.h" #include "BFileW.h"
#include "actiondep.h"
#include <memory> #include <memory>
using michlib::BFileW; using michlib::BFileW;
@ -9,6 +9,9 @@ ADD_ACTION(UV, uv, ReadPSupported<Source> || ReadSupported<Source>);
template<class D> MString ActionUV::DoAction(const CLArgs& args, D& ds) template<class D> MString ActionUV::DoAction(const CLArgs& args, D& ds)
{ {
auto resop = ds.Open(args);
if(resop.Exist()) return "Can't open source: " + resop;
michlib_internal::ParameterListEx pars; michlib_internal::ParameterListEx pars;
pars.UsePrefix(""); pars.UsePrefix("");
pars.SetParameter("source", args.at("source")); pars.SetParameter("source", args.at("source"));

2
src/data.cpp

@ -8,7 +8,5 @@ MString Data::Init(const CLArgs& args)
bool res = internal::InitV(*this, src); bool res = internal::InitV(*this, src);
if(!res) return "Unknown source: " + src; if(!res) return "Unknown source: " + src;
auto resop = std::visit([&args = std::as_const(args)](auto& data) -> auto { return data.Open(args); }, *this);
if(resop.Exist()) return "Can't open source " + src + ":\n" + resop;
return ""; return "";
} }

Loading…
Cancel
Save