Skip to content

Commit

Permalink
namespace layering: move RResultBase out of 'Internal'
Browse files Browse the repository at this point in the history
  • Loading branch information
jblomer committed Jan 29, 2024
1 parent 2e0ca93 commit 5c6ab3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
12 changes: 4 additions & 8 deletions core/foundation/v7/inc/ROOT/RError.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,9 @@ public:
const RError &GetError() const { return fError; }
};


namespace Internal {
// clang-format off
/**
\class ROOT::Experimental::Internal::RResultBase
\class ROOT::Experimental::RResultBase
\ingroup Base
\brief Common handling of the error case for RResult<T> (T != void) and RResult<void>
Expand Down Expand Up @@ -142,8 +140,6 @@ public:
void *operator new[](std::size_t) = delete;
void *operator new[](std::size_t, void *) = delete;
}; // class RResultBase
} // namespace Internal


// clang-format off
/**
Expand Down Expand Up @@ -204,7 +200,7 @@ where an exception may be thrown.
*/
// clang-format on
template <typename T>
class RResult : public Internal::RResultBase {
class RResult : public RResultBase {
private:
/// The result value in case of successful execution
T fValue;
Expand Down Expand Up @@ -265,8 +261,8 @@ public:
};

/// RResult<void> has no data member and no Inspect() method but instead a Success() factory method
template<>
class RResult<void> : public Internal::RResultBase {
template <>
class RResult<void> : public RResultBase {
private:
RResult() = default;

Expand Down
6 changes: 2 additions & 4 deletions core/foundation/v7/src/RError.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ void ROOT::Experimental::RError::AddFrame(RLocation &&sourceLocation)
fStackTrace.emplace_back(sourceLocation);
}


ROOT::Experimental::Internal::RResultBase::~RResultBase() noexcept(false)
ROOT::Experimental::RResultBase::~RResultBase() noexcept(false)
{
if (R__unlikely(fError && !fIsChecked)) {
// Prevent from throwing if the object is deconstructed in the course of stack unwinding for another exception
Expand All @@ -65,8 +64,7 @@ ROOT::Experimental::Internal::RResultBase::~RResultBase() noexcept(false)
}
}


void ROOT::Experimental::Internal::RResultBase::Throw()
void ROOT::Experimental::RResultBase::Throw()
{
throw ROOT::Experimental::RException(*fError);
}

0 comments on commit 5c6ab3a

Please sign in to comment.