Commit f7b01e7a authored by Purves, Murray's avatar Purves, Murray
Browse files

Adding initial skeleton classes and (failing) tests for PCF and SPE spectrum readers/writers

parent cc970dac
Pipeline #16075 failed with stages
in 9 minutes and 18 seconds
......@@ -11,6 +11,7 @@ SET(SOURCE
f71stream.cc
hcdump.cc
hysplitcdump.cc
spectrum.cc
)
SET(HEADERS
......@@ -25,6 +26,9 @@ SET(HEADERS
hcdump.hh
hysplitcdump.hh
hysplitcdump.i.hh
spectrum.hh
spectrumpcfstream.i.hh
spectrumspestream.i.hh
)
#
......
#ifndef RADIX_RADIXIO_SPECTRUM_HH_
#define RADIX_RADIXIO_SPECTRUM_HH_
#include <memory>
#include <string>
#include "radixcore/visibility.hh"
namespace radix
{
class RADIX_PUBLIC Spectrum
{
public:
typedef std::shared_ptr<Spectrum> SP;
}; // class RADIX_PUBLIC Spectrum
template <typename data_type>
class RADIX_PUBLIC SpectrumPCFStream
{
private:
data_type mData;
public:
SpectrumPCFStream(data_type container);
bool read_from(const std::string &file);
bool write_to(const std::string &file) const;
}; // class RADIX_PUBLIC SpectrumPCFStream
template <typename data_type>
class RADIX_PUBLIC SpectrumSPEStream
{
private:
data_type mData;
public:
SpectrumSPEStream(data_type container);
bool read_from(const std::string &file);
bool write_to(const std::string &file) const;
}; // class RADIX_PUBLIC SpectrumSPEStream
} // namespace radix
#include "spectrumpcfstream.i.hh"
#include "spectrumspestream.i.hh"
#endif // RADIX_RADIXIO_SPECTRUM_HH_
#ifndef RADIX_RADIXIO_SPECTRUMPCFSTREAM_HH_
#define RADIX_RADIXIO_SPECTRUMPCFSTREAM_HH_
#include <string>
#include "radixcore/visibility.hh"
#include "radixio/spectrum.hh"
namespace radix
{
template <typename data_type>
SpectrumPCFStream<data_type>::SpectrumPCFStream(data_type container)
{
mData = container;
}
template <typename data_type>
bool SpectrumPCFStream<data_type>::read_from(const std::string &file)
{
bool result = false;
return result;
}
template <typename data_type>
bool SpectrumPCFStream<data_type>::write_to(const std::string &file) const
{
bool result = false;
return result;
}
} // namespace radix
#endif // RADIX_RADIXIO_SPECTRUMPCFSTREAM_HH_
#ifndef RADIX_RADIXIO_SPECTRUMSPESTREAM_HH_
#define RADIX_RADIXIO_SPECTRUMSPESTREAM_HH_
#include <string>
#include "radixcore/visibility.hh"
#include "radixio/spectrum.hh"
namespace radix
{
template <typename data_type>
SpectrumSPEStream<data_type>::SpectrumSPEStream(data_type container)
{
mData = container;
}
template <typename data_type>
bool SpectrumSPEStream<data_type>::read_from(const std::string &file)
{
bool result = false;
return result;
}
template <typename data_type>
bool SpectrumSPEStream<data_type>::write_to(const std::string &file) const
{
bool result = false;
return result;
}
} // namespace radix
#endif // RADIX_RADIXIO_SPECTRUMSPESTREAM_HH_
......@@ -6,3 +6,4 @@ ADD_GOOGLE_TEST(tstEafstream.cc NP 1)
ADD_GOOGLE_TEST(tstF71Stream.cc NP 1)
ADD_GOOGLE_TEST(tstDecayDb.cc NP 1)
ADD_GOOGLE_TEST(tstHysplitCDump.cc NP 1)
ADD_GOOGLE_TEST(tstSpectrum.cc NP 1)
This diff is collapsed.
#include "gtest/gtest.h"
#include "radixcore/system.hh"
#include "radixio/spectrum.hh"
using namespace radix;
TEST(RadixIO, SpectrumFromPCF)
{
std::string testPCFFile =
radix::to_native_path(std::string(dirname(__FILE__) + "data/235F.pcf"));
Spectrum::SP testSpectrum = std::make_shared<Spectrum>();
// Load the spectrum
SpectrumPCFStream<Spectrum::SP> stream(testSpectrum);
ASSERT_TRUE(stream.read_from(testPCFFile));
// Test the spectrum contents
}
TEST(RadixIO, SpectrumToPCF)
{
std::string testPCFFile = "test.pcf";
Spectrum::SP testSpectrum = std::make_shared<Spectrum>();
// Load the spectrum
SpectrumPCFStream<Spectrum::SP> stream(testSpectrum);
ASSERT_TRUE(stream.write_to(testPCFFile));
}
TEST(RadixIO, SpectrumFromSPE)
{
std::string testSPEFile =
radix::to_native_path(std::string(dirname(__FILE__) + "data/235F.spe"));
Spectrum::SP testSpectrum = std::make_shared<Spectrum>();
// Load the spectrum
SpectrumSPEStream<Spectrum::SP> stream(testSpectrum);
ASSERT_TRUE(stream.read_from(testSPEFile));
// Test the spectrum contents
}
TEST(RadixIO, SpectrumToSPE)
{
std::string testSPEFile = "test.spe";
Spectrum::SP testSpectrum = std::make_shared<Spectrum>();
// Load the spectrum
SpectrumSPEStream<Spectrum::SP> stream(testSpectrum);
ASSERT_TRUE(stream.write_to(testSPEFile));
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment