From 8d50bdc8c42c15f60f1f21e46704d8bca7eb75c5 Mon Sep 17 00:00:00 2001 From: Sergey Linev <S.Linev@gsi.de> Date: Thu, 28 Feb 2019 09:46:44 +0100 Subject: [PATCH] eve7: small changes after @codacy-bot comments Use explicit constructors, reduce number of constructors for some classes --- graf3d/eve7/inc/ROOT/REveChunkManager.hxx | 9 ++++----- graf3d/eve7/inc/ROOT/REveTypes.hxx | 11 ++--------- graf3d/eve7/src/REveChunkManager.cxx | 10 +++++----- graf3d/eve7/src/REveGeoShapeExtract.cxx | 2 +- graf3d/eve7/src/REveTypes.cxx | 2 +- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/graf3d/eve7/inc/ROOT/REveChunkManager.hxx b/graf3d/eve7/inc/ROOT/REveChunkManager.hxx index d798b855751..55169aa800b 100644 --- a/graf3d/eve7/inc/ROOT/REveChunkManager.hxx +++ b/graf3d/eve7/inc/ROOT/REveChunkManager.hxx @@ -70,7 +70,7 @@ public: struct iterator { - REveChunkManager *fPlex{nullptr}; + REveChunkManager &fPlex; Char_t *fCurrent{nullptr}; Int_t fAtomIndex{-1}; Int_t fNextChunk{0}; @@ -79,11 +79,9 @@ public: const std::set<Int_t> *fSelection{nullptr}; std::set<Int_t>::const_iterator fSelectionIterator; - iterator(REveChunkManager *p) : fPlex(p) {} + iterator(REveChunkManager &p) : fPlex(p) {} - iterator(REveChunkManager &p) : fPlex(&p) {} - - iterator(const iterator &i) : +/* iterator(const iterator &i) : fPlex(i.fPlex), fCurrent(i.fCurrent), fAtomIndex(i.fAtomIndex), fNextChunk(i.fNextChunk), fAtomsToGo(i.fAtomsToGo), fSelection(i.fSelection), fSelectionIterator(i.fSelectionIterator) {} @@ -94,6 +92,7 @@ public: fSelection = i.fSelection; fSelectionIterator = i.fSelectionIterator; return *this; } +*/ Bool_t next(); void reset() { fCurrent = nullptr; fAtomIndex = -1; fNextChunk = fAtomsToGo = 0; } diff --git a/graf3d/eve7/inc/ROOT/REveTypes.hxx b/graf3d/eve7/inc/ROOT/REveTypes.hxx index 8c239b27886..7f02e2d443c 100644 --- a/graf3d/eve7/inc/ROOT/REveTypes.hxx +++ b/graf3d/eve7/inc/ROOT/REveTypes.hxx @@ -37,19 +37,12 @@ bool operator==(const std::string &s, const TString &t); /// Exception-type thrown by Eve classes. //////////////////////////////////////////////////////////////////////////////// -class REveException : public std::exception -{ +class REveException : public std::exception { std::string fWhat; public: REveException() = default; - REveException(const TString &s) : fWhat(s.Data()) {} - REveException(const char *s) : fWhat(s) {} - REveException(const std::string &s) : fWhat(s) {} - + explicit REveException(const std::string &s) : fWhat(s) {} virtual ~REveException() noexcept {} - - void append(const char *s) { fWhat.append(s); } - void append(const TString &s) { fWhat.append(s.Data()); } void append(const std::string &s) { fWhat.append(s); } const char *what() const noexcept override { return fWhat.c_str(); } diff --git a/graf3d/eve7/src/REveChunkManager.cxx b/graf3d/eve7/src/REveChunkManager.cxx index 9c910e7bac0..86bba644e34 100644 --- a/graf3d/eve7/src/REveChunkManager.cxx +++ b/graf3d/eve7/src/REveChunkManager.cxx @@ -115,10 +115,10 @@ Bool_t REveChunkManager::iterator::next() { if (fAtomsToGo <= 0) { - if (fNextChunk < fPlex->VecSize()) + if (fNextChunk < fPlex.VecSize()) { - fCurrent = fPlex->Chunk(fNextChunk); - fAtomsToGo = fPlex->NAtoms(fNextChunk); + fCurrent = fPlex.Chunk(fNextChunk); + fAtomsToGo = fPlex.NAtoms(fNextChunk); ++fNextChunk; } else @@ -128,7 +128,7 @@ Bool_t REveChunkManager::iterator::next() } else { - fCurrent += fPlex->S(); + fCurrent += fPlex.S(); } ++fAtomIndex; --fAtomsToGo; @@ -144,7 +144,7 @@ Bool_t REveChunkManager::iterator::next() if (fSelectionIterator != fSelection->end()) { fAtomIndex = *fSelectionIterator; - fCurrent = fPlex->Atom(fAtomIndex); + fCurrent = fPlex.Atom(fAtomIndex); return kTRUE; } else diff --git a/graf3d/eve7/src/REveGeoShapeExtract.cxx b/graf3d/eve7/src/REveGeoShapeExtract.cxx index 4ac01cf9b20..60767245980 100644 --- a/graf3d/eve7/src/REveGeoShapeExtract.cxx +++ b/graf3d/eve7/src/REveGeoShapeExtract.cxx @@ -60,7 +60,7 @@ REveGeoShapeExtract::~REveGeoShapeExtract() Bool_t REveGeoShapeExtract::HasElements() { - return fElements && fElements->GetSize() > 0; + return fElements && (fElements->GetSize() > 0); } //////////////////////////////////////////////////////////////////////////////// diff --git a/graf3d/eve7/src/REveTypes.cxx b/graf3d/eve7/src/REveTypes.cxx index 44185c55a4b..c439cece79e 100644 --- a/graf3d/eve7/src/REveTypes.cxx +++ b/graf3d/eve7/src/REveTypes.cxx @@ -22,7 +22,7 @@ REveException REX::operator+(const REveException &s1, const std::string &s2) { REveException r(s1); r.append(s2); return r; } REveException REX::operator+(const REveException &s1, const TString &s2) -{ REveException r(s1); r.append(s2); return r; } +{ REveException r(s1); r.append(s2.Data()); return r; } REveException REX::operator+(const REveException &s1, const char *s2) { REveException r(s1); r.append(s2); return r; } -- GitLab