Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions core/foundation/inc/ROOT/RConfig.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,14 @@
#define _R__DEPRECATED_640(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
#endif

/* USE AS `R__DEPRECATED(6,42, "Not threadsafe; use TFoo::Bar().")`
To be removed by 6.42 */
#if ROOT_VERSION_CODE <= ROOT_VERSION(6, 41, 0)
#define _R__DEPRECATED_642(REASON) _R__DEPRECATED_LATER(REASON)
#else
#define _R__DEPRECATED_642(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
#endif

/* USE AS `R__DEPRECATED(7,00, "Not threadsafe; use TFoo::Bar().")`
To be removed by 7.00 */
#if ROOT_VERSION_CODE < ROOT_VERSION(6,99,0)
Expand Down
12 changes: 7 additions & 5 deletions tree/ntuple/inc/ROOT/RField.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public:
/// future RNTuple versions (e.g. an unknown Structure)
class RInvalidField final : public RFieldBase {
public:
enum class RCategory {
enum class ECategory {
/// Generic unrecoverable error
kGeneric,
/// The type given to RFieldBase::Create was invalid
Expand All @@ -82,9 +82,11 @@ public:
kUnknownStructure,
};

using RCategory R__DEPRECATED(6, 42, "enum renamed to ECategory") = ECategory;

private:
std::string fError;
RCategory fCategory;
ECategory fCategory;

protected:
std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final
Expand All @@ -94,14 +96,14 @@ protected:
void ConstructValue(void *) const final {}

public:
RInvalidField(std::string_view name, std::string_view type, std::string_view error, RCategory category)
RInvalidField(std::string_view name, std::string_view type, std::string_view error, ECategory category)
: RFieldBase(name, type, ROOT::ENTupleStructure::kLeaf, false /* isSimple */), fError(error), fCategory(category)
{
fTraits |= kTraitInvalidField;
}

const std::string &GetError() const { return fError; }
RCategory GetCategory() const { return fCategory; }
ECategory GetCategory() const { return fCategory; }

size_t GetValueSize() const final { return 0; }
size_t GetAlignment() const final { return 0; }
Expand Down Expand Up @@ -214,7 +216,7 @@ private:

TClass *fClass = nullptr;
ROOT::Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos; ///< streamer info records seen during writing
ROOT::Internal::RColumnIndex fIndex; ///< number of bytes written in the current cluster
ROOT::Internal::RColumnIndex fIndex; ///< number of bytes written in the current cluster

private:
RStreamerField(std::string_view fieldName, TClass *classp);
Expand Down
10 changes: 5 additions & 5 deletions tree/ntuple/src/RFieldBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ ROOT::RFieldBase::Create(const std::string &fieldName, const std::string &typeNa

auto fnFail = [&fieldName,
&resolvedType](const std::string &errMsg,
RInvalidField::RCategory cat =
RInvalidField::RCategory::kTypeError) -> RResult<std::unique_ptr<RFieldBase>> {
RInvalidField::ECategory cat =
RInvalidField::ECategory::kTypeError) -> RResult<std::unique_ptr<RFieldBase>> {
if (createContext.GetContinueOnError()) {
return std::unique_ptr<RFieldBase>(std::make_unique<RInvalidField>(fieldName, resolvedType, errMsg, cat));
} else {
Expand Down Expand Up @@ -603,15 +603,15 @@ ROOT::RFieldBase::Create(const std::string &fieldName, const std::string &typeNa
auto error = e.GetError();
if (createContext.GetContinueOnError()) {
return std::unique_ptr<RFieldBase>(std::make_unique<RInvalidField>(fieldName, typeName, error.GetReport(),
RInvalidField::RCategory::kGeneric));
RInvalidField::ECategory::kGeneric));
} else {
return error;
}
} catch (const std::logic_error &e) {
// Integer parsing error
if (createContext.GetContinueOnError()) {
return std::unique_ptr<RFieldBase>(
std::make_unique<RInvalidField>(fieldName, typeName, e.what(), RInvalidField::RCategory::kGeneric));
std::make_unique<RInvalidField>(fieldName, typeName, e.what(), RInvalidField::ECategory::kGeneric));
} else {
return R__FAIL(e.what());
}
Expand All @@ -624,7 +624,7 @@ ROOT::RFieldBase::Create(const std::string &fieldName, const std::string &typeNa
}
return result;
}
return R__FORWARD_RESULT(fnFail("unknown type: " + typeName, RInvalidField::RCategory::kUnknownType));
return R__FORWARD_RESULT(fnFail("unknown type: " + typeName, RInvalidField::ECategory::kUnknownType));
}

const ROOT::RFieldBase::RColumnRepresentations &ROOT::RFieldBase::GetColumnRepresentations() const
Expand Down
6 changes: 3 additions & 3 deletions tree/ntuple/src/RNTupleDescriptor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ROOT::RFieldDescriptor::CreateField(const RNTupleDescriptor &ntplDesc, const ROO
if (GetStructure() == ROOT::ENTupleStructure::kUnknown) {
if (options.GetReturnInvalidOnError()) {
auto invalidField = std::make_unique<ROOT::RInvalidField>(GetFieldName(), GetTypeName(), "",
ROOT::RInvalidField::RCategory::kUnknownStructure);
ROOT::RInvalidField::ECategory::kUnknownStructure);
invalidField->SetOnDiskId(fFieldId);
return invalidField;
} else {
Expand Down Expand Up @@ -144,7 +144,7 @@ ROOT::RFieldDescriptor::CreateField(const RNTupleDescriptor &ntplDesc, const ROO
} catch (const RException &ex) {
if (options.GetReturnInvalidOnError())
return std::make_unique<ROOT::RInvalidField>(GetFieldName(), GetTypeName(), ex.GetError().GetReport(),
ROOT::RInvalidField::RCategory::kGeneric);
ROOT::RInvalidField::ECategory::kGeneric);
else
throw ex;
}
Expand Down Expand Up @@ -702,7 +702,7 @@ std::unique_ptr<ROOT::RNTupleModel> ROOT::RNTupleDescriptor::CreateModel(const R
if (field->GetTraits() & ROOT::RFieldBase::kTraitInvalidField) {
const auto &invalid = static_cast<const RInvalidField &>(*field);
const auto cat = invalid.GetCategory();
bool mustThrow = cat != RInvalidField::RCategory::kUnknownStructure;
bool mustThrow = cat != RInvalidField::ECategory::kUnknownStructure;
if (mustThrow)
throw invalid.GetError();

Expand Down
Loading