moving code into aare:: namespace

This commit is contained in:
Erik Frojdh
2024-04-02 12:26:51 +02:00
parent 449c5119a4
commit 0a6030aa3e
35 changed files with 122 additions and 17 deletions

View File

@ -14,6 +14,8 @@
* should be able to work with streams coming from files or network
*/
namespace aare {
class Frame {
ssize_t m_rows;
ssize_t m_cols;
@ -65,3 +67,4 @@ class Frame {
};
} // namespace aare

View File

@ -18,6 +18,7 @@ TODO! Add expression templates for operators
#include <iostream>
#include <numeric>
namespace aare {
template <typename T, ssize_t Ndim = 2> class NDArray {
public:
@ -427,3 +428,4 @@ NDArray<T, Ndim> load(const std::string &pathname,
}
} // namespace aare

View File

@ -6,6 +6,8 @@
#include <numeric>
#include <vector>
namespace aare {
template <ssize_t Ndim> using Shape = std::array<ssize_t, Ndim>;
template <ssize_t Dim = 0, typename Strides> ssize_t element_offset(const Strides &) { return 0; }
@ -125,3 +127,4 @@ template <typename T, ssize_t Ndim=2> class NDView {
template class NDView<uint16_t, 2>;
} // namespace aare

View File

@ -9,7 +9,7 @@
#include "aare/NDArray.hpp"
const int MAX_CLUSTER_SIZE = 200;
namespace pl {
namespace aare {
template <typename T> class ClusterFinder {
public:
@ -307,4 +307,4 @@ template <typename T> void ClusterFinder<T>::store_clusters() {
}
} // namespace pl
} // namespace aare

View File

@ -9,6 +9,8 @@
#include <fmt/format.h>
#include <variant>
namespace aare{
typedef struct {
uint64_t frameNumber;
uint32_t expLength;
@ -75,4 +77,6 @@ const char big_endian_char = '>';
const char no_endian_char = '|';
const std::array<char, 3> endian_chars = {little_endian_char, big_endian_char, no_endian_char};
const std::array<char, 4> numtype_chars = {'f', 'i', 'u', 'c'};
const std::array<char, 4> numtype_chars = {'f', 'i', 'u', 'c'};
} // namespace aare

View File

@ -2,6 +2,9 @@
#include "aare/utils/logger.hpp"
#include <iostream>
#include <cassert>
namespace aare {
Frame::Frame(std::byte* bytes, ssize_t rows, ssize_t cols, ssize_t bitdepth):
m_rows(rows), m_cols(cols), m_bitdepth(bitdepth) {
m_data = new std::byte[rows*cols*bitdepth/8];
@ -48,4 +51,4 @@ template void Frame::set(int row, int col, uint32_t data);
// return array;
// }
} // namespace aare

View File

@ -1,5 +1,7 @@
#include "aare/defs.hpp"
namespace aare {
template <> std::string toString(DetectorType type) {
switch (type) {
case DetectorType::Jungfrau:
@ -45,4 +47,6 @@ template <> TimingMode StringTo(std::string mode) {
}
}
// template <> TimingMode StringTo<TimingMode>(std::string mode);
// template <> TimingMode StringTo<TimingMode>(std::string mode);
} // namespace aare

View File

@ -3,8 +3,10 @@
#include <array>
// using reuss::DataSpan;
// using reuss::Shape;
using aare::NDArray;
using aare::NDView;
using aare::Shape;
TEST_CASE("Initial size is zero if no size is specified")
{

View File

@ -4,7 +4,8 @@
#include <iostream>
#include <vector>
using aare::NDView;
using aare::Shape;
TEST_CASE("Element reference 1D") {
std::vector<int> vec;

View File

@ -4,5 +4,5 @@
TEST_CASE("Enum to string conversion"){
//By the way I don't think the enum string conversions should be in the defs.hpp file
//but let's use this to show a test
REQUIRE(toString(DetectorType::Jungfrau) == "Jungfrau");
REQUIRE(toString(aare::DetectorType::Jungfrau) == "Jungfrau");
}

View File

@ -4,6 +4,10 @@
#include <catch2/catch_test_macros.hpp>
#include <cstdint>
using aare::Frame;
using aare::NDView;
using aare::NDArray;
TEST_CASE("Frame") {
auto data = new uint16_t[100];
for (int i = 0; i < 100; i++) {