mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-02-02 08:54:55 +01:00
remove templates
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
30
examples/json_file_read.cpp
Normal file
30
examples/json_file_read.cpp
Normal 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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
30
examples/numpy_file_read.cpp
Normal file
30
examples/numpy_file_read.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user