6#ifndef RTMSTOOLS2_COMMON_LLNETIO_HPP_
7#define RTMSTOOLS2_COMMON_LLNETIO_HPP_
12#include <fmt/format.h>
14#include <boost/endian/arithmetic.hpp>
19#include <ifw/fnd/defs/dataType.hpp>
20#include <ifw/fnd/tools/tools.hpp>
31 if (__rtmstools_debug__ == -1) { \
32 __rtmstools_debug__ = std::getenv(RTMSTOOLS_DEBUG) != nullptr; \
34 if (__rtmstools_debug__)
36#define RTT_PRINT(msg) \
38 fmt::print("RTMSTOOLS-DEBUG:{}:{}: {}\n", ifw::rtmstools::rtmslib_llnetio::Time(), IFWLOC, msg); \
44 std::chrono::time_point<std::chrono::system_clock> now = std::chrono::system_clock::now();
45 auto duration = now.time_since_epoch();
46 auto time_now_ns = std::chrono::duration_cast<std::chrono::nanoseconds>(duration).count();
47 return (time_now_ns / 1e9);
50 inline void Sleep(
const double sleep_time) {
51 std::chrono::duration<double> chrono_sleep_time(sleep_time);
52 std::this_thread::sleep_for(chrono_sleep_time);
56 const int cfitsio_status);
58 std::tuple<std::vector<uint8_t>, int, int, int,
int>
LoadFitsImageCube(
const char* filename);
62 case BYTE_IMG:
return TBYTE;
63 case SHORT_IMG:
return TSHORT;
64 case USHORT_IMG:
return TUSHORT;
65 case LONG_IMG:
return TINT;
66 case ULONG_IMG:
return TULONG;
67 case LONGLONG_IMG:
return TLONGLONG;
68 case ULONGLONG_IMG:
return TULONGLONG;
69 case FLOAT_IMG:
return TFLOAT;
70 case DOUBLE_IMG:
return TDOUBLE;
72 std::cerr <<
"Unknown BITPIX value: " << bitpix << std::endl;
80 return ifw::fnd::datatype::DataType::BYTE;
82 return ifw::fnd::datatype::DataType::INT16;
84 return ifw::fnd::datatype::DataType::UINT16;
86 return ifw::fnd::datatype::DataType::INT32;
88 return ifw::fnd::datatype::DataType::FLOAT;
90 return ifw::fnd::datatype::DataType::INT64;
92 return ifw::fnd::datatype::DataType::DOUBLE;
94 return ifw::fnd::datatype::DataType::INVALID;