##// END OF EJS Templates
Switched to cpp_utils package...
jeandet -
r94:29637e951955
parent child
Show More
@@ -3,7 +3,7
3
3
4 #include <Common/DateUtils.h>
4 #include <Common/DateUtils.h>
5 #include <Common/MetaTypes.h>
5 #include <Common/MetaTypes.h>
6 #include <Common/Numeric.h>
6 #include <Numeric.h>
7 #include <QDebug>
7 #include <QDebug>
8 #include <QObject>
8 #include <QObject>
9 #include <cmath>
9 #include <cmath>
@@ -32,8 +32,8 struct DateTimeRangeTransformation
32 Seconds<double> shift;
32 Seconds<double> shift;
33 bool operator==(const DateTimeRangeTransformation& other) const
33 bool operator==(const DateTimeRangeTransformation& other) const
34 {
34 {
35 return SciQLop::numeric::almost_equal(zoom, other.zoom, 1) &&
35 return cpp_utils::numeric::almost_equal(zoom, other.zoom, 1) &&
36 SciQLop::numeric::almost_equal<double>(shift, other.shift, 1);
36 cpp_utils::numeric::almost_equal<double>(shift, other.shift, 1);
37 }
37 }
38 DateTimeRangeTransformation
38 DateTimeRangeTransformation
39 merge(const DateTimeRangeTransformation& other) const
39 merge(const DateTimeRangeTransformation& other) const
@@ -99,8 +99,8 struct DateTimeRange
99
99
100 bool operator==(const DateTimeRange& other) const
100 bool operator==(const DateTimeRange& other) const
101 {
101 {
102 return SciQLop::numeric::almost_equal(m_TStart, other.m_TStart, 1) &&
102 return cpp_utils::numeric::almost_equal(m_TStart, other.m_TStart, 1) &&
103 SciQLop::numeric::almost_equal(m_TEnd, other.m_TEnd, 1);
103 cpp_utils::numeric::almost_equal(m_TEnd, other.m_TEnd, 1);
104 }
104 }
105
105
106 bool operator!=(const DateTimeRange& other) const
106 bool operator!=(const DateTimeRange& other) const
@@ -12,7 +12,7
12 #include <opaque/numeric_typedef.hpp>
12 #include <opaque/numeric_typedef.hpp>
13 #include <Common/DateUtils.h>
13 #include <Common/DateUtils.h>
14 #include <Common/MetaTypes.h>
14 #include <Common/MetaTypes.h>
15 #include <Common/Numeric.h>
15 #include <Numeric.h>
16 #include <Data/DateTimeRange.h>
16 #include <Data/DateTimeRange.h>
17
17
18 enum class TransformationType { ZoomOut, ZoomIn, PanRight, PanLeft, Unknown };
18 enum class TransformationType { ZoomOut, ZoomIn, PanRight, PanLeft, Unknown };
@@ -32,14 +32,14 namespace DateTimeRangeHelper {
32
32
33 inline bool isPureShift(const DateTimeRange& range1, const DateTimeRange& range2)
33 inline bool isPureShift(const DateTimeRange& range1, const DateTimeRange& range2)
34 {
34 {
35 return SciQLop::numeric::almost_equal<double>(range1.delta(), range2.delta(), 1)
35 return cpp_utils::numeric::almost_equal<double>(range1.delta(), range2.delta(), 1)
36 && !SciQLop::numeric::almost_equal(range1.m_TStart, range2.m_TStart, 1);
36 && !cpp_utils::numeric::almost_equal(range1.m_TStart, range2.m_TStart, 1);
37 }
37 }
38
38
39 inline bool isPureZoom(const DateTimeRange& range1, const DateTimeRange& range2)
39 inline bool isPureZoom(const DateTimeRange& range1, const DateTimeRange& range2)
40 {
40 {
41 return !SciQLop::numeric::almost_equal<double>(range1.delta(),range2.delta(),1)&&
41 return !cpp_utils::numeric::almost_equal<double>(range1.delta(),range2.delta(),1)&&
42 SciQLop::numeric::almost_equal<double>(range1.center(), range2.center(),1);
42 cpp_utils::numeric::almost_equal<double>(range1.center(), range2.center(),1);
43 }
43 }
44
44
45
45
@@ -68,7 +68,7 namespace DateTimeRangeHelper {
68 auto transformation = computeTransformation (range1,range2);
68 auto transformation = computeTransformation (range1,range2);
69 if(transformation.has_value ())
69 if(transformation.has_value ())
70 {
70 {
71 if(SciQLop::numeric::almost_equal(transformation->zoom,1.))
71 if(cpp_utils::numeric::almost_equal(transformation->zoom,1.))
72 {
72 {
73 if(transformation->shift > 0.)
73 if(transformation->shift > 0.)
74 return TransformationType::PanRight;
74 return TransformationType::PanRight;
@@ -4,7 +4,7
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5
5
6 #include <Common/MetaTypes.h>
6 #include <Common/MetaTypes.h>
7 #include <Common/deprecate.h>
7 #include <deprecate.h>
8 #include <Data/DateTimeRange.h>
8 #include <Data/DateTimeRange.h>
9 #include <QObject>
9 #include <QObject>
10 #include <QUuid>
10 #include <QUuid>
@@ -4,7 +4,7
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5
5
6 #include <Common/spimpl.h>
6 #include <Common/spimpl.h>
7 #include <Common/trees.h>
7 #include <trees/algorithms.hpp>
8 #include <QVariant>
8 #include <QVariant>
9 #include <QVector>
9 #include <QVector>
10 #include <iostream>
10 #include <iostream>
@@ -4,7 +4,7
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5
5
6 #include <Common/MetaTypes.h>
6 #include <Common/MetaTypes.h>
7 #include <Common/deprecate.h>
7 #include <deprecate.h>
8 #include <Common/spimpl.h>
8 #include <Common/spimpl.h>
9 #include <Data/DataSeriesType.h>
9 #include <Data/DataSeriesType.h>
10 #include <Data/DateTimeRange.h>
10 #include <Data/DateTimeRange.h>
@@ -6,7 +6,7
6
6
7 #include "CoreGlobal.h"
7 #include "CoreGlobal.h"
8 #include <Common/spimpl.h>
8 #include <Common/spimpl.h>
9 #include <Common/containers.h>
9 #include <containers/algorithms.hpp>
10
10
11 /**
11 /**
12 * @brief The VariableSynchronizationGroup2 class holds a list of Variables uuid which are synchronized
12 * @brief The VariableSynchronizationGroup2 class holds a list of Variables uuid which are synchronized
@@ -52,7 +52,7 public:
52 */
52 */
53 bool contains(QUuid variable) const noexcept
53 bool contains(QUuid variable) const noexcept
54 {
54 {
55 return SciQLop::containers::contains(this->_variables,variable);
55 return cpp_utils::containers::contains(this->_variables,variable);
56 }
56 }
57
57
58 /**
58 /**
@@ -1,7 +1,7
1 #pragma once
1 #pragma once
2 #include "Variable/VariableSynchronizationGroup2.h"
2 #include "Variable/VariableSynchronizationGroup2.h"
3
3
4 #include <Common/containers.h>
4 #include <containers/algorithms.hpp>
5 #include <Common/debug.h>
5 #include <Common/debug.h>
6 #include <Data/DataProviderParameters.h>
6 #include <Data/DataProviderParameters.h>
7 #include <Data/DateTimeRange.h>
7 #include <Data/DateTimeRange.h>
@@ -2,19 +2,15
2 catalogicpp_dep = dependency('catalogicpp', required : true, fallback:['catalogicpp','catalogicpp_dep'])
2 catalogicpp_dep = dependency('catalogicpp', required : true, fallback:['catalogicpp','catalogicpp_dep'])
3 pybind11_dep = dependency('pybind11', required : true, fallback:['pybind11','pybind11_dep'])
3 pybind11_dep = dependency('pybind11', required : true, fallback:['pybind11','pybind11_dep'])
4 timeseries_dep = dependency('TimeSeries', required : true, fallback:['TimeSeries','time_series_dep'])
4 timeseries_dep = dependency('TimeSeries', required : true, fallback:['TimeSeries','time_series_dep'])
5 cpp_utils_dep = dependency('cpp_utils', fallback:['cpp_utils','cpp_utils_dep'])
5
6
6 core_moc_headers = [
7 core_moc_headers = [
7 './include/Common/containers.h',
8 './include/Common/StringUtils.h',
9 './include/Common/Numeric.h',
10 './include/Common/spimpl.h',
8 './include/Common/spimpl.h',
11 './include/Common/DateUtils.h',
9 './include/Common/DateUtils.h',
12 './include/Common/MimeTypesDef.h',
10 './include/Common/MimeTypesDef.h',
13 './include/Common/SignalWaiter.h',
11 './include/Common/SignalWaiter.h',
14 './include/Common/deprecate.h',
15 './include/Common/debug.h',
12 './include/Common/debug.h',
16 './include/Common/MetaTypes.h',
13 './include/Common/MetaTypes.h',
17 './include/Common/cpp_utils.h',
18 './include/Common/SortUtils.h',
14 './include/Common/SortUtils.h',
19 './include/Data/DateTimeRangeHelper.h',
15 './include/Data/DateTimeRangeHelper.h',
20 './include/Data/ScalarTimeSerie.h',
16 './include/Data/ScalarTimeSerie.h',
@@ -58,7 +54,6 core_moc_files = qt5.preprocess(moc_headers : core_moc_headers, moc_sources: cor
58 core_sources = ['./src/Common/MimeTypesDef.cpp',
54 core_sources = ['./src/Common/MimeTypesDef.cpp',
59 './src/Common/SignalWaiter.cpp',
55 './src/Common/SignalWaiter.cpp',
60 './src/Common/DateUtils.cpp',
56 './src/Common/DateUtils.cpp',
61 './src/Common/StringUtils.cpp',
62 './src/Network/Downloader.cpp',
57 './src/Network/Downloader.cpp',
63 './src/Network/NetworkController.cpp',
58 './src/Network/NetworkController.cpp',
64 './src/Settings/SqpSettingsDefs.cpp',
59 './src/Settings/SqpSettingsDefs.cpp',
@@ -83,14 +78,14 sciqlop_core_lib = library('sciqlopcore',
83 core_moc_files,
78 core_moc_files,
84 cpp_args : '-DCORE_LIB',
79 cpp_args : '-DCORE_LIB',
85 include_directories : core_inc,
80 include_directories : core_inc,
86 dependencies : [qt5core, qt5network, catalogicpp_dep, pybind11_dep, timeseries_dep],
81 dependencies : [qt5core, qt5network, catalogicpp_dep, pybind11_dep, timeseries_dep, cpp_utils_dep],
87 install : true
82 install : true
88 )
83 )
89
84
90
85
91 sciqlop_core = declare_dependency(link_with : sciqlop_core_lib,
86 sciqlop_core = declare_dependency(link_with : sciqlop_core_lib,
92 include_directories : core_inc,
87 include_directories : core_inc,
93 dependencies : [qt5core, qt5network, catalogicpp_dep, pybind11_dep, timeseries_dep])
88 dependencies : [qt5core, qt5network, catalogicpp_dep, pybind11_dep, timeseries_dep, cpp_utils_dep])
94
89
95 pymod = import('python')
90 pymod = import('python')
96 python3 = pymod.find_installation('python3')
91 python3 = pymod.find_installation('python3')
@@ -1,6 +1,6
1 #include <Catalogue/CatalogueController.h>
1 #include <Catalogue/CatalogueController.h>
2 #include <CatalogueIO.hpp>
2 #include <CatalogueIO.hpp>
3 #include <Common/containers.h>
3 #include <containers/algorithms.hpp>
4 #include <Common/debug.h>
4 #include <Common/debug.h>
5 #include <QDataStream>
5 #include <QDataStream>
6 #include <QDir>
6 #include <QDir>
@@ -8,7 +8,7
8 #include <QStandardPaths>
8 #include <QStandardPaths>
9 #include <QThread>
9 #include <QThread>
10
10
11 using namespace SciQLop::containers;
11 using namespace cpp_utils::containers;
12
12
13 // class CatalogueController::CatalogueControllerPrivate
13 // class CatalogueController::CatalogueControllerPrivate
14 //{
14 //{
@@ -3,7 +3,7
3 #include "DataSource/DataSourceItem.h"
3 #include "DataSource/DataSourceItem.h"
4 #include "DataSource/DataSourceItemAction.h"
4 #include "DataSource/DataSourceItemAction.h"
5
5
6 #include <Common/containers.h>
6 #include <containers/algorithms.hpp>
7 #include <Data/IDataProvider.h>
7 #include <Data/IDataProvider.h>
8 #include <QDataStream>
8 #include <QDataStream>
9 #include <QDir>
9 #include <QDir>
@@ -2,7 +2,7
2
2
3 #include "Variable/VariableSynchronizationGroup2.h"
3 #include "Variable/VariableSynchronizationGroup2.h"
4
4
5 #include <Common/containers.h>
5 #include <containers/algorithms.hpp>
6 #include <Common/debug.h>
6 #include <Common/debug.h>
7 #include <Data/DataProviderParameters.h>
7 #include <Data/DataProviderParameters.h>
8 #include <Data/DateTimeRange.h>
8 #include <Data/DateTimeRange.h>
@@ -75,7 +75,7 class VariableController2::VariableController2Private
75 #if __cplusplus > 201703L
75 #if __cplusplus > 201703L
76 [[unlikely]]
76 [[unlikely]]
77 #endif
77 #endif
78 if(!_variables.size() > index)
78 if(!(_variables.size() > static_cast<unsigned int>(index)))
79 SCIQLOP_ERROR(threadSafeVaraiblesMaps, "Index is out of bounds");
79 SCIQLOP_ERROR(threadSafeVaraiblesMaps, "Index is out of bounds");
80 auto it = _variables.cbegin();
80 auto it = _variables.cbegin();
81 while(index != 0)
81 while(index != 0)
@@ -1,7 +1,8
1 #include <Common/DateUtils.h>
1 #include <Common/DateUtils.h>
2 #include <Common/MimeTypesDef.h>
2 #include <Common/MimeTypesDef.h>
3 #include <Common/StringUtils.h>
3 #include <cpp_utils_qt/cpp_utils_qt.hpp>
4 #include <Common/containers.h>
4 #include <strings/algorithms.hpp>
5 #include <containers/algorithms.hpp>
5 #include <DataSource/DataSourceController.h>
6 #include <DataSource/DataSourceController.h>
6 #include <QMimeData>
7 #include <QMimeData>
7 #include <QSize>
8 #include <QSize>
@@ -55,7 +56,7 namespace
55 auto forbiddenNames = std::vector<QString>(variables.size());
56 auto forbiddenNames = std::vector<QString>(variables.size());
56 std::transform(variables.cbegin(), variables.cend(), forbiddenNames.begin(),
57 std::transform(variables.cbegin(), variables.cend(), forbiddenNames.begin(),
57 [](const auto& variable) { return variable->name(); });
58 [](const auto& variable) { return variable->name(); });
58 auto uniqueName = StringUtils::uniqueName(defaultName, forbiddenNames);
59 auto uniqueName = cpp_utils::strings::make_unique_name(defaultName, forbiddenNames);
59 Q_ASSERT(!uniqueName.isEmpty());
60 Q_ASSERT(!uniqueName.isEmpty());
60
61
61 return uniqueName;
62 return uniqueName;
@@ -254,7 +255,7 void VariableModel2::variableUpdated(QUuid id) noexcept
254
255
255 void VariableModel2::variableAdded(const std::shared_ptr<Variable2>& variable)
256 void VariableModel2::variableAdded(const std::shared_ptr<Variable2>& variable)
256 {
257 {
257 if(!SciQLop::containers::contains(_variables, variable))
258 if(!cpp_utils::containers::contains(_variables, variable))
258 {
259 {
259 beginInsertRows(QModelIndex(), this->_variables.size(),
260 beginInsertRows(QModelIndex(), this->_variables.size(),
260 this->_variables.size());
261 this->_variables.size());
@@ -1,4 +1,4
1 #include <Common/Numeric.h>
1 #include <Numeric.h>
2 #include <Data/DateTimeRange.h>
2 #include <Data/DateTimeRange.h>
3 #include <Data/DateTimeRangeHelper.h>
3 #include <Data/DateTimeRangeHelper.h>
4 #include <QObject>
4 #include <QObject>
@@ -1,4 +1,4
1 #include <Common/containers.h>
1 #include <containers/algorithms.hpp>
2 #include <Data/DataProviderParameters.h>
2 #include <Data/DataProviderParameters.h>
3 #include <Data/DateTimeRange.h>
3 #include <Data/DateTimeRange.h>
4 #include <Data/IDataProvider.h>
4 #include <Data/IDataProvider.h>
@@ -47,7 +47,7 private slots:
47 });
47 });
48 QVERIFY(!callbackCalled);
48 QVERIFY(!callbackCalled);
49 auto var1 = vc.createVariable("var1", {}, provider, range);
49 auto var1 = vc.createVariable("var1", {}, provider, range);
50 QVERIFY(SciQLop::containers::contains(vc.variables(), var1));
50 QVERIFY(cpp_utils::containers::contains(vc.variables(), var1));
51 QVERIFY(callbackCalled);
51 QVERIFY(callbackCalled);
52 }
52 }
53
53
@@ -64,10 +64,10 private slots:
64 auto var1 = vc.createVariable("var1", {}, provider, range);
64 auto var1 = vc.createVariable("var1", {}, provider, range);
65 while(!vc.isReady(var1))
65 while(!vc.isReady(var1))
66 QCoreApplication::processEvents();
66 QCoreApplication::processEvents();
67 QVERIFY(SciQLop::containers::contains(vc.variables(), var1));
67 QVERIFY(cpp_utils::containers::contains(vc.variables(), var1));
68 QVERIFY(!callbackCalled);
68 QVERIFY(!callbackCalled);
69 vc.deleteVariable(var1);
69 vc.deleteVariable(var1);
70 QVERIFY(!SciQLop::containers::contains(vc.variables(), var1));
70 QVERIFY(!cpp_utils::containers::contains(vc.variables(), var1));
71 QVERIFY(callbackCalled);
71 QVERIFY(callbackCalled);
72 }
72 }
73
73
@@ -1,4 +1,4
1 #include <Common/containers.h>
1 #include <containers/algorithms.hpp>
2 #include <Data/DataProviderParameters.h>
2 #include <Data/DataProviderParameters.h>
3 #include <Data/DateTimeRange.h>
3 #include <Data/DateTimeRange.h>
4 #include <Data/IDataProvider.h>
4 #include <Data/IDataProvider.h>
@@ -1,4 +1,4
1 #include <Common/containers.h>
1 #include <containers/algorithms.hpp>
2 #include <Data/DataProviderParameters.h>
2 #include <Data/DataProviderParameters.h>
3 #include <Data/DateTimeRange.h>
3 #include <Data/DateTimeRange.h>
4 #include <Data/IDataProvider.h>
4 #include <Data/IDataProvider.h>
@@ -52,7 +52,7 private slots:
52 });
52 });
53 QVERIFY(!callbackCalled);
53 QVERIFY(!callbackCalled);
54 auto var1 = vc.createVariable("var1", {}, provider, range);
54 auto var1 = vc.createVariable("var1", {}, provider, range);
55 QVERIFY(SciQLop::containers::contains(vc.variables(), var1));
55 QVERIFY(cpp_utils::containers::contains(vc.variables(), var1));
56 QVERIFY(callbackCalled);
56 QVERIFY(callbackCalled);
57 }
57 }
58
58
@@ -67,14 +67,14 private slots:
67 callbackCalled = true;
67 callbackCalled = true;
68 });
68 });
69 auto var1 = vc.createVariable("var1", {}, provider, range);
69 auto var1 = vc.createVariable("var1", {}, provider, range);
70 QVERIFY(SciQLop::containers::contains(vc.variables(), var1));
70 QVERIFY(cpp_utils::containers::contains(vc.variables(), var1));
71 QVERIFY(!callbackCalled);
71 QVERIFY(!callbackCalled);
72 while(!vc.isReady(var1))
72 while(!vc.isReady(var1))
73 {
73 {
74 qApp->processEvents();
74 qApp->processEvents();
75 }
75 }
76 vc.deleteVariable(var1);
76 vc.deleteVariable(var1);
77 QVERIFY(!SciQLop::containers::contains(vc.variables(), var1));
77 QVERIFY(!cpp_utils::containers::contains(vc.variables(), var1));
78 QVERIFY(callbackCalled);
78 QVERIFY(callbackCalled);
79 }
79 }
80
80
@@ -10,16 +10,6 TestUtils_dep = declare_dependency(link_with : TestUtils,
10
10
11 tests = [
11 tests = [
12 {
12 {
13 'name':'TestStringUtils',
14 'sources': ['Common/TestStringUtils.cpp'],
15 'deps': [sciqlop_core, qt5test]
16 },
17 {
18 'name':'TestContainers',
19 'sources': ['Common/TestContainers.cpp'],
20 'deps': [sciqlop_core, qt5test]
21 },
22 {
23 'name':'TestSyncGroup',
13 'name':'TestSyncGroup',
24 'sources': ['Variable/TestSyncGroup.cpp'],
14 'sources': ['Variable/TestSyncGroup.cpp'],
25 'deps': [sciqlop_core, qt5test]
15 'deps': [sciqlop_core, qt5test]
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now