aare/examples/json_example.cpp
Bechir Braham e280742a6c
add logger class (#29)
* add logger class

* add LOCATION macro for logger

* added printing in files
2024-03-26 17:40:19 +01:00

35 lines
1.0 KiB
C++

// Your First C++ Program
#include "aare/ContextManager.hpp"
#include <iostream>
#include "aare/utils/logger.hpp"
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"
void test(File *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;
}
int main() {
ContextManager ctx_manager;
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;
File *file = ctx_manager.get_file(fpath);
test(file, 0);
test(file, 2);
test(file, 9);
aare::logger::debug(LOCATION,"Hello", "World");
}