forked from npshub/mantid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FilteredTimeSeriesProperty.cpp
75 lines (65 loc) · 2.57 KB
/
FilteredTimeSeriesProperty.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidKernel/FilteredTimeSeriesProperty.h"
#include "MantidKernel/DllConfig.h"
#include <string>
using namespace Mantid::Kernel;
namespace Mantid::Kernel {
/**
* Construct with a source time series & a filter property
* @param seriesProp :: A pointer to a property to filter.
* @param filterProp :: A boolean series property to filter on
*/
template <typename HeldType>
FilteredTimeSeriesProperty<HeldType>::FilteredTimeSeriesProperty(TimeSeriesProperty<HeldType> *seriesProp,
const TimeSeriesProperty<bool> &filterProp)
: TimeSeriesProperty<HeldType>(*seriesProp),
m_unfiltered(std::unique_ptr<const TimeSeriesProperty<HeldType>>(seriesProp->clone())) {
// Now filter us with the filter
this->filterWith(&filterProp);
}
/**
* Construct with a source time series & a filter property
* @param seriesProp :: A smart pointer to take ownership of pointer to a
* property to filter.
* @param filterProp :: A boolean series property to filter on
*/
template <typename HeldType>
FilteredTimeSeriesProperty<HeldType>::FilteredTimeSeriesProperty(
std::unique_ptr<const TimeSeriesProperty<HeldType>> seriesProp, const TimeSeriesProperty<bool> &filterProp)
: TimeSeriesProperty<HeldType>(*seriesProp), m_unfiltered(std::move(seriesProp)) {
// Now filter us with the filter
this->filterWith(&filterProp);
}
/**
* Destructor
*/
template <typename HeldType> FilteredTimeSeriesProperty<HeldType>::~FilteredTimeSeriesProperty() = default;
/**
* Access the unfiltered log
* @returns A pointer to the unfiltered property
*/
template <typename HeldType>
const TimeSeriesProperty<HeldType> *FilteredTimeSeriesProperty<HeldType>::unfiltered() const {
return m_unfiltered.get();
}
/// @cond
// -------------------------- Macro to instantiation concrete types
// --------------------------------
#define INSTANTIATE(TYPE) template class MANTID_KERNEL_DLL FilteredTimeSeriesProperty<TYPE>;
// -------------------------- Concrete instantiation
// -----------------------------------------------
INSTANTIATE(int32_t)
INSTANTIATE(int64_t)
INSTANTIATE(uint32_t)
INSTANTIATE(uint64_t)
INSTANTIATE(float)
INSTANTIATE(double)
INSTANTIATE(std::string)
INSTANTIATE(bool)
///@endcond
} // namespace Mantid::Kernel