# HG changeset patch # User Sebastien Jodogne # Date 1604934545 -3600 # Node ID 91554aecff9a7a8854cf1792bf15e2693a4e332b # Parent 6d49e3b6ff77edeae4021e52d79090514e2cb95e removed a friend method for better abi diff -r 6d49e3b6ff77 -r 91554aecff9a OrthancFramework/Resources/CheckOrthancFrameworkSymbols.py --- a/OrthancFramework/Resources/CheckOrthancFrameworkSymbols.py Mon Nov 09 15:22:43 2020 +0100 +++ b/OrthancFramework/Resources/CheckOrthancFrameworkSymbols.py Mon Nov 09 16:09:05 2020 +0100 @@ -236,13 +236,18 @@ ReportProblem('Exported public member variable', fqn, i) elif i.kind == clang.cindex.CursorKind.FUNCTION_TEMPLATE: + # An inline function template is OK, as it is not added to + # a shared library, but compiled by the client of the library if isPublic: - ReportProblem('Exported public template method', fqn, i) + print('Detected a template function (this is fine, but avoid it as much as possible): %s' % ('::'.join(fqn + [ i.spelling ]))) + hasImplementation = False + for j in i.get_children(): + if j.kind == clang.cindex.CursorKind.COMPOUND_STMT: + hasImplementation = True - elif i.kind == clang.cindex.CursorKind.FRIEND_DECL: - if isPublic: - ReportProblem('Exported public friend method', fqn, i) - + if not hasImplementation: + ReportProblem('Exported template function without an inline implementation', fqn, i) + elif (i.kind == clang.cindex.CursorKind.TYPEDEF_DECL or # Allow "typedef" i.kind == clang.cindex.CursorKind.ENUM_DECL): # Allow enums pass diff -r 6d49e3b6ff77 -r 91554aecff9a OrthancFramework/Sources/DicomFormat/DicomTag.cpp --- a/OrthancFramework/Sources/DicomFormat/DicomTag.cpp Mon Nov 09 15:22:43 2020 +0100 +++ b/OrthancFramework/Sources/DicomFormat/DicomTag.cpp Mon Nov 09 16:09:05 2020 +0100 @@ -120,13 +120,13 @@ } - std::ostream& operator<< (std::ostream& o, const DicomTag& tag) + std::ostream& DicomTag::FormatStream(std::ostream& o) const { using namespace std; ios_base::fmtflags state = o.flags(); o.flags(ios::right | ios::hex); - o << "(" << setfill('0') << setw(4) << tag.GetGroup() - << "," << setw(4) << tag.GetElement() << ")"; + o << "(" << setfill('0') << setw(4) << GetGroup() + << "," << setw(4) << GetElement() << ")"; o.flags(state); return o; } diff -r 6d49e3b6ff77 -r 91554aecff9a OrthancFramework/Sources/DicomFormat/DicomTag.h --- a/OrthancFramework/Sources/DicomFormat/DicomTag.h Mon Nov 09 15:22:43 2020 +0100 +++ b/OrthancFramework/Sources/DicomFormat/DicomTag.h Mon Nov 09 16:09:05 2020 +0100 @@ -64,11 +64,11 @@ std::string Format() const; + std::ostream& FormatStream(std::ostream& o) const; + static bool ParseHexadecimal(DicomTag& tag, const char* value); - ORTHANC_PUBLIC friend std::ostream& operator<< (std::ostream& o, const DicomTag& tag); - static void AddTagsForModule(std::set& target, DicomModule module); }; diff -r 6d49e3b6ff77 -r 91554aecff9a OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp --- a/OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp Mon Nov 09 15:22:43 2020 +0100 +++ b/OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp Mon Nov 09 16:09:05 2020 +0100 @@ -167,7 +167,8 @@ const DicomTag& tag = query.GetElement(i).GetTag(); if (allowedTags.find(tag) == allowedTags.end()) { - CLOG(WARNING, DICOM) << "Tag not allowed for this C-Find level, will be ignored: " << tag; + CLOG(WARNING, DICOM) << "Tag not allowed for this C-Find level, will be ignored: (" + << tag.Format() << ")"; } else { diff -r 6d49e3b6ff77 -r 91554aecff9a OrthancFramework/Sources/DicomParsing/DicomModification.cpp --- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp Mon Nov 09 15:22:43 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp Mon Nov 09 16:09:05 2020 +0100 @@ -1186,12 +1186,12 @@ { case DicomModification::TagOperation_Keep: target.Keep(tag); - LOG(TRACE) << "Keep: " << name << " " << tag; + LOG(TRACE) << "Keep: " << name << " (" << tag.Format() << ")"; break; case DicomModification::TagOperation_Remove: target.Remove(tag); - LOG(TRACE) << "Remove: " << name << " " << tag; + LOG(TRACE) << "Remove: " << name << " (" << tag.Format() << ")"; break; default: @@ -1227,8 +1227,8 @@ target.Replace(tag, value, false); - LOG(TRACE) << "Replace: " << name << " " << tag - << " == " << value.toStyledString(); + LOG(TRACE) << "Replace: " << name << " (" << tag.Format() + << ") == " << value.toStyledString(); } } diff -r 6d49e3b6ff77 -r 91554aecff9a OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp --- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Mon Nov 09 15:22:43 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Mon Nov 09 16:09:05 2020 +0100 @@ -351,7 +351,8 @@ DcmEVR evr = ToDcmtkBridge::Convert(vr); - LOG(INFO) << "Registering tag in dictionary: " << tag << " " << (DcmVR(evr).getValidVRName()) << " " + LOG(INFO) << "Registering tag in dictionary: (" << tag.Format() << ") " + << (DcmVR(evr).getValidVRName()) << " " << name << " (multiplicity: " << minMultiplicity << "-" << (arbitrary ? "n" : boost::lexical_cast(maxMultiplicity)) << ")"; diff -r 6d49e3b6ff77 -r 91554aecff9a OrthancFramework/Sources/Logging.h --- a/OrthancFramework/Sources/Logging.h Mon Nov 09 15:22:43 2020 +0100 +++ b/OrthancFramework/Sources/Logging.h Mon Nov 09 16:09:05 2020 +0100 @@ -24,6 +24,7 @@ // To have ORTHANC_ENABLE_LOGGING defined if using the shared library #include "OrthancFramework.h" +#include "Compatibility.h" #include @@ -112,7 +113,7 @@ ORTHANC_PUBLIC void SetTargetFolder(const std::string& path); - struct NullStream : public std::ostream + struct ORTHANC_LOCAL NullStream : public std::ostream { NullStream() : std::ios(0), @@ -224,8 +225,6 @@ #if (ORTHANC_ENABLE_LOGGING == 1 && \ ORTHANC_ENABLE_LOGGING_STDIO == 0) -#include "Compatibility.h" // For std::unique_ptr<> - #include #include #include diff -r 6d49e3b6ff77 -r 91554aecff9a OrthancServer/Sources/OrthancFindRequestHandler.cpp --- a/OrthancServer/Sources/OrthancFindRequestHandler.cpp Mon Nov 09 15:22:43 2020 +0100 +++ b/OrthancServer/Sources/OrthancFindRequestHandler.cpp Mon Nov 09 16:09:05 2020 +0100 @@ -637,8 +637,8 @@ { if (!query.GetElement(i).GetValue().IsNull()) { - CLOG(INFO, DICOM) << " " << query.GetElement(i).GetTag() - << " " << FromDcmtkBridge::GetTagName(query.GetElement(i)) + CLOG(INFO, DICOM) << " (" << query.GetElement(i).GetTag().Format() + << ") " << FromDcmtkBridge::GetTagName(query.GetElement(i)) << " = " << query.GetElement(i).GetValue().GetContent(); } } diff -r 6d49e3b6ff77 -r 91554aecff9a OrthancServer/Sources/OrthancGetRequestHandler.cpp --- a/OrthancServer/Sources/OrthancGetRequestHandler.cpp Mon Nov 09 15:22:43 2020 +0100 +++ b/OrthancServer/Sources/OrthancGetRequestHandler.cpp Mon Nov 09 16:09:05 2020 +0100 @@ -505,8 +505,8 @@ { if (!query.GetElement(i).GetValue().IsNull()) { - CLOG(INFO, DICOM) << " " << query.GetElement(i).GetTag() - << " " << FromDcmtkBridge::GetTagName(query.GetElement(i)) + CLOG(INFO, DICOM) << " (" << query.GetElement(i).GetTag().Format() + << ") " << FromDcmtkBridge::GetTagName(query.GetElement(i)) << " = " << query.GetElement(i).GetValue().GetContent(); } } diff -r 6d49e3b6ff77 -r 91554aecff9a OrthancServer/Sources/OrthancMoveRequestHandler.cpp --- a/OrthancServer/Sources/OrthancMoveRequestHandler.cpp Mon Nov 09 15:22:43 2020 +0100 +++ b/OrthancServer/Sources/OrthancMoveRequestHandler.cpp Mon Nov 09 16:09:05 2020 +0100 @@ -342,8 +342,8 @@ { if (!query.GetElement(i).GetValue().IsNull()) { - CLOG(INFO, DICOM) << " " << query.GetElement(i).GetTag() - << " " << FromDcmtkBridge::GetTagName(query.GetElement(i)) + CLOG(INFO, DICOM) << " (" << query.GetElement(i).GetTag().Format() + << ") " << FromDcmtkBridge::GetTagName(query.GetElement(i)) << " = " << query.GetElement(i).GetValue().GetContent(); } }