mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-13 07:47:13 +02:00
use clang-tidy (#59)
* use clang-tidy for Frame.cpp * fixes for defs.cpp * clang-tidy 6/45 * clang-tidy for core * clang-tidy fixes: for hpp File,FileInterface,SubFile.cpp * ci fixes * fix build errors * fix clang-tidy command ci * fix clang-tidy ci * clang-tidy for rawfile.cpp * clang-tidy numpy helpers * fix ci * clang-tidy file_io * clang-tidy file_io and core working * zmqheader * clagn-tidy: network_io,file_io,core * clang-tidy working * format --------- Co-authored-by: Bechir <bechir.brahem420@gmail.com>
This commit is contained in:
@ -9,18 +9,18 @@ using aare::File;
|
||||
using aare::Frame;
|
||||
|
||||
void test(File &f, int frame_number) {
|
||||
std::cout << "frame number: " << frame_number << std::endl;
|
||||
std::cout << "frame number: " << frame_number << '\n';
|
||||
Frame frame = f.iread(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;
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(0, 0))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(0, 1))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(1, 0))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(511, 1023))) << '\n';
|
||||
}
|
||||
|
||||
int main() {
|
||||
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
|
||||
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "jungfrau" / "jungfrau_single_master_0.json");
|
||||
std::cout << fpath << std::endl;
|
||||
std::filesystem::path const fpath(PROJECT_ROOT_DIR / "data" / "jungfrau" / "jungfrau_single_master_0.json");
|
||||
std::cout << fpath << '\n';
|
||||
|
||||
File file(fpath, "r");
|
||||
test(file, 0);
|
||||
|
@ -9,19 +9,19 @@ using aare::File;
|
||||
using aare::Frame;
|
||||
|
||||
void test(File &f, int frame_number) {
|
||||
std::cout << "frame number: " << frame_number << std::endl;
|
||||
std::cout << "frame number: " << frame_number << '\n';
|
||||
Frame frame = f.iread(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(0, 1)) << std::endl;
|
||||
std::cout << *((uint16_t *)frame.get(255, 1023)) << std::endl;
|
||||
std::cout << *((uint16_t *)frame.get(511, 1023)) << std::endl;
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(0, 0))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(0, 1))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(0, 1))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(255, 1023))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(511, 1023))) << '\n';
|
||||
}
|
||||
|
||||
int main() {
|
||||
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
|
||||
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "jungfrau" / "jungfrau_double_master_0.json");
|
||||
std::cout << fpath << std::endl;
|
||||
std::filesystem::path const fpath(PROJECT_ROOT_DIR / "data" / "jungfrau" / "jungfrau_double_master_0.json");
|
||||
std::cout << fpath << '\n';
|
||||
|
||||
File file(fpath, "r");
|
||||
test(file, 0);
|
||||
|
@ -9,14 +9,14 @@ using aare::File;
|
||||
using aare::Frame;
|
||||
|
||||
void test1(File &f, int frame_number) {
|
||||
std::cout << "frame number: " << frame_number << std::endl;
|
||||
std::cout << "frame number: " << frame_number << '\n';
|
||||
Frame frame = f.iread(frame_number);
|
||||
std::cout << *((uint32_t *)frame.get(0, 0)) << std::endl;
|
||||
std::cout << *((uint32_t *)frame.get(0, 1)) << std::endl;
|
||||
std::cout << *((uint32_t *)frame.get(0, 3839)) << std::endl;
|
||||
std::cout << *(reinterpret_cast<uint32_t *>(frame.get(0, 0))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint32_t *>(frame.get(0, 1))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint32_t *>(frame.get(0, 3839))) << '\n';
|
||||
|
||||
for (int i = 0; i < 3840; i++) {
|
||||
uint16_t x = *((uint32_t *)frame.get(0, i));
|
||||
uint16_t const x = *(reinterpret_cast<uint32_t *>(frame.get(0, i)));
|
||||
if (x != i) {
|
||||
aare::logger::error("error at i", i, "x", x);
|
||||
}
|
||||
@ -24,11 +24,11 @@ void test1(File &f, int frame_number) {
|
||||
}
|
||||
|
||||
void test2(File &f, int frame_number) {
|
||||
std::cout << "frame number: " << frame_number << std::endl;
|
||||
std::cout << "frame number: " << frame_number << '\n';
|
||||
Frame frame = f.iread(frame_number);
|
||||
std::cout << *((uint32_t *)frame.get(0, 0)) << std::endl;
|
||||
std::cout << *((uint32_t *)frame.get(0, 1)) << std::endl;
|
||||
std::cout << *((uint32_t *)frame.get(0, 1280 * 4 - 1)) << std::endl;
|
||||
std::cout << *(reinterpret_cast<uint32_t *>(frame.get(0, 0))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint32_t *>(frame.get(0, 1))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint32_t *>(frame.get(0, 1280 * 4 - 1))) << '\n';
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
@ -8,19 +8,19 @@ using aare::File;
|
||||
using aare::Frame;
|
||||
|
||||
void test(File &f, int frame_number) {
|
||||
std::cout << "frame number: " << frame_number << std::endl;
|
||||
std::cout << "frame number: " << frame_number << '\n';
|
||||
Frame frame = f.iread(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;
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(0, 0))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(0, 1))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(1, 0))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(49, 49))) << '\n';
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
auto PROJECT_ROOT_DIR = std::filesystem::path(getenv(AARE_ROOT_DIR_VAR));
|
||||
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "numpy" / "test_numpy_file.npy");
|
||||
std::cout << fpath << std::endl;
|
||||
std::filesystem::path const fpath(PROJECT_ROOT_DIR / "data" / "numpy" / "test_numpy_file.npy");
|
||||
std::cout << fpath << '\n';
|
||||
|
||||
File file(fpath, "r");
|
||||
test(file, 0);
|
||||
|
@ -12,7 +12,7 @@ using aare::Frame;
|
||||
int main() {
|
||||
auto path = std::filesystem::path("/tmp/test.npy");
|
||||
auto dtype = aare::DType(typeid(uint32_t));
|
||||
FileConfig cfg = {dtype, 100, 100};
|
||||
FileConfig const cfg = {dtype, 100, 100};
|
||||
File npy(path, "w", cfg);
|
||||
Frame f(100, 100, dtype.bitdepth());
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
|
@ -9,11 +9,11 @@ using aare::File;
|
||||
using aare::Frame;
|
||||
|
||||
void test(File &f, int frame_number) {
|
||||
std::cout << "frame number: " << frame_number << std::endl;
|
||||
std::cout << "frame number: " << frame_number << '\n';
|
||||
Frame frame = f.iread(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(0, 95)) << std::endl;
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(0, 0))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(0, 1))) << '\n';
|
||||
std::cout << *(reinterpret_cast<uint16_t *>(frame.get(0, 95))) << '\n';
|
||||
}
|
||||
|
||||
int main() {
|
||||
@ -21,8 +21,8 @@ int main() {
|
||||
if (PROJECT_ROOT_DIR.empty()) {
|
||||
throw std::runtime_error("environment variable PROJECT_ROOT_DIR is not set");
|
||||
}
|
||||
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "moench" /
|
||||
"moench04_noise_200V_sto_both_100us_no_light_thresh_900_master_0.raw");
|
||||
std::filesystem::path const fpath(PROJECT_ROOT_DIR / "data" / "moench" /
|
||||
"moench04_noise_200V_sto_both_100us_no_light_thresh_900_master_0.raw");
|
||||
File file(fpath, "r");
|
||||
test(file, 0);
|
||||
test(file, 2);
|
||||
|
@ -35,7 +35,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
auto port = vm["port"].as<uint16_t>();
|
||||
|
||||
std::string endpoint = "udp://127.0.0.1:" + std::to_string(port);
|
||||
std::string const endpoint = "udp://127.0.0.1:" + std::to_string(port);
|
||||
aare::ZmqSocketReceiver socket(endpoint);
|
||||
socket.connect();
|
||||
while (true) {
|
||||
|
@ -48,10 +48,10 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string path = vm["file"].as<string>();
|
||||
uint16_t port = vm["port"].as<uint16_t>();
|
||||
bool loop = vm.count("loop") == 1 ? true : false;
|
||||
uint16_t fps = vm["fps"].as<uint16_t>();
|
||||
std::string const path = vm["file"].as<string>();
|
||||
uint16_t const port = vm["port"].as<uint16_t>();
|
||||
bool const loop = vm.count("loop") == 1;
|
||||
uint16_t const fps = vm["fps"].as<uint16_t>();
|
||||
|
||||
aare::logger::debug("ARGS: file:", path, "port:", port, "fps:", fps, "loop:", loop);
|
||||
auto d = round<std::chrono::milliseconds>(std::chrono::duration<double>{1. / fps});
|
||||
@ -62,17 +62,17 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::filesystem::path tmp(path);
|
||||
std::filesystem::path const tmp(path);
|
||||
|
||||
File file(tmp, "r");
|
||||
string endpoint = "tcp://*:" + std::to_string(port);
|
||||
string const endpoint = "tcp://*:" + std::to_string(port);
|
||||
ZmqSocketSender sender(endpoint);
|
||||
sender.bind();
|
||||
std::this_thread::sleep_for(d); // slow joiner problem should fix this
|
||||
|
||||
for (size_t frameidx = 0; frameidx < file.total_frames(); frameidx++) {
|
||||
|
||||
Frame frame = file.read();
|
||||
Frame const frame = file.read();
|
||||
ZmqHeader header;
|
||||
header.frameNumber = frameidx;
|
||||
header.data = true;
|
||||
|
@ -12,7 +12,7 @@ using namespace aare;
|
||||
|
||||
int main() {
|
||||
std::srand(std::time(nullptr));
|
||||
std::string endpoint = "tcp://*:5555";
|
||||
std::string const endpoint = "tcp://*:5555";
|
||||
aare::ZmqSocketSender socket(endpoint);
|
||||
socket.bind();
|
||||
Frame frame(1024, 1024, sizeof(uint32_t) * 8);
|
||||
@ -34,7 +34,7 @@ int main() {
|
||||
while (true) {
|
||||
zmq_frames.clear();
|
||||
header.acqIndex = acqid++;
|
||||
size_t n_frames = std::rand() % 10 + 1;
|
||||
size_t const n_frames = std::rand() % 10 + 1;
|
||||
|
||||
aare::logger::info("acquisition:", header.acqIndex);
|
||||
aare::logger::info("Header size:", header.to_string().size());
|
||||
@ -44,7 +44,7 @@ int main() {
|
||||
for (size_t i = 0; i < n_frames; i++) {
|
||||
zmq_frames.push_back({header, frame});
|
||||
}
|
||||
size_t rc = socket.send(zmq_frames);
|
||||
size_t const rc = socket.send(zmq_frames);
|
||||
aare::logger::info("Sent bytes", rc);
|
||||
sleep(1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user