Newer
Older
#ifndef TIMESPLITTER_H
#define TIMESPLITTER_H
#include "MantidKernel/DateAndTime.h"
namespace Mantid {
namespace Kernel {
/**
* Class holding a start/end time and a destination for splitting
* event lists and logs.
*
Janik Zikovsky
committed
* The start/stop times are saved internally as DateAndTime, for
* fastest event list splitting.
*
* Author: Janik Zikovsky, SNS
*/
class MANTID_KERNEL_DLL SplittingInterval {
public:
/// Default constructor
SplittingInterval();
SplittingInterval(const Types::Core::DateAndTime &start,
const Types::Core::DateAndTime &stop, const int index = 0);
Types::Core::DateAndTime start() const;
Types::Core::DateAndTime stop() const;
Janik Zikovsky
committed
double duration() const;
Janik Zikovsky
committed
int index() const;
bool overlaps(const SplittingInterval &b) const;
Janik Zikovsky
committed
SplittingInterval operator&(const SplittingInterval &b) const;
Janik Zikovsky
committed
SplittingInterval operator|(const SplittingInterval &b) const;
bool operator<(const SplittingInterval &b) const;
bool operator>(const SplittingInterval &b) const;
private:
Types::Core::DateAndTime m_start;
Types::Core::DateAndTime m_stop;
/// Index of the destination
int m_index;
};
/**
* A typedef for splitting events according their pulse time.
* It is a vector of SplittingInterval classes.
*
*/
typedef std::vector<SplittingInterval> TimeSplitterType;
Janik Zikovsky
committed
// -------------- Operators ---------------------
MANTID_KERNEL_DLL TimeSplitterType
operator+(const TimeSplitterType &a, const TimeSplitterType &b);
MANTID_KERNEL_DLL TimeSplitterType
operator&(const TimeSplitterType &a, const TimeSplitterType &b);
MANTID_KERNEL_DLL TimeSplitterType
operator|(const TimeSplitterType &a, const TimeSplitterType &b);
MANTID_KERNEL_DLL TimeSplitterType operator~(const TimeSplitterType &a);
Janik Zikovsky
committed
} // Namespace Kernel
} // Namespace Mantid
#endif // TIMESPLITTER_H