...
This commit is contained in:
@@ -152,18 +152,41 @@ public:
|
||||
return mcc_deduce_error(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_TIMEFROM_FUNC));
|
||||
});
|
||||
|
||||
_intersectZoneFuncCPT.emplace_back([sptr](const MccCelestialPoint& pt, MccCelestialPoint* res_pt) {
|
||||
// _intersectZoneFuncCPT.emplace_back([sptr](const MccCelestialPoint& pt, MccCelestialPoint* res_pt) {
|
||||
// auto ret = sptr->intersectPZone(pt, res_pt);
|
||||
|
||||
// return mcc_deduce_error(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC));
|
||||
// });
|
||||
|
||||
// _intersectZoneFuncEHC.emplace_back([sptr](const MccEqtHrzCoords& pt, MccCelestialPoint* res_pt) {
|
||||
// auto ret = sptr->intersectPZone(pt, res_pt);
|
||||
|
||||
// return mcc_deduce_error(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC));
|
||||
// });
|
||||
|
||||
_intersectZoneFuncCPT2CPT.emplace_back([sptr](const MccCelestialPoint& pt, MccCelestialPoint* res_pt) {
|
||||
auto ret = sptr->intersectPZone(pt, res_pt);
|
||||
|
||||
return mcc_deduce_error(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC));
|
||||
});
|
||||
|
||||
_intersectZoneFuncEHC.emplace_back([sptr](const MccEqtHrzCoords& pt, MccCelestialPoint* res_pt) {
|
||||
_intersectZoneFuncEHC2CPT.emplace_back([sptr](const MccEqtHrzCoords& pt, MccCelestialPoint* res_pt) {
|
||||
auto ret = sptr->intersectPZone(pt, res_pt);
|
||||
|
||||
return mcc_deduce_error(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC));
|
||||
});
|
||||
|
||||
_intersectZoneFuncCPT2EHC.emplace_back([sptr](const MccCelestialPoint& pt, MccEqtHrzCoords* res_pt) {
|
||||
auto ret = sptr->intersectPZone(pt, res_pt);
|
||||
|
||||
return mcc_deduce_error(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC));
|
||||
});
|
||||
|
||||
_intersectZoneFuncEHC2EHC.emplace_back([sptr](const MccEqtHrzCoords& pt, MccEqtHrzCoords* res_pt) {
|
||||
auto ret = sptr->intersectPZone(pt, res_pt);
|
||||
|
||||
return mcc_deduce_error(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC));
|
||||
});
|
||||
return _inZoneFuncCPT.size();
|
||||
}
|
||||
|
||||
@@ -179,8 +202,12 @@ public:
|
||||
_timeFromZoneFuncCPT.clear();
|
||||
_timeFromZoneFuncEHC.clear();
|
||||
|
||||
_intersectZoneFuncCPT.clear();
|
||||
_intersectZoneFuncEHC.clear();
|
||||
// _intersectZoneFuncCPT.clear();
|
||||
// _intersectZoneFuncEHC.clear();
|
||||
_intersectZoneFuncCPT2CPT.clear();
|
||||
_intersectZoneFuncEHC2CPT.clear();
|
||||
_intersectZoneFuncCPT2EHC.clear();
|
||||
_intersectZoneFuncEHC2EHC.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -298,14 +325,51 @@ public:
|
||||
return forEach(coords, apply_func, _timeFromZoneFuncCPT, _timeFromZoneFuncEHC);
|
||||
}
|
||||
|
||||
// template <typename InputT, mcc_celestial_point_c CPT>
|
||||
// error_t intersectPZone(InputT coords, std::ranges::output_range<CPT> auto* result)
|
||||
// requires(mcc_eqt_hrz_coord_c<InputT> || mcc_celestial_point_c<InputT>)
|
||||
template <typename InputT, typename R>
|
||||
error_t intersectPZone(InputT coords, R* result)
|
||||
requires(mcc_eqt_hrz_coord_c<InputT> || mcc_celestial_point_c<InputT>) &&
|
||||
std::ranges::output_range<R, std::ranges::range_value_t<R>> &&
|
||||
mcc_celestial_point_c<std::ranges::range_value_t<R>>
|
||||
// template <typename InputT, typename R>
|
||||
// error_t intersectPZone(InputT coords, R* result)
|
||||
// requires(mcc_eqt_hrz_coord_c<InputT> || mcc_celestial_point_c<InputT>) &&
|
||||
// std::ranges::output_range<R, std::ranges::range_value_t<R>> &&
|
||||
// mcc_celestial_point_c<std::ranges::range_value_t<R>>
|
||||
// {
|
||||
// if (result == nullptr) {
|
||||
// return MccPZoneContainerErrorCode::ERROR_NULLPTR;
|
||||
// }
|
||||
|
||||
// if (traits::mcc_range_size(*result) < sizePZones()) {
|
||||
// return MccPZoneContainerErrorCode::ERROR_INVALID_SIZE;
|
||||
// }
|
||||
|
||||
// // using CPT = std::ranges::range_value_t<R>;
|
||||
|
||||
// MccCelestialPoint pt;
|
||||
|
||||
// auto apply_func = [&](auto& func, auto& pt_arg, size_t i) {
|
||||
// auto ptr = result->begin();
|
||||
// std::ranges::advance(ptr, i);
|
||||
|
||||
// pt.pair_kind = ptr->pair_kind;
|
||||
// pt.time_point = ptr->time_point;
|
||||
|
||||
// error_t ret = func(pt_arg, &pt);
|
||||
// if (!ret) {
|
||||
// // if (traits::mcc_range_size(*result) == i) {
|
||||
// // std::back_inserter(*result) = CPT();
|
||||
// // }
|
||||
|
||||
// mcc_copy_celestial_point(pt, &(*ptr));
|
||||
// }
|
||||
|
||||
// return ret;
|
||||
// };
|
||||
|
||||
// return forEach(coords, apply_func, _intersectZoneFuncCPT, _intersectZoneFuncEHC);
|
||||
// }
|
||||
template <typename InputT, typename ResultT>
|
||||
error_t intersectPZone(InputT coords, ResultT* result)
|
||||
requires((mcc_eqt_hrz_coord_c<InputT> || mcc_celestial_point_c<InputT>) &&
|
||||
std::ranges::output_range<ResultT, std::ranges::range_value_t<ResultT>> &&
|
||||
(mcc_eqt_hrz_coord_c<std::ranges::range_value_t<ResultT>> ||
|
||||
mcc_celestial_point_c<std::ranges::range_value_t<ResultT>>))
|
||||
{
|
||||
if (result == nullptr) {
|
||||
return MccPZoneContainerErrorCode::ERROR_NULLPTR;
|
||||
@@ -315,30 +379,40 @@ public:
|
||||
return MccPZoneContainerErrorCode::ERROR_INVALID_SIZE;
|
||||
}
|
||||
|
||||
// using CPT = std::ranges::range_value_t<R>;
|
||||
|
||||
MccCelestialPoint pt;
|
||||
|
||||
auto apply_func = [&](auto& func, auto& pt_arg, size_t i) {
|
||||
auto ptr = result->begin();
|
||||
std::ranges::advance(ptr, i);
|
||||
|
||||
pt.pair_kind = ptr->pair_kind;
|
||||
pt.time_point = ptr->time_point;
|
||||
error_t ret;
|
||||
if constexpr (mcc_eqt_hrz_coord_c<ResultT>) {
|
||||
MccEqtHrzCoords pt;
|
||||
|
||||
error_t ret = func(pt_arg, &pt);
|
||||
if (!ret) {
|
||||
// if (traits::mcc_range_size(*result) == i) {
|
||||
// std::back_inserter(*result) = CPT();
|
||||
// }
|
||||
mcc_tp2tp(ptr->time_point, pt.time_point);
|
||||
|
||||
mcc_copy_celestial_point(pt, &(*ptr));
|
||||
ret = func(pt_arg, &pt);
|
||||
if (!ret) {
|
||||
mcc_copy_eqt_hrz_coord(pt, &(*ptr));
|
||||
}
|
||||
} else {
|
||||
MccCelestialPoint pt;
|
||||
|
||||
pt.pair_kind = ptr->pair_kind;
|
||||
mcc_tp2tp(ptr->time_point, pt.time_point);
|
||||
|
||||
ret = func(pt_arg, &pt);
|
||||
if (!ret) {
|
||||
mcc_copy_celestial_point(pt, &(*ptr));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
return forEach(coords, apply_func, _intersectZoneFuncCPT, _intersectZoneFuncEHC);
|
||||
if constexpr (mcc_eqt_hrz_coord_c<ResultT>) {
|
||||
return forEach(coords, apply_func, _intersectZoneFuncCPT2EHC, _intersectZoneFuncEHC2EHC);
|
||||
} else {
|
||||
return forEach(coords, apply_func, _intersectZoneFuncCPT2CPT, _intersectZoneFuncEHC2CPT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -352,8 +426,13 @@ protected:
|
||||
std::vector<std::function<error_t(MccCelestialPoint const&, duration_t*)>> _timeFromZoneFuncCPT;
|
||||
std::vector<std::function<error_t(MccEqtHrzCoords const&, duration_t*)>> _timeFromZoneFuncEHC;
|
||||
|
||||
std::vector<std::function<error_t(MccCelestialPoint const&, MccCelestialPoint*)>> _intersectZoneFuncCPT;
|
||||
std::vector<std::function<error_t(MccEqtHrzCoords const&, MccCelestialPoint*)>> _intersectZoneFuncEHC;
|
||||
// std::vector<std::function<error_t(MccCelestialPoint const&, MccCelestialPoint*)>> _intersectZoneFuncCPT;
|
||||
// std::vector<std::function<error_t(MccEqtHrzCoords const&, MccCelestialPoint*)>> _intersectZoneFuncEHC;
|
||||
|
||||
std::vector<std::function<error_t(MccCelestialPoint const&, MccCelestialPoint*)>> _intersectZoneFuncCPT2CPT;
|
||||
std::vector<std::function<error_t(MccEqtHrzCoords const&, MccCelestialPoint*)>> _intersectZoneFuncEHC2CPT;
|
||||
std::vector<std::function<error_t(MccCelestialPoint const&, MccEqtHrzCoords*)>> _intersectZoneFuncCPT2EHC;
|
||||
std::vector<std::function<error_t(MccEqtHrzCoords const&, MccEqtHrzCoords*)>> _intersectZoneFuncEHC2EHC;
|
||||
|
||||
error_t forEach(auto const& coords, auto& apply_func, auto& containerCPT, auto& containerEHC)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user