...
This commit is contained in:
parent
1087e043a8
commit
83b7e0d924
@ -167,11 +167,11 @@ static constexpr ErrT mcc_deduce_error(const DErrT& err, const ErrT& default_err
|
||||
}
|
||||
}
|
||||
|
||||
template <mcc_error_c ErrT, mcc_error_c DErrT>
|
||||
template <typename ErrT, typename DErrT>
|
||||
static constexpr std::error_code mcc_deduce_error_code(const DErrT& err, const ErrT& default_err)
|
||||
requires(std::is_error_code_enum_v<ErrT> || std::derived_from<ErrT, std::error_code>)
|
||||
requires(std::is_error_code_enum_v<ErrT> || std::same_as<ErrT, std::error_code>)
|
||||
{
|
||||
if constexpr (std::is_error_code_enum_v<DErrT>) {
|
||||
if constexpr (std::is_error_code_enum_v<DErrT> || std::same_as<DErrT, std::error_code>) {
|
||||
return err;
|
||||
} else {
|
||||
return default_err;
|
||||
|
||||
@ -46,10 +46,7 @@ namespace mcc
|
||||
struct MccPZoneContainerCategory : public std::error_category {
|
||||
MccPZoneContainerCategory() : std::error_category() {}
|
||||
|
||||
const char* name() const noexcept
|
||||
{
|
||||
return "ALTITUDE-LIMIT-PZ";
|
||||
}
|
||||
const char* name() const noexcept { return "ALTITUDE-LIMIT-PZ"; }
|
||||
|
||||
std::string message(int ec) const
|
||||
{
|
||||
@ -113,41 +110,63 @@ public:
|
||||
{
|
||||
auto sptr = std::make_shared<decltype(zone)>(std::move(zone));
|
||||
|
||||
_inZoneFuncCPT.emplace_back([sptr](const MccCelestialPoint& pt, bool* res) {
|
||||
_inZoneFuncCPT.emplace_back([sptr](const MccCelestialPoint& pt, bool* res) -> error_t {
|
||||
auto ret = sptr->inPZone(pt, res);
|
||||
if (ret) {
|
||||
return mcc_deduce_error_code(ret, MccPZoneContainerErrorCode::ERROR_INZONE_FUNC);
|
||||
}
|
||||
return mcc_deduce_error_code(ret, MccPZoneContainerErrorCode::ERROR_OK);
|
||||
});
|
||||
|
||||
_inZoneFuncEHC.emplace_back([sptr](const MccEqtHrzCoords& pt, bool* res) -> error_t {
|
||||
auto ret = sptr->inPZone(pt, res);
|
||||
|
||||
return mcc_deduce_error_code(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_INZONE_FUNC));
|
||||
});
|
||||
if (ret) {
|
||||
return mcc_deduce_error_code(ret, MccPZoneContainerErrorCode::ERROR_INZONE_FUNC);
|
||||
}
|
||||
|
||||
_inZoneFuncEHC.emplace_back([sptr](const MccEqtHrzCoords& pt, bool* res) {
|
||||
auto ret = sptr->inPZone(pt, res);
|
||||
|
||||
return mcc_deduce_error_code(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_INZONE_FUNC));
|
||||
return MccPZoneContainerErrorCode::ERROR_OK;
|
||||
});
|
||||
|
||||
|
||||
_timeToZoneFuncCPT.emplace_back([sptr](const MccCelestialPoint& pt, duration_t* res_time) {
|
||||
_timeToZoneFuncCPT.emplace_back([sptr](const MccCelestialPoint& pt, duration_t* res_time) -> error_t {
|
||||
auto ret = sptr->timeToPZone(pt, res_time);
|
||||
|
||||
return mcc_deduce_error_code(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_TIMETO_FUNC));
|
||||
if (ret) {
|
||||
return mcc_deduce_error_code(ret, MccPZoneContainerErrorCode::ERROR_TIMETO_FUNC);
|
||||
}
|
||||
|
||||
return MccPZoneContainerErrorCode::ERROR_OK;
|
||||
});
|
||||
|
||||
_timeToZoneFuncEHC.emplace_back([sptr](const MccEqtHrzCoords& pt, duration_t* res_time) {
|
||||
_timeToZoneFuncEHC.emplace_back([sptr](const MccEqtHrzCoords& pt, duration_t* res_time) -> error_t {
|
||||
auto ret = sptr->timeToPZone(pt, res_time);
|
||||
|
||||
return mcc_deduce_error_code(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_TIMETO_FUNC));
|
||||
if (ret) {
|
||||
return mcc_deduce_error_code(ret, MccPZoneContainerErrorCode::ERROR_TIMETO_FUNC);
|
||||
}
|
||||
|
||||
return MccPZoneContainerErrorCode::ERROR_OK;
|
||||
});
|
||||
|
||||
_timeFromZoneFuncCPT.emplace_back([sptr](const MccCelestialPoint& pt, duration_t* res_time) {
|
||||
_timeFromZoneFuncCPT.emplace_back([sptr](const MccCelestialPoint& pt, duration_t* res_time) -> error_t {
|
||||
auto ret = sptr->timeFromPZone(pt, res_time);
|
||||
|
||||
return mcc_deduce_error_code(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_TIMEFROM_FUNC));
|
||||
if (ret) {
|
||||
return mcc_deduce_error_code(ret, MccPZoneContainerErrorCode::ERROR_TIMEFROM_FUNC);
|
||||
}
|
||||
|
||||
return MccPZoneContainerErrorCode::ERROR_OK;
|
||||
});
|
||||
|
||||
_timeFromZoneFuncEHC.emplace_back([sptr](const MccEqtHrzCoords& pt, duration_t* res_time) {
|
||||
_timeFromZoneFuncEHC.emplace_back([sptr](const MccEqtHrzCoords& pt, duration_t* res_time) -> error_t {
|
||||
auto ret = sptr->timeFromPZone(pt, res_time);
|
||||
|
||||
return mcc_deduce_error_code(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_TIMEFROM_FUNC));
|
||||
if (ret) {
|
||||
return mcc_deduce_error_code(ret, MccPZoneContainerErrorCode::ERROR_TIMEFROM_FUNC);
|
||||
}
|
||||
|
||||
return MccPZoneContainerErrorCode::ERROR_OK;
|
||||
});
|
||||
|
||||
// _intersectZoneFuncCPT.emplace_back([sptr](const MccCelestialPoint& pt, MccCelestialPoint* res_pt) {
|
||||
@ -164,29 +183,47 @@ public:
|
||||
// mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC));
|
||||
// });
|
||||
|
||||
_intersectZoneFuncCPT2CPT.emplace_back([sptr](const MccCelestialPoint& pt, MccCelestialPoint* res_pt) {
|
||||
_intersectZoneFuncCPT2CPT.emplace_back(
|
||||
[sptr](const MccCelestialPoint& pt, MccCelestialPoint* res_pt) -> error_t {
|
||||
auto ret = sptr->intersectPZone(pt, res_pt);
|
||||
|
||||
return mcc_deduce_error_code(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC));
|
||||
if (ret) {
|
||||
return mcc_deduce_error_code(ret, MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC);
|
||||
}
|
||||
|
||||
return MccPZoneContainerErrorCode::ERROR_OK;
|
||||
});
|
||||
|
||||
_intersectZoneFuncEHC2CPT.emplace_back([sptr](const MccEqtHrzCoords& pt, MccCelestialPoint* res_pt) {
|
||||
_intersectZoneFuncEHC2CPT.emplace_back([sptr](const MccEqtHrzCoords& pt, MccCelestialPoint* res_pt) -> error_t {
|
||||
auto ret = sptr->intersectPZone(pt, res_pt);
|
||||
|
||||
return mcc_deduce_error_code(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC));
|
||||
if (ret) {
|
||||
return mcc_deduce_error_code(ret, MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC);
|
||||
}
|
||||
|
||||
return MccPZoneContainerErrorCode::ERROR_OK;
|
||||
});
|
||||
|
||||
_intersectZoneFuncCPT2EHC.emplace_back([sptr](const MccCelestialPoint& pt, MccEqtHrzCoords* res_pt) {
|
||||
_intersectZoneFuncCPT2EHC.emplace_back([sptr](const MccCelestialPoint& pt, MccEqtHrzCoords* res_pt) -> error_t {
|
||||
auto ret = sptr->intersectPZone(pt, res_pt);
|
||||
|
||||
return mcc_deduce_error_code(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC));
|
||||
if (ret) {
|
||||
return mcc_deduce_error_code(ret, MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC);
|
||||
}
|
||||
|
||||
return MccPZoneContainerErrorCode::ERROR_OK;
|
||||
});
|
||||
|
||||
_intersectZoneFuncEHC2EHC.emplace_back([sptr](const MccEqtHrzCoords& pt, MccEqtHrzCoords* res_pt) {
|
||||
_intersectZoneFuncEHC2EHC.emplace_back([sptr](const MccEqtHrzCoords& pt, MccEqtHrzCoords* res_pt) -> error_t {
|
||||
auto ret = sptr->intersectPZone(pt, res_pt);
|
||||
|
||||
return mcc_deduce_error_code(ret, mcc::make_error_code(MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC));
|
||||
if (ret) {
|
||||
return mcc_deduce_error_code(ret, MccPZoneContainerErrorCode::ERROR_INTERSECT_FUNC);
|
||||
}
|
||||
|
||||
return MccPZoneContainerErrorCode::ERROR_OK;
|
||||
});
|
||||
|
||||
return _inZoneFuncCPT.size();
|
||||
}
|
||||
|
||||
@ -211,10 +248,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
size_t sizePZones() const
|
||||
{
|
||||
return _inZoneFuncCPT.size();
|
||||
}
|
||||
size_t sizePZones() const { return _inZoneFuncCPT.size(); }
|
||||
|
||||
|
||||
template <typename InputT>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user