remove templates

This commit is contained in:
Bechir Braham
2024-03-20 13:14:14 +01:00
parent 4da9bc0813
commit cd905e96f3
25 changed files with 223 additions and 200 deletions

View File

@@ -1,8 +1,13 @@
add_executable(example "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp")
add_executable(json_example json_file_read.cpp)
add_executable(numpy_example numpy_file_read.cpp)
target_include_directories(example PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(example PRIVATE aare_compiler_flags)
target_link_libraries(json_example PRIVATE aare_compiler_flags)
target_link_libraries(numpy_example PRIVATE aare_compiler_flags)
target_link_libraries(json_example PUBLIC aare)
target_link_libraries(numpy_example PUBLIC aare)

View File

@@ -0,0 +1,30 @@
// Your First C++ Program
#include "aare/FileHandler.hpp"
#include <iostream>
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"
void test(FileHandler *f, int frame_number) {
std::cout << "frame number: " << frame_number << std::endl;
Frame *frame = f->get_frame(frame_number);
std::cout << *((uint16_t *)frame->get(0, 0)) << std::endl;
std::cout << *((uint16_t *)frame->get(0, 1)) << std::endl;
std::cout << *((uint16_t *)frame->get(1, 0)) << std::endl;
std::cout << *((uint16_t *)frame->get(511, 1023)) << std::endl;
delete frame;
}
int main() {
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "jungfrau_single_master_0.json");
// std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "test_numpy_file.npy");
std::cout << fpath << std::endl;
auto fileHandler = new FileHandler(fpath);
test(fileHandler, 0);
test(fileHandler, 2);
test(fileHandler, 9);
delete fileHandler;
}

View File

@@ -1,35 +0,0 @@
// Your First C++ Program
#include "aare/FileHandler.hpp"
#include <iostream>
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"
using JFileHandler = FileHandler<DetectorType::Jungfrau, uint16_t>;
using JFile = File<DetectorType::Jungfrau, uint16_t>;
using JFrame = Frame<uint16_t>;
void test(JFileHandler *f, int frame_number) {
std::cout << "frame number: " << frame_number << std::endl;
JFrame *frame = f->get_frame(frame_number);
std::cout << frame->get(0, 0) << std::endl;
std::cout << frame->get(0, 1) << std::endl;
std::cout << frame->get(1, 0) << std::endl;
std::cout << frame->get(49, 49) << std::endl;
delete frame;
}
int main() {
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
// std::filesystem::path fpath("/home/bb/github/aare/data/jungfrau_single_master_0.json");
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "test_numpy_file.npy");
std::cout<<fpath<<std::endl;
auto fileHandler = new JFileHandler(fpath);
test(fileHandler, 0);
test(fileHandler, 24);
delete fileHandler;
}

View File

@@ -0,0 +1,30 @@
// Your First C++ Program
#include "aare/FileHandler.hpp"
#include <iostream>
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"
void test(FileHandler *f, int frame_number) {
std::cout << "frame number: " << frame_number << std::endl;
Frame *frame = f->get_frame(frame_number);
std::cout << *((uint16_t *)frame->get(0, 0)) << std::endl;
std::cout << *((uint16_t *)frame->get(0, 1)) << std::endl;
std::cout << *((uint16_t *)frame->get(1, 0)) << std::endl;
std::cout << *((uint16_t *)frame->get(49, 49)) << std::endl;
delete frame;
}
int main() {
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
// std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "jungfrau_single_master_0.json");
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "test_numpy_file.npy");
std::cout << fpath << std::endl;
auto fileHandler = new FileHandler(fpath);
test(fileHandler, 0);
test(fileHandler, 2);
test(fileHandler, 24);
delete fileHandler;
}