This commit is contained in:
2026-02-02 19:43:18 +03:00
parent b871b9dd46
commit 5b4456d6ef
4 changed files with 350 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
// #include <mcc_ccte_erfa.h>
#include <mcc_coordinate.h>
#include <mcc_deserializer.h>
#include <mcc_serializer.h>
using namespace mcc::impl;
@@ -28,12 +29,25 @@ void serialize(VT const& value)
auto err = ser(s, value);
if (err) {
std::cout << "SERIALIZing ERR: " << err << "\n";
std::cout << "SERIALIZING ERR: " << err << "\n";
} else {
std::cout << "SERIALIZED: " << s << "\n";
}
}
template <typename VT>
void deserialize(mcc::traits::mcc_input_char_range auto const& s, VT& value)
{
MccDeserializer<VT> deser;
auto err = deser(s, value);
if (err) {
std::cout << "DESERIALIZING ERR: " << err << "\n";
} else {
std::cout << "DESERIALIZION IS OK\n";
}
}
int main()
{
skypt_t::cctEngine.setStateERFA(saoras);
@@ -141,5 +155,22 @@ int main()
std::cout << "\tfor 'sky point' type: ";
serialize(pt);
std::cout << "\n\nDESERIALIZATION TEST:\n";
v = 0.0;
std::string s = "123.7687";
deserialize(s, v);
std::cout << "\tfor 'double' type: v = " << v << "\n";
s = " 11:22:33.453, -32.19820931,65632.87987987,RADEC-OBS ";
deserialize(s, pt);
pt.toAtSameEpoch(radec_obs);
std::cout << "\tfor 'sky point' type: x = " << radec_obs.x().sexagesimal(true)
<< ", y = " << radec_obs.y().degrees() << ", epoch = " << pt.epoch().MJD()
<< ", kind = " << MccCoordPairKindToStr(pt.pairKind()) << "\n";
return 0;
}