fix ci and add formatting (#48)

* add dependency

* dont run blocking zmq example and add formatting

* format files
This commit is contained in:
Bechir Braham
2024-04-03 13:47:52 +02:00
committed by GitHub
parent 23c855acbc
commit 31a20d4f6c
34 changed files with 438 additions and 522 deletions

View File

@ -8,7 +8,7 @@
using aare::File;
using aare::Frame;
void test(File& f, int frame_number) {
void test(File &f, int frame_number) {
std::cout << "frame number: " << frame_number << std::endl;
Frame frame = f.iread(frame_number);
std::cout << *((uint16_t *)frame.get(0, 0)) << std::endl;

View File

@ -1,6 +1,6 @@
#include "aare/utils/logger.hpp"
#include <iostream>
#include <fstream>
#include <iostream>
int main() {
aare::logger::debug(LOCATION, "hello", 1, "world", std::vector<long>{1, 2, 3, 4, 5});
@ -9,15 +9,12 @@ int main() {
aare::logger::debug(LOCATION, "NOTHING SHOULD BE PRINTED");
aare::logger::info(LOCATION, "info printed");
// writing to file
std::ofstream textfile;
textfile.open("Test.txt");
aare::logger::set_streams(textfile.rdbuf());
aare::logger::info(LOCATION, "info printed to file");
// writing with a local logger instance
aare::logger::Logger logger;
logger.set_verbosity(aare::logger::WARNING);
@ -27,7 +24,6 @@ int main() {
aare::logger::info(LOCATION, "info printed in file ##");
textfile.close();
// setting file output by path
// user doesn't have to close file
aare::logger::set_output_file("Test2.txt");

View File

@ -2,7 +2,6 @@
#include "aare/File.hpp"
#include "aare/utils/logger.hpp"
#include <iostream>
#include <iostream>
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"

View File

@ -7,7 +7,7 @@
using aare::File;
using aare::Frame;
void test(File& f, int frame_number) {
void test(File &f, int frame_number) {
std::cout << "frame number: " << frame_number << std::endl;
Frame frame = f.iread(frame_number);
std::cout << *((uint16_t *)frame.get(0, 0)) << std::endl;
@ -22,7 +22,7 @@ int main() {
std::filesystem::path fpath(PROJECT_ROOT_DIR / "data" / "numpy" / "test_numpy_file.npy");
std::cout << fpath << std::endl;
File file(fpath,"r");
File file(fpath, "r");
test(file, 0);
test(file, 2);
test(file, 24);

View File

@ -9,23 +9,19 @@ using aare::File;
using aare::FileConfig;
using aare::Frame;
int main() {
auto path = std::filesystem::path("/tmp/test.npy");
auto dtype = aare::DType(typeid(uint32_t));
FileConfig cfg = {path, dtype, 100, 100};
File npy(path, "w",cfg);
File npy(path, "w", cfg);
Frame f(100, 100, dtype.bitdepth());
for (int i = 0; i < 10000; i++) {
f.set<uint32_t>(i/100, i%100,i);
f.set<uint32_t>(i / 100, i % 100, i);
}
npy.write(f);
f.set<uint32_t>(0,0,77);
f.set<uint32_t>(0, 0, 77);
npy.write(f);
npy.write(f);
return 0;
}

View File

@ -1,14 +1,14 @@
// Your First C++ Program
#include "aare/File.hpp"
#include <iostream>
#include "aare/utils/logger.hpp"
#include <iostream>
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"
using aare::File;
using aare::Frame;
void test(File& f, int frame_number) {
void test(File &f, int frame_number) {
std::cout << "frame number: " << frame_number << std::endl;
Frame frame = f.iread(frame_number);
std::cout << *((uint16_t *)frame.get(0, 0)) << std::endl;
@ -21,7 +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 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);

View File

@ -1,18 +1,15 @@
#include <string>
#include <fmt/core.h>
#include "aare/ZmqSocket.hpp"
#include <fmt/core.h>
#include <string>
int main(){
int main() {
std::string endpoint = "tcp://localhost:5555";
aare::ZmqSocket socket(endpoint);
socket.connect();
char* data = new char[1024*1024*10];
char *data = new char[1024 * 1024 * 10];
aare::zmqHeader header;
while(true){
int rc = socket.receive(header, reinterpret_cast<std::byte*>(data));
while (true) {
int rc = socket.receive(header, reinterpret_cast<std::byte *>(data));
}
delete[] data;
return 0;