##// END OF EJS Templates
Few fixes with merging empty csv files from Web Services...
Few fixes with merging empty csv files from Web Services Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r1351:d755f1f0a484
r1433:aaf8b0146447
Show More
PyTestAmdaWrapper.cpp
126 lines | 4.9 KiB | text/x-c | CppLexer
/ plugins / amda / tests / PyTestAmdaWrapper.cpp
Initial Pybind11 binding experiment working....
r1339 /*------------------------------------------------------------------------------
-- This file is a part of the SciQLOP Software
-- Copyright (C) 2018, Plasma Physics Laboratory - CNRS
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-------------------------------------------------------------------------------*/
/*-- Author : Alexis Jeandet
-- Mail : alexis.jeandet@member.fsf.org
----------------------------------------------------------------------------*/
#include <string>
#include <sstream>
#include <memory>
#include <pybind11/pybind11.h>
#include <pybind11/operators.h>
#include <pybind11/embed.h>
Added basic tests around Amda plugin Python wrapper...
r1340 #include <pybind11/numpy.h>
#include <pybind11/chrono.h>
Initial Pybind11 binding experiment working....
r1339
#include <SqpApplication.h>
All the codebase is modified to build with new Variable Controller...
r1348 #include <Variable/VariableController2.h>
Initial Pybind11 binding experiment working....
r1339 #include <Time/TimeController.h>
Made core module a git submodule, ready to start switching to new...
r1347 #include <Data/DateTimeRange.h>
Initial Pybind11 binding experiment working....
r1339 #include <Data/DataSeriesType.h>
#include <Common/DateUtils.h>
#include <Variable/Variable.h>
#include <Data/ScalarSeries.h>
Added basic tests around Amda plugin Python wrapper...
r1340 #include <Data/VectorSeries.h>
Initial Pybind11 binding experiment working....
r1339
#include <AmdaProvider.h>
#include <AmdaResultParser.h>
Some refactoring on PB11 wrappers...
r1341 //#include <QDate>
//#include <QTime>
//#include <QUuid>
//#include <QString>
Initial Pybind11 binding experiment working....
r1339 #include <QFile>
Some refactoring on PB11 wrappers...
r1341 #include <pywrappers_common.h>
#include <CoreWrappers.h>
Added basic tests around Amda plugin Python wrapper...
r1340
Renamed SqpRange to DateTimeRange, introduced VariableController2 to...
r1346 #include "PyTestAmdaWrapper.h"
Initial Pybind11 binding experiment working....
r1339
Some refactoring on PB11 wrappers...
r1341 using namespace std::chrono;
Initial Pybind11 binding experiment working....
r1339
Added basic tests around Amda plugin Python wrapper...
r1340
Initial Pybind11 binding experiment working....
r1339 PYBIND11_MODULE(pytestamda, m){
Some refactoring on PB11 wrappers...
r1341
Added basic tests around Amda plugin Python wrapper...
r1340 int argc = 0;
char ** argv=nullptr;
SqpApplication::setOrganizationName("LPP");
SqpApplication::setOrganizationDomain("lpp.fr");
SqpApplication::setApplicationName("SciQLop");
static SqpApplication app(argc, argv);
Some refactoring on PB11 wrappers...
r1341 auto qtmod = py::module::import("sciqlopqt");
auto sciqlopmod = py::module::import("pysciqlopcore");
Initial Pybind11 binding experiment working....
r1339
Some refactoring on PB11 wrappers...
r1341 m.doc() = "hello";
Initial Pybind11 binding experiment working....
r1339
All the codebase is modified to build with new Variable Controller...
r1348 // py::class_<VariableController>(m, "VariableController")
// .def_static("createVariable",[](const QString &name,
// std::shared_ptr<IDataProvider> provider, const DateTimeRange& range){
// return sqpApp->variableController().createVariable(name, {{"dataType", "vector"}, {"xml:id", "c1_b"}}, provider, range);
// })
// .def_static("hasPendingDownloads",
// [](){return sqpApp->variableController().hasPendingDownloads();}
// )
// .def_static("addSynchronizationGroup",
// [](QUuid uuid){sqpApp->variableController().onAddSynchronizationGroupId(uuid);}
// )
// .def_static("removeSynchronizationGroup",
// [](QUuid uuid){sqpApp->variableController().onRemoveSynchronizationGroupId(uuid);}
// )
// .def_static("synchronizeVar",
// [](std::shared_ptr<Variable> variable, QUuid uuid){sqpApp->variableController().onAddSynchronized(variable, uuid);}
// )
// .def_static("deSynchronizeVar",
// [](std::shared_ptr<Variable> variable, QUuid uuid){sqpApp->variableController().desynchronize(variable, uuid);}
// )
// .def_static("deleteVariable",
// [](std::shared_ptr<Variable> variable){
// sqpApp->variableController().deleteVariable(variable);}
// )
// .def_static("update_range",[](std::shared_ptr<Variable> variable, const DateTimeRange &range, bool synchronise){
// sqpApp->variableController().onRequestDataLoading({variable}, range, synchronise);
// })
// .def_static("wait_for_downloads",[](){
// while (sqpApp->variableController().hasPendingDownloads()) {
// usleep(100);
// }
// });
Initial Pybind11 binding experiment working....
r1339
Added basic tests around Amda plugin Python wrapper...
r1340 py::class_<TimeController>(m,"TimeController")
Renamed SqpRange to DateTimeRange, introduced VariableController2 to...
r1346 .def_static("setTime", [](DateTimeRange range){sqpApp->timeController().setDateTimeRange(range);});
Added basic tests around Amda plugin Python wrapper...
r1340
Some refactoring on PB11 wrappers...
r1341
auto amda_provider = std::make_shared<AmdaProvider>();
m.def("amda_provider",[amda_provider](){return amda_provider;}, py::return_value_policy::copy);
Added basic tests around Amda plugin Python wrapper...
r1340
py::class_<AmdaProvider, std::shared_ptr<AmdaProvider>, IDataProvider>(m, "AmdaProvider");
Initial Pybind11 binding experiment working....
r1339
Removed old IDataProvider IF, some small steps toward new VC integration...
r1351 // py::class_<AmdaResultParser>(m, "AmdaResultParser")
// .def_static("readTxt", AmdaResultParser::readTxt)
// .def("readScalarTxt", [](const QString& path){
// return std::dynamic_pointer_cast<ScalarSeries>(AmdaResultParser::readTxt(path, DataSeriesType::SCALAR));
// }, py::return_value_policy::copy);
Initial Pybind11 binding experiment working....
r1339
}