mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-23 11:57:58 +02:00
reading multi port files (PR#2) (#31)
* works, not tested well on multi columns --------- Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
|
||||
set(EXAMPLE_LIST "json_example;logger_example;numpy_example")
|
||||
set(EXAMPLE_LIST "json_example;logger_example;numpy_example;multiport_example")
|
||||
foreach(example ${EXAMPLE_LIST})
|
||||
add_executable(${example} ${example}.cpp)
|
||||
target_link_libraries(${example} PUBLIC aare PRIVATE aare_compiler_flags)
|
||||
|
@ -28,8 +28,4 @@ int main() {
|
||||
test(file, 9);
|
||||
|
||||
aare::logger::debug(LOCATION,"Hello", "World");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
34
examples/multiport_example.cpp
Normal file
34
examples/multiport_example.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
// 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(255, 1023)) << 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_double_master_0.json");
|
||||
std::cout << fpath << std::endl;
|
||||
|
||||
|
||||
File *file = ctx_manager.get_file(fpath);
|
||||
test(file, 0);
|
||||
test(file, 9);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user