# HG changeset patch # User Sebastien Jodogne # Date 1604601198 -3600 # Node ID b30a8de92ad931129d627d03e997cd7cfa338ff9 # Parent 3f85db78c441d7280b6e62889c8853aafc8e9567 abi continued diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Resources/CheckOrthancFrameworkSymbols.py --- a/OrthancFramework/Resources/CheckOrthancFrameworkSymbols.py Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Resources/CheckOrthancFrameworkSymbols.py Thu Nov 05 19:33:18 2020 +0100 @@ -86,6 +86,44 @@ FILES = [] COUNT = 0 +def ExploreClass(child, fqn): + visible = False + + for i in child.get_children(): + if (i.kind == clang.cindex.CursorKind.VISIBILITY_ATTR and + i.spelling == 'default'): + visible = True + + if visible: + isPublic = (child.kind == clang.cindex.CursorKind.STRUCT_DECL) + + for i in child.get_children(): + if i.kind == clang.cindex.CursorKind.CXX_ACCESS_SPEC_DECL: + isPublic = (i.access_specifier == clang.cindex.AccessSpecifier.PUBLIC) + + elif (i.kind == clang.cindex.CursorKind.CLASS_DECL or + i.kind == clang.cindex.CursorKind.STRUCT_DECL): + # This is a subclass + ExploreClass(i, fqn + [ i.spelling ]) + + elif (i.kind == clang.cindex.CursorKind.CXX_METHOD or + i.kind == clang.cindex.CursorKind.CONSTRUCTOR or + i.kind == clang.cindex.CursorKind.DESTRUCTOR): + if isPublic: + hasImplementation = False + for j in i.get_children(): + if j.kind == clang.cindex.CursorKind.COMPOUND_STMT: + hasImplementation = True + + if hasImplementation: + global FILES, COUNT + FILES.append(os.path.normpath(str(child.location.file))) + COUNT += 1 + + print('Exported public method with an implementation: %s::%s()' % + ('::'.join(fqn), i.spelling)) + + def ExploreNamespace(node, namespace): for child in node.get_children(): fqn = namespace + [ child.spelling ] @@ -95,36 +133,7 @@ elif (child.kind == clang.cindex.CursorKind.CLASS_DECL or child.kind == clang.cindex.CursorKind.STRUCT_DECL): - visible = False - - for i in child.get_children(): - if (i.kind == clang.cindex.CursorKind.VISIBILITY_ATTR and - i.spelling == 'default'): - visible = True - - if visible: - isPublic = (child.kind == clang.cindex.CursorKind.STRUCT_DECL) - - for i in child.get_children(): - if i.kind == clang.cindex.CursorKind.CXX_ACCESS_SPEC_DECL: - isPublic = (i.access_specifier == clang.cindex.AccessSpecifier.PUBLIC) - - elif (i.kind == clang.cindex.CursorKind.CXX_METHOD or - i.kind == clang.cindex.CursorKind.CONSTRUCTOR): - if isPublic: - hasImplementation = False - for j in i.get_children(): - if j.kind == clang.cindex.CursorKind.COMPOUND_STMT: - hasImplementation = True - - if hasImplementation: - global FILES, COUNT - FILES.append(str(child.location.file)) - COUNT += 1 - - print('Exported public method with an implementation: %s::%s()' % - ('::'.join(fqn), i.spelling)) - + ExploreClass(child, fqn) for node in tu.cursor.get_children(): if (node.kind == clang.cindex.CursorKind.NAMESPACE and diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Cache/SharedArchive.cpp --- a/OrthancFramework/Sources/Cache/SharedArchive.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Cache/SharedArchive.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -59,6 +59,11 @@ } } + bool SharedArchive::Accessor::IsValid() const + { + return item_ != NULL; + } + IDynamicObject& SharedArchive::Accessor::GetItem() const { diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Cache/SharedArchive.h --- a/OrthancFramework/Sources/Cache/SharedArchive.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Cache/SharedArchive.h Thu Nov 05 19:33:18 2020 +0100 @@ -61,10 +61,7 @@ Accessor(SharedArchive& that, const std::string& id); - bool IsValid() const - { - return item_ != NULL; - } + bool IsValid() const; IDynamicObject& GetItem() const; }; diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Compression/HierarchicalZipWriter.cpp --- a/OrthancFramework/Sources/Compression/HierarchicalZipWriter.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Compression/HierarchicalZipWriter.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -115,6 +115,11 @@ } } + bool HierarchicalZipWriter::Index::IsRoot() const + { + return stack_.size() == 1; + } + std::string HierarchicalZipWriter::Index::OpenFile(const char* name) { return GetCurrentDirectoryPath() + EnsureUniqueFilename(name); diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Compression/HierarchicalZipWriter.h --- a/OrthancFramework/Sources/Compression/HierarchicalZipWriter.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Compression/HierarchicalZipWriter.h Thu Nov 05 19:33:18 2020 +0100 @@ -64,10 +64,7 @@ ~Index(); - bool IsRoot() const - { - return stack_.size() == 1; - } + bool IsRoot() const; std::string OpenFile(const char* name); diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/DicomParsing/IDicomTranscoder.cpp --- a/OrthancFramework/Sources/DicomParsing/IDicomTranscoder.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/IDicomTranscoder.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -66,6 +66,11 @@ } + IDicomTranscoder::~IDicomTranscoder() + { + } + + std::string IDicomTranscoder::GetSopInstanceUid(DcmFileFormat& dicom) { if (dicom.getDataset() == NULL) @@ -163,7 +168,7 @@ } } } - + void IDicomTranscoder::DicomImage::Parse() { diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/DicomParsing/IDicomTranscoder.h --- a/OrthancFramework/Sources/DicomParsing/IDicomTranscoder.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/DicomParsing/IDicomTranscoder.h Thu Nov 05 19:33:18 2020 +0100 @@ -105,9 +105,7 @@ bool allowNewSopInstanceUid); public: - virtual ~IDicomTranscoder() - { - } + virtual ~IDicomTranscoder(); virtual bool Transcode(DicomImage& target, DicomImage& source /* in, "GetParsed()" possibly modified */, diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp --- a/OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -76,6 +76,19 @@ SystemToolbox::MakeDirectory(root); } + FilesystemStorage::FilesystemStorage(const std::string &root) : + fsyncOnWrite_(false) + { + Setup(root); + } + + FilesystemStorage::FilesystemStorage(const std::string &root, + bool fsyncOnWrite) : + fsyncOnWrite_(fsyncOnWrite) + { + Setup(root); + } + static const char* GetDescriptionInternal(FileContentType content) diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/FileStorage/FilesystemStorage.h --- a/OrthancFramework/Sources/FileStorage/FilesystemStorage.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/FileStorage/FilesystemStorage.h Thu Nov 05 19:33:18 2020 +0100 @@ -61,18 +61,10 @@ #endif public: - explicit FilesystemStorage(const std::string& root) : - fsyncOnWrite_(false) - { - Setup(root); - } + explicit FilesystemStorage(const std::string& root); FilesystemStorage(const std::string& root, - bool fsyncOnWrite) : - fsyncOnWrite_(fsyncOnWrite) - { - Setup(root); - } + bool fsyncOnWrite); virtual void Create(const std::string& uuid, const void* content, diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/HttpServer/BufferHttpSender.cpp --- a/OrthancFramework/Sources/HttpServer/BufferHttpSender.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/BufferHttpSender.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -35,6 +35,26 @@ { } + std::string &BufferHttpSender::GetBuffer() + { + return buffer_; + } + + const std::string &BufferHttpSender::GetBuffer() const + { + return buffer_; + } + + void BufferHttpSender::SetChunkSize(size_t chunkSize) + { + chunkSize_ = chunkSize; + } + + uint64_t BufferHttpSender::GetContentLength() + { + return buffer_.size(); + } + bool BufferHttpSender::ReadNextChunk() { diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/HttpServer/BufferHttpSender.h --- a/OrthancFramework/Sources/HttpServer/BufferHttpSender.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/BufferHttpSender.h Thu Nov 05 19:33:18 2020 +0100 @@ -36,32 +36,20 @@ public: BufferHttpSender(); - std::string& GetBuffer() - { - return buffer_; - } + std::string& GetBuffer(); - const std::string& GetBuffer() const - { - return buffer_; - } + const std::string& GetBuffer() const; // This is for test purpose. If "chunkSize" is set to "0" (the // default), the entire buffer is consumed at once. - void SetChunkSize(size_t chunkSize) - { - chunkSize_ = chunkSize; - } + void SetChunkSize(size_t chunkSize); /** * Implementation of the IHttpStreamAnswer interface. **/ - virtual uint64_t GetContentLength() ORTHANC_OVERRIDE - { - return buffer_.size(); - } + virtual uint64_t GetContentLength() ORTHANC_OVERRIDE; virtual bool ReadNextChunk() ORTHANC_OVERRIDE; diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/HttpServer/StringMatcher.cpp --- a/OrthancFramework/Sources/HttpServer/StringMatcher.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/StringMatcher.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -69,6 +69,16 @@ // otherwise lifetime is bad! (*) search_.reset(new Search(pattern_)); } + + const std::string &StringMatcher::GetPattern() const + { + return pattern_; + } + + bool StringMatcher::IsValid() const + { + return valid_; + } bool StringMatcher::Apply(Iterator start, @@ -91,6 +101,11 @@ return valid_; } + bool StringMatcher::Apply(const std::string &corpus) + { + return Apply(corpus.begin(), corpus.end()); + } + StringMatcher::Iterator StringMatcher::GetMatchBegin() const { diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/HttpServer/StringMatcher.h --- a/OrthancFramework/Sources/HttpServer/StringMatcher.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/StringMatcher.h Thu Nov 05 19:33:18 2020 +0100 @@ -48,23 +48,14 @@ public: explicit StringMatcher(const std::string& pattern); - const std::string& GetPattern() const - { - return pattern_; - } + const std::string& GetPattern() const; - bool IsValid() const - { - return valid_; - } + bool IsValid() const; bool Apply(Iterator start, Iterator end); - bool Apply(const std::string& corpus) - { - return Apply(corpus.begin(), corpus.end()); - } + bool Apply(const std::string& corpus); Iterator GetMatchBegin() const; diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Images/ImageAccessor.cpp --- a/OrthancFramework/Sources/Images/ImageAccessor.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Images/ImageAccessor.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -98,6 +98,55 @@ } + ImageAccessor::ImageAccessor() + { + AssignEmpty(PixelFormat_Grayscale8); + } + + ImageAccessor::~ImageAccessor() + { + } + + bool ImageAccessor::IsReadOnly() const + { + return readOnly_; + } + + PixelFormat ImageAccessor::GetFormat() const + { + return format_; + } + + unsigned int ImageAccessor::GetBytesPerPixel() const + { + return ::Orthanc::GetBytesPerPixel(format_); + } + + unsigned int ImageAccessor::GetWidth() const + { + return width_; + } + + unsigned int ImageAccessor::GetHeight() const + { + return height_; + } + + unsigned int ImageAccessor::GetPitch() const + { + return pitch_; + } + + unsigned int ImageAccessor::GetSize() const + { + return GetHeight() * GetPitch(); + } + + const void *ImageAccessor::GetConstBuffer() const + { + return buffer_; + } + void* ImageAccessor::GetBuffer() { if (readOnly_) @@ -172,6 +221,11 @@ } } + void ImageAccessor::GetReadOnlyAccessor(ImageAccessor &target) const + { + target.AssignReadOnly(format_, width_, height_, pitch_, buffer_); + } + void ImageAccessor::AssignWritable(PixelFormat format, unsigned int width, diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Images/ImageAccessor.h --- a/OrthancFramework/Sources/Images/ImageAccessor.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Images/ImageAccessor.h Thu Nov 05 19:33:18 2020 +0100 @@ -68,54 +68,25 @@ #endif public: - ImageAccessor() - { - AssignEmpty(PixelFormat_Grayscale8); - } + ImageAccessor(); - virtual ~ImageAccessor() - { - } + virtual ~ImageAccessor(); - bool IsReadOnly() const - { - return readOnly_; - } + bool IsReadOnly() const; - PixelFormat GetFormat() const - { - return format_; - } + PixelFormat GetFormat() const; - unsigned int GetBytesPerPixel() const - { - return ::Orthanc::GetBytesPerPixel(format_); - } + unsigned int GetBytesPerPixel() const; - unsigned int GetWidth() const - { - return width_; - } + unsigned int GetWidth() const; - unsigned int GetHeight() const - { - return height_; - } + unsigned int GetHeight() const; - unsigned int GetPitch() const - { - return pitch_; - } + unsigned int GetPitch() const; - unsigned int GetSize() const - { - return GetHeight() * GetPitch(); - } + unsigned int GetSize() const; - const void* GetConstBuffer() const - { - return buffer_; - } + const void* GetConstBuffer() const; void* GetBuffer(); @@ -131,10 +102,7 @@ unsigned int pitch, const void *buffer); - void GetReadOnlyAccessor(ImageAccessor& target) const - { - target.AssignReadOnly(format_, width_, height_, pitch_, buffer_); - } + void GetReadOnlyAccessor(ImageAccessor& target) const; void AssignWritable(PixelFormat format, unsigned int width, diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Images/ImageBuffer.cpp --- a/OrthancFramework/Sources/Images/ImageBuffer.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Images/ImageBuffer.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -88,6 +88,21 @@ SetFormat(format); } + ImageBuffer::ImageBuffer() + { + Initialize(); + } + + ImageBuffer::~ImageBuffer() + { + Deallocate(); + } + + PixelFormat ImageBuffer::GetFormat() const + { + return format_; + } + void ImageBuffer::Initialize() { @@ -110,6 +125,11 @@ } } + unsigned int ImageBuffer::GetWidth() const + { + return width_; + } + void ImageBuffer::SetWidth(unsigned int width) { @@ -120,6 +140,11 @@ } } + unsigned int ImageBuffer::GetHeight() const + { + return height_; + } + void ImageBuffer::SetHeight(unsigned int height) { @@ -130,6 +155,11 @@ } } + unsigned int ImageBuffer::GetBytesPerPixel() const + { + return ::Orthanc::GetBytesPerPixel(format_); + } + void ImageBuffer::GetReadOnlyAccessor(ImageAccessor& accessor) { @@ -144,6 +174,11 @@ accessor.AssignWritable(format_, width_, height_, pitch_, buffer_); } + bool ImageBuffer::IsMinimalPitchForced() const + { + return forceMinimalPitch_; + } + void ImageBuffer::AcquireOwnership(ImageBuffer& other) { diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Images/ImageBuffer.h --- a/OrthancFramework/Sources/Images/ImageBuffer.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Images/ImageBuffer.h Thu Nov 05 19:33:18 2020 +0100 @@ -54,50 +54,29 @@ unsigned int height, bool forceMinimalPitch); - ImageBuffer() - { - Initialize(); - } + ImageBuffer(); - ~ImageBuffer() - { - Deallocate(); - } + ~ImageBuffer(); - PixelFormat GetFormat() const - { - return format_; - } + PixelFormat GetFormat() const; void SetFormat(PixelFormat format); - unsigned int GetWidth() const - { - return width_; - } + unsigned int GetWidth() const; void SetWidth(unsigned int width); - unsigned int GetHeight() const - { - return height_; - } + unsigned int GetHeight() const; void SetHeight(unsigned int height); - unsigned int GetBytesPerPixel() const - { - return ::Orthanc::GetBytesPerPixel(format_); - } + unsigned int GetBytesPerPixel() const; void GetReadOnlyAccessor(ImageAccessor& accessor); void GetWriteableAccessor(ImageAccessor& accessor); - bool IsMinimalPitchForced() const - { - return forceMinimalPitch_; - } + bool IsMinimalPitchForced() const; void AcquireOwnership(ImageBuffer& other); }; diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Images/ImageProcessing.cpp --- a/OrthancFramework/Sources/Images/ImageProcessing.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Images/ImageProcessing.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -49,6 +49,29 @@ namespace Orthanc { + ImageProcessing::ImagePoint::ImagePoint(int32_t x, + int32_t y) : + x_(x), + y_(y) + { + } + + int32_t ImageProcessing::ImagePoint::GetX() const + { + return x_; + } + + int32_t ImageProcessing::ImagePoint::GetY() const + { + return y_; + } + + void ImageProcessing::ImagePoint::Set(int32_t x, int32_t y) + { + x_ = x; + y_ = y; + } + void ImageProcessing::ImagePoint::ClipTo(int32_t minX, int32_t maxX, int32_t minY, int32_t maxY) { x_ = std::max(minX, std::min(maxX, x_)); diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Images/ImageProcessing.h --- a/OrthancFramework/Sources/Images/ImageProcessing.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Images/ImageProcessing.h Thu Nov 05 19:33:18 2020 +0100 @@ -37,38 +37,30 @@ public: class ORTHANC_PUBLIC ImagePoint { + private: int32_t x_; int32_t y_; public: - ImagePoint(int32_t x, - int32_t y) : - x_(x), - y_(y) - { - } + ImagePoint(int32_t x, + int32_t y); - int32_t GetX() const - { - return x_; - } + int32_t GetX() const; + + int32_t GetY() const; - int32_t GetY() const - { - return y_; - } + void Set(int32_t x, int32_t y); - void Set(int32_t x, int32_t y) - { - x_ = x; - y_ = y; - } - - void ClipTo(int32_t minX, int32_t maxX, int32_t minY, int32_t maxY); + void ClipTo(int32_t minX, + int32_t maxX, + int32_t minY, + int32_t maxY); double GetDistanceTo(const ImagePoint& other) const; - double GetDistanceToLine(double a, double b, double c) const; // where ax + by + c = 0 is the equation of the line + double GetDistanceToLine(double a, + double b, + double c) const; // where ax + by + c = 0 is the equation of the line }; static void Copy(ImageAccessor& target, diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Images/JpegWriter.cpp --- a/OrthancFramework/Sources/Images/JpegWriter.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Images/JpegWriter.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -97,6 +97,11 @@ } + JpegWriter::JpegWriter() : quality_(90) + { + } + + void JpegWriter::SetQuality(uint8_t quality) { if (quality == 0 || quality > 100) @@ -199,4 +204,9 @@ jpeg.assign(reinterpret_cast(data), size); free(data); } + + uint8_t JpegWriter::GetQuality() const + { + return quality_; + } } diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Images/JpegWriter.h --- a/OrthancFramework/Sources/Images/JpegWriter.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Images/JpegWriter.h Thu Nov 05 19:33:18 2020 +0100 @@ -58,15 +58,10 @@ uint8_t quality_; public: - JpegWriter() : quality_(90) - { - } + JpegWriter(); void SetQuality(uint8_t quality); - uint8_t GetQuality() const - { - return quality_; - } + uint8_t GetQuality() const; }; } diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Images/PamReader.cpp --- a/OrthancFramework/Sources/Images/PamReader.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Images/PamReader.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -265,6 +265,12 @@ } } + PamReader::PamReader(bool enforceAligned) : + enforceAligned_(enforceAligned), + alignedImageBuffer_(NULL) + { + } + #if ORTHANC_SANDBOXED == 0 void PamReader::ReadFromFile(const std::string& filename) diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Images/PamReader.h --- a/OrthancFramework/Sources/Images/PamReader.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Images/PamReader.h Thu Nov 05 19:33:18 2020 +0100 @@ -65,11 +65,7 @@ but avoids possible crashes due to non-aligned memory access. It is recommended to set this parameter to "true". */ - explicit PamReader(bool enforceAligned) : - enforceAligned_(enforceAligned), - alignedImageBuffer_(NULL) - { - } + explicit PamReader(bool enforceAligned); virtual ~PamReader(); diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/JobsEngine/JobInfo.cpp --- a/OrthancFramework/Sources/JobsEngine/JobInfo.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/JobsEngine/JobInfo.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -90,6 +90,41 @@ { } + const std::string &JobInfo::GetIdentifier() const + { + return id_; + } + + int JobInfo::GetPriority() const + { + return priority_; + } + + JobState JobInfo::GetState() const + { + return state_; + } + + const boost::posix_time::ptime &JobInfo::GetInfoTime() const + { + return timestamp_; + } + + const boost::posix_time::ptime &JobInfo::GetCreationTime() const + { + return creationTime_; + } + + const boost::posix_time::time_duration &JobInfo::GetRuntime() const + { + return runtime_; + } + + bool JobInfo::HasEstimatedTimeOfArrival() const + { + return hasEta_; + } + bool JobInfo::HasCompletionTime() const { @@ -123,6 +158,16 @@ } } + const JobStatus &JobInfo::GetStatus() const + { + return status_; + } + + JobStatus &JobInfo::GetStatus() + { + return status_; + } + void JobInfo::Format(Json::Value& target) const { diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/JobsEngine/JobInfo.h --- a/OrthancFramework/Sources/JobsEngine/JobInfo.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/JobsEngine/JobInfo.h Thu Nov 05 19:33:18 2020 +0100 @@ -53,40 +53,19 @@ JobInfo(); - const std::string& GetIdentifier() const - { - return id_; - } + const std::string& GetIdentifier() const; - int GetPriority() const - { - return priority_; - } + int GetPriority() const; - JobState GetState() const - { - return state_; - } + JobState GetState() const; - const boost::posix_time::ptime& GetInfoTime() const - { - return timestamp_; - } + const boost::posix_time::ptime& GetInfoTime() const; - const boost::posix_time::ptime& GetCreationTime() const - { - return creationTime_; - } + const boost::posix_time::ptime& GetCreationTime() const; - const boost::posix_time::time_duration& GetRuntime() const - { - return runtime_; - } + const boost::posix_time::time_duration& GetRuntime() const; - bool HasEstimatedTimeOfArrival() const - { - return hasEta_; - } + bool HasEstimatedTimeOfArrival() const; bool HasCompletionTime() const; @@ -94,15 +73,9 @@ const boost::posix_time::ptime& GetCompletionTime() const; - const JobStatus& GetStatus() const - { - return status_; - } + const JobStatus& GetStatus() const; - JobStatus& GetStatus() - { - return status_; - } + JobStatus& GetStatus(); void Format(Json::Value& target) const; }; diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/JobsEngine/JobStepResult.cpp --- a/OrthancFramework/Sources/JobsEngine/JobStepResult.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/JobsEngine/JobStepResult.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -27,6 +27,23 @@ namespace Orthanc { + JobStepResult::JobStepResult() : + code_(JobStepCode_Failure), + timeout_(0), + error_(ErrorCode_InternalError) + { + } + + JobStepResult JobStepResult::Success() + { + return JobStepResult(JobStepCode_Success); + } + + JobStepResult JobStepResult::Continue() + { + return JobStepResult(JobStepCode_Continue); + } + JobStepResult JobStepResult::Retry(unsigned int timeout) { JobStepResult result(JobStepCode_Retry); @@ -55,6 +72,11 @@ return Failure(exception.GetErrorCode(), exception.HasDetails() ? exception.GetDetails() : NULL); } + + JobStepCode JobStepResult::GetCode() const + { + return code_; + } unsigned int JobStepResult::GetRetryTimeout() const diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/JobsEngine/JobStepResult.h --- a/OrthancFramework/Sources/JobsEngine/JobStepResult.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/JobsEngine/JobStepResult.h Thu Nov 05 19:33:18 2020 +0100 @@ -44,22 +44,11 @@ } public: - explicit JobStepResult() : - code_(JobStepCode_Failure), - timeout_(0), - error_(ErrorCode_InternalError) - { - } + explicit JobStepResult(); - static JobStepResult Success() - { - return JobStepResult(JobStepCode_Success); - } + static JobStepResult Success(); - static JobStepResult Continue() - { - return JobStepResult(JobStepCode_Continue); - } + static JobStepResult Continue(); static JobStepResult Retry(unsigned int timeout); @@ -68,10 +57,7 @@ static JobStepResult Failure(const OrthancException& exception); - JobStepCode GetCode() const - { - return code_; - } + JobStepCode GetCode() const; unsigned int GetRetryTimeout() const; diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp --- a/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -41,6 +41,11 @@ static const char* RUNTIME = "Runtime"; + JobsRegistry::IObserver::~IObserver() + { + } + + class JobsRegistry::JobHandler : public boost::noncopyable { private: @@ -711,6 +716,12 @@ } } + JobsRegistry::JobsRegistry(size_t maxCompletedJobs) : + maxCompletedJobs_(maxCompletedJobs), + observer_(NULL) + { + } + void JobsRegistry::Submit(std::string& id, IJob* job, // Takes ownership diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/JobsEngine/JobsRegistry.h --- a/OrthancFramework/Sources/JobsEngine/JobsRegistry.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/JobsEngine/JobsRegistry.h Thu Nov 05 19:33:18 2020 +0100 @@ -48,9 +48,7 @@ class ORTHANC_PUBLIC IObserver : public boost::noncopyable { public: - virtual ~IObserver() - { - } + virtual ~IObserver(); virtual void SignalJobSubmitted(const std::string& jobId) = 0; @@ -129,11 +127,7 @@ JobHandler* handler); public: - explicit JobsRegistry(size_t maxCompletedJobs) : - maxCompletedJobs_(maxCompletedJobs), - observer_(NULL) - { - } + explicit JobsRegistry(size_t maxCompletedJobs); JobsRegistry(IJobUnserializer& unserializer, const Json::Value& s, diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/JobsEngine/Operations/JobOperationValues.cpp --- a/OrthancFramework/Sources/JobsEngine/Operations/JobOperationValues.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/JobsEngine/Operations/JobOperationValues.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -55,6 +55,21 @@ } } + JobOperationValues::~JobOperationValues() + { + Clear(); + } + + void JobOperationValues::Move(JobOperationValues &target) + { + return Append(target, true); + } + + void JobOperationValues::Copy(JobOperationValues &target) + { + return Append(target, false); + } + void JobOperationValues::Clear() { @@ -69,6 +84,11 @@ values_.clear(); } + void JobOperationValues::Reserve(size_t count) + { + values_.reserve(count); + } + void JobOperationValues::Append(JobOperationValue* value) // Takes ownership { @@ -82,6 +102,11 @@ } } + size_t JobOperationValues::GetSize() const + { + return values_.size(); + } + JobOperationValue& JobOperationValues::GetValue(size_t index) const { diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/JobsEngine/Operations/JobOperationValues.h --- a/OrthancFramework/Sources/JobsEngine/Operations/JobOperationValues.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/JobsEngine/Operations/JobOperationValues.h Thu Nov 05 19:33:18 2020 +0100 @@ -39,34 +39,19 @@ bool clear); public: - ~JobOperationValues() - { - Clear(); - } + ~JobOperationValues(); - void Move(JobOperationValues& target) - { - return Append(target, true); - } + void Move(JobOperationValues& target); - void Copy(JobOperationValues& target) - { - return Append(target, false); - } + void Copy(JobOperationValues& target); void Clear(); - void Reserve(size_t count) - { - values_.reserve(count); - } + void Reserve(size_t count); void Append(JobOperationValue* value); // Takes ownership - size_t GetSize() const - { - return values_.size(); - } + size_t GetSize() const; JobOperationValue& GetValue(size_t index) const; diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/JobsEngine/Operations/LogJobOperation.cpp --- a/OrthancFramework/Sources/JobsEngine/Operations/LogJobOperation.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/JobsEngine/Operations/LogJobOperation.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -49,4 +49,10 @@ outputs.Append(input.Clone()); } + + void LogJobOperation::Serialize(Json::Value &result) const + { + result = Json::objectValue; + result["Type"] = "Log"; + } } diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/JobsEngine/Operations/LogJobOperation.h --- a/OrthancFramework/Sources/JobsEngine/Operations/LogJobOperation.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/JobsEngine/Operations/LogJobOperation.h Thu Nov 05 19:33:18 2020 +0100 @@ -34,10 +34,6 @@ virtual void Apply(JobOperationValues& outputs, const JobOperationValue& input) ORTHANC_OVERRIDE; - virtual void Serialize(Json::Value& result) const ORTHANC_OVERRIDE - { - result = Json::objectValue; - result["Type"] = "Log"; - } + virtual void Serialize(Json::Value& result) const ORTHANC_OVERRIDE; }; } diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.cpp --- a/OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -32,6 +32,14 @@ namespace Orthanc { + SetOfCommandsJob::ICommand::~ICommand() + { + } + + SetOfCommandsJob::ICommandUnserializer::~ICommandUnserializer() + { + } + SetOfCommandsJob::SetOfCommandsJob() : started_(false), permissive_(false), @@ -49,7 +57,17 @@ } } - + size_t SetOfCommandsJob::GetPosition() const + { + return position_; + } + + void SetOfCommandsJob::SetDescription(const std::string &description) + { + description_ = description; + } + + void SetOfCommandsJob::Reserve(size_t size) { if (started_) @@ -62,7 +80,12 @@ } } - + size_t SetOfCommandsJob::GetCommandsCount() const + { + return commands_.size(); + } + + void SetOfCommandsJob::AddCommand(ICommand* command) { if (command == NULL) @@ -79,6 +102,11 @@ } } + bool SetOfCommandsJob::IsPermissive() const + { + return permissive_; + } + void SetOfCommandsJob::SetPermissive(bool permissive) { @@ -105,7 +133,12 @@ } } - + void SetOfCommandsJob::Start() + { + started_ = true; + } + + float SetOfCommandsJob::GetProgress() { if (commands_.empty()) @@ -119,6 +152,11 @@ } } + bool SetOfCommandsJob::IsStarted() const + { + return started_; + } + const SetOfCommandsJob::ICommand& SetOfCommandsJob::GetCommand(size_t index) const { @@ -234,6 +272,13 @@ return true; } + bool SetOfCommandsJob::GetOutput(std::string &output, + MimeType &mime, + const std::string &key) + { + return false; + } + SetOfCommandsJob::SetOfCommandsJob(ICommandUnserializer* unserializer, const Json::Value& source) : diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.h --- a/OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.h Thu Nov 05 19:33:18 2020 +0100 @@ -36,9 +36,7 @@ class ICommand : public boost::noncopyable { public: - virtual ~ICommand() - { - } + virtual ~ICommand(); virtual bool Execute(const std::string& jobId) = 0; @@ -48,9 +46,7 @@ class ICommandUnserializer : public boost::noncopyable { public: - virtual ~ICommandUnserializer() - { - } + virtual ~ICommandUnserializer(); virtual ICommand* Unserialize(const Json::Value& source) const = 0; }; @@ -70,15 +66,9 @@ virtual ~SetOfCommandsJob(); - size_t GetPosition() const - { - return position_; - } + size_t GetPosition() const; - void SetDescription(const std::string& description) - { - description_ = description; - } + void SetDescription(const std::string& description); const std::string& GetDescription() const { @@ -87,33 +77,21 @@ void Reserve(size_t size); - size_t GetCommandsCount() const - { - return commands_.size(); - } + size_t GetCommandsCount() const; void AddCommand(ICommand* command); // Takes ownership - bool IsPermissive() const - { - return permissive_; - } + bool IsPermissive() const; void SetPermissive(bool permissive); virtual void Reset() ORTHANC_OVERRIDE; - virtual void Start() ORTHANC_OVERRIDE - { - started_ = true; - } + virtual void Start() ORTHANC_OVERRIDE; virtual float GetProgress() ORTHANC_OVERRIDE; - bool IsStarted() const - { - return started_; - } + bool IsStarted() const; const ICommand& GetCommand(size_t index) const; @@ -125,9 +103,6 @@ virtual bool GetOutput(std::string& output, MimeType& mime, - const std::string& key) ORTHANC_OVERRIDE - { - return false; - } + const std::string& key) ORTHANC_OVERRIDE; }; } diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Lua/LuaContext.cpp --- a/OrthancFramework/Sources/Lua/LuaContext.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Lua/LuaContext.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -578,6 +578,17 @@ } + void LuaContext::Execute(const std::string &command) + { + ExecuteInternal(NULL, command); + } + + void LuaContext::Execute(std::string &output, const std::string &command) + { + ExecuteInternal(&output, command); + } + + void LuaContext::ExecuteInternal(std::string* output, const std::string& command) { @@ -609,6 +620,15 @@ } +#if ORTHANC_ENABLE_CURL == 1 + void LuaContext::SetHttpCredentials(const char* username, + const char* password) + { + httpClient_.SetCredentials(username, password); + } +#endif + + void LuaContext::Execute(Json::Value& output, const std::string& command) { diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Lua/LuaContext.h --- a/OrthancFramework/Sources/Lua/LuaContext.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Lua/LuaContext.h Thu Nov 05 19:33:18 2020 +0100 @@ -94,16 +94,10 @@ ~LuaContext(); - void Execute(const std::string& command) - { - ExecuteInternal(NULL, command); - } + void Execute(const std::string& command); void Execute(std::string& output, - const std::string& command) - { - ExecuteInternal(&output, command); - } + const std::string& command); void Execute(Json::Value& output, const std::string& command); @@ -112,10 +106,7 @@ #if ORTHANC_ENABLE_CURL == 1 void SetHttpCredentials(const char* username, - const char* password) - { - httpClient_.SetCredentials(username, password); - } + const char* password); #endif void RegisterFunction(const char* name, diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Lua/LuaFunctionCall.cpp --- a/OrthancFramework/Sources/Lua/LuaFunctionCall.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Lua/LuaFunctionCall.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -182,6 +182,11 @@ PushJson(value); } + void LuaFunctionCall::Execute() + { + ExecuteInternal(0); + } + #if ORTHANC_ENABLE_DCMTK == 1 void LuaFunctionCall::ExecuteToDicom(DicomMap& target) diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/Lua/LuaFunctionCall.h --- a/OrthancFramework/Sources/Lua/LuaFunctionCall.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/Lua/LuaFunctionCall.h Thu Nov 05 19:33:18 2020 +0100 @@ -71,10 +71,7 @@ void PushDicom(const DicomArray& dicom); - void Execute() - { - ExecuteInternal(0); - } + void Execute(); bool ExecutePredicate(); diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/MetricsRegistry.cpp --- a/OrthancFramework/Sources/MetricsRegistry.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/MetricsRegistry.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -175,6 +175,11 @@ } } + bool MetricsRegistry::IsEnabled() const + { + return enabled_; + } + void MetricsRegistry::SetEnabled(bool enabled) { @@ -208,7 +213,6 @@ } } - void MetricsRegistry::SetValueInternal(const std::string& name, float value, MetricsType type) @@ -230,6 +234,29 @@ } } + MetricsRegistry::MetricsRegistry() : + enabled_(true) + { + } + + + void MetricsRegistry::SetValue(const std::string &name, + float value, + MetricsType type) + { + // Inlining to avoid loosing time if metrics are disabled + if (enabled_) + { + SetValueInternal(name, value, type); + } + } + + + void MetricsRegistry::SetValue(const std::string &name, float value) + { + SetValue(name, value, MetricsType_Default); + } + MetricsType MetricsRegistry::GetMetricsType(const std::string& name) { @@ -286,6 +313,15 @@ } + MetricsRegistry::SharedMetrics::SharedMetrics(MetricsRegistry ®istry, + const std::string &name, + MetricsType type) : + registry_(registry), + name_(name), + value_(0) + { + } + void MetricsRegistry::SharedMetrics::Add(float delta) { boost::mutex::scoped_lock lock(mutex_); @@ -294,6 +330,18 @@ } + MetricsRegistry::ActiveCounter::ActiveCounter(MetricsRegistry::SharedMetrics &metrics) : + metrics_(metrics) + { + metrics_.Add(1); + } + + MetricsRegistry::ActiveCounter::~ActiveCounter() + { + metrics_.Add(-1); + } + + void MetricsRegistry::Timer::Start() { if (registry_.IsEnabled()) @@ -308,13 +356,34 @@ } + MetricsRegistry::Timer::Timer(MetricsRegistry ®istry, + const std::string &name) : + registry_(registry), + name_(name), + type_(MetricsType_MaxOver10Seconds) + { + Start(); + } + + + MetricsRegistry::Timer::Timer(MetricsRegistry ®istry, + const std::string &name, + MetricsType type) : + registry_(registry), + name_(name), + type_(type) + { + Start(); + } + + MetricsRegistry::Timer::~Timer() { if (active_) - { + { boost::posix_time::time_duration diff = GetNow() - start_; registry_.SetValue( - name_, static_cast(diff.total_milliseconds()), type_); + name_, static_cast(diff.total_milliseconds()), type_); } } } diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/MetricsRegistry.h --- a/OrthancFramework/Sources/MetricsRegistry.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/MetricsRegistry.h Thu Nov 05 19:33:18 2020 +0100 @@ -62,17 +62,11 @@ MetricsType type); public: - MetricsRegistry() : - enabled_(true) - { - } + MetricsRegistry(); ~MetricsRegistry(); - bool IsEnabled() const - { - return enabled_; - } + bool IsEnabled() const; void SetEnabled(bool enabled); @@ -81,20 +75,10 @@ void SetValue(const std::string& name, float value, - MetricsType type) - { - // Inlining to avoid loosing time if metrics are disabled - if (enabled_) - { - SetValueInternal(name, value, type); - } - } + MetricsType type); void SetValue(const std::string& name, - float value) - { - SetValue(name, value, MetricsType_Default); - } + float value); MetricsType GetMetricsType(const std::string& name); @@ -113,12 +97,7 @@ public: SharedMetrics(MetricsRegistry& registry, const std::string& name, - MetricsType type) : - registry_(registry), - name_(name), - value_(0) - { - } + MetricsType type); void Add(float delta); }; @@ -130,16 +109,9 @@ SharedMetrics& metrics_; public: - explicit ActiveCounter(SharedMetrics& metrics) : - metrics_(metrics) - { - metrics_.Add(1); - } + explicit ActiveCounter(SharedMetrics& metrics); - ~ActiveCounter() - { - metrics_.Add(-1); - } + ~ActiveCounter(); }; @@ -156,23 +128,11 @@ public: Timer(MetricsRegistry& registry, - const std::string& name) : - registry_(registry), - name_(name), - type_(MetricsType_MaxOver10Seconds) - { - Start(); - } + const std::string& name); Timer(MetricsRegistry& registry, const std::string& name, - MetricsType type) : - registry_(registry), - name_(name), - type_(type) - { - Start(); - } + MetricsType type); ~Timer(); }; diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/MultiThreading/Semaphore.cpp --- a/OrthancFramework/Sources/MultiThreading/Semaphore.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/MultiThreading/Semaphore.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -37,6 +37,11 @@ } } + unsigned int Semaphore::GetAvailableResourcesCount() const + { + return availableResources_; + } + void Semaphore::Release(unsigned int resourceCount) { boost::mutex::scoped_lock lock(mutex_); diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/MultiThreading/Semaphore.h --- a/OrthancFramework/Sources/MultiThreading/Semaphore.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/MultiThreading/Semaphore.h Thu Nov 05 19:33:18 2020 +0100 @@ -44,10 +44,7 @@ public: explicit Semaphore(unsigned int availableResources); - unsigned int GetAvailableResourcesCount() const - { - return availableResources_; - } + unsigned int GetAvailableResourcesCount() const; class Locker : public boost::noncopyable diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/MultiThreading/SharedMessageQueue.cpp --- a/OrthancFramework/Sources/MultiThreading/SharedMessageQueue.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/MultiThreading/SharedMessageQueue.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -165,6 +165,16 @@ return true; } + bool SharedMessageQueue::IsFifoPolicy() const + { + return isFifo_; + } + + bool SharedMessageQueue::IsLifoPolicy() const + { + return !isFifo_; + } + void SharedMessageQueue::SetFifoPolicy() { diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/MultiThreading/SharedMessageQueue.h --- a/OrthancFramework/Sources/MultiThreading/SharedMessageQueue.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/MultiThreading/SharedMessageQueue.h Thu Nov 05 19:33:18 2020 +0100 @@ -55,15 +55,9 @@ bool WaitEmpty(int32_t millisecondsTimeout); - bool IsFifoPolicy() const - { - return isFifo_; - } + bool IsFifoPolicy() const; - bool IsLifoPolicy() const - { - return !isFifo_; - } + bool IsLifoPolicy() const; void SetFifoPolicy(); diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/RestApi/RestApiHierarchy.cpp --- a/OrthancFramework/Sources/RestApi/RestApiHierarchy.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiHierarchy.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -61,6 +61,27 @@ } + void RestApiHierarchy::Resource::Register(RestApiGetCall::Handler handler) + { + getHandler_ = handler; + } + + void RestApiHierarchy::Resource::Register(RestApiPutCall::Handler handler) + { + putHandler_ = handler; + } + + void RestApiHierarchy::Resource::Register(RestApiPostCall::Handler handler) + { + postHandler_ = handler; + } + + void RestApiHierarchy::Resource::Register(RestApiDeleteCall::Handler handler) + { + deleteHandler_ = handler; + } + + bool RestApiHierarchy::Resource::IsEmpty() const { return (getHandler_ == NULL && @@ -146,6 +167,10 @@ } + RestApiHierarchy::IVisitor::~IVisitor() + { + } + void RestApiHierarchy::DeleteChildren(Children& children) { @@ -391,6 +416,11 @@ } } + bool RestApiHierarchy::GetDirectory(Json::Value &result, const UriComponents &uri) + { + return GetDirectory(result, uri, 0); + } + bool RestApiHierarchy::LookupResource(const UriComponents& uri, IVisitor& visitor) @@ -463,4 +493,5 @@ } } } + } diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/RestApi/RestApiHierarchy.h --- a/OrthancFramework/Sources/RestApi/RestApiHierarchy.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiHierarchy.h Thu Nov 05 19:33:18 2020 +0100 @@ -47,25 +47,13 @@ bool HasHandler(HttpMethod method) const; - void Register(RestApiGetCall::Handler handler) - { - getHandler_ = handler; - } + void Register(RestApiGetCall::Handler handler); - void Register(RestApiPutCall::Handler handler) - { - putHandler_ = handler; - } + void Register(RestApiPutCall::Handler handler); - void Register(RestApiPostCall::Handler handler) - { - postHandler_ = handler; - } + void Register(RestApiPostCall::Handler handler); - void Register(RestApiDeleteCall::Handler handler) - { - deleteHandler_ = handler; - } + void Register(RestApiDeleteCall::Handler handler); bool IsEmpty() const; @@ -82,9 +70,7 @@ class IVisitor : public boost::noncopyable { public: - virtual ~IVisitor() - { - } + virtual ~IVisitor(); virtual bool Visit(const Resource& resource, const UriComponents& uri, @@ -140,10 +126,7 @@ void CreateSiteMap(Json::Value& target) const; bool GetDirectory(Json::Value& result, - const UriComponents& uri) - { - return GetDirectory(result, uri, 0); - } + const UriComponents& uri); bool LookupResource(const UriComponents& uri, IVisitor& visitor); diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/RestApi/RestApiPath.cpp --- a/OrthancFramework/Sources/RestApi/RestApiPath.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiPath.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -131,6 +131,12 @@ } + size_t RestApiPath::GetLevelCount() const + { + return uri_.size(); + } + + bool RestApiPath::IsWildcardLevel(size_t level) const { assert(uri_.size() == components_.size()); @@ -143,6 +149,11 @@ return uri_[level].length() == 0; } + bool RestApiPath::IsUniversalTrailing() const + { + return hasTrailing_; + } + const std::string& RestApiPath::GetWildcardName(size_t level) const { assert(uri_.size() == components_.size()); diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/RestApi/RestApiPath.h --- a/OrthancFramework/Sources/RestApi/RestApiPath.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiPath.h Thu Nov 05 19:33:18 2020 +0100 @@ -50,17 +50,11 @@ bool Match(const UriComponents& uri) const; - size_t GetLevelCount() const - { - return uri_.size(); - } + size_t GetLevelCount() const; bool IsWildcardLevel(size_t level) const; - bool IsUniversalTrailing() const - { - return hasTrailing_; - } + bool IsUniversalTrailing() const; const std::string& GetWildcardName(size_t level) const; diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/SharedLibrary.cpp --- a/OrthancFramework/Sources/SharedLibrary.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/SharedLibrary.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -102,6 +102,12 @@ } + const std::string &SharedLibrary::GetPath() const + { + return path_; + } + + SharedLibrary::FunctionPointer SharedLibrary::GetFunctionInternal(const std::string& name) { if (!handle_) diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/SharedLibrary.h --- a/OrthancFramework/Sources/SharedLibrary.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/SharedLibrary.h Thu Nov 05 19:33:18 2020 +0100 @@ -61,10 +61,7 @@ ~SharedLibrary(); - const std::string& GetPath() const - { - return path_; - } + const std::string& GetPath() const; bool HasFunction(const std::string& name); diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/TemporaryFile.cpp --- a/OrthancFramework/Sources/TemporaryFile.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/TemporaryFile.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -88,6 +88,11 @@ boost::filesystem::remove(path_); } + const std::string &TemporaryFile::GetPath() const + { + return path_; + } + void TemporaryFile::Write(const std::string& content) { diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/TemporaryFile.h --- a/OrthancFramework/Sources/TemporaryFile.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/TemporaryFile.h Thu Nov 05 19:33:18 2020 +0100 @@ -51,10 +51,7 @@ ~TemporaryFile(); - const std::string& GetPath() const - { - return path_; - } + const std::string& GetPath() const; void Write(const std::string& content); diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/WebServiceParameters.cpp --- a/OrthancFramework/Sources/WebServiceParameters.cpp Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/WebServiceParameters.cpp Thu Nov 05 19:33:18 2020 +0100 @@ -68,6 +68,16 @@ SetUrl("http://127.0.0.1:8042/"); } + WebServiceParameters::WebServiceParameters(const Json::Value &serialized) + { + Unserialize(serialized); + } + + const std::string &WebServiceParameters::GetUrl() const + { + return url_; + } + void WebServiceParameters::ClearClientCertificate() { @@ -128,6 +138,16 @@ } } + const std::string &WebServiceParameters::GetUsername() const + { + return username_; + } + + const std::string &WebServiceParameters::GetPassword() const + { + return password_; + } + void WebServiceParameters::SetClientCertificate(const std::string& certificateFile, const std::string& certificateKeyFile, @@ -148,6 +168,46 @@ certificateKeyPassword_ = certificateKeyPassword; } + const std::string &WebServiceParameters::GetCertificateFile() const + { + return certificateFile_; + } + + const std::string &WebServiceParameters::GetCertificateKeyFile() const + { + return certificateKeyFile_; + } + + const std::string &WebServiceParameters::GetCertificateKeyPassword() const + { + return certificateKeyPassword_; + } + + void WebServiceParameters::SetPkcs11Enabled(bool enabled) + { + pkcs11Enabled_ = enabled; + } + + bool WebServiceParameters::IsPkcs11Enabled() const + { + return pkcs11Enabled_; + } + + void WebServiceParameters::AddHttpHeader(const std::string &key, const std::string &value) + { + headers_[key] = value; + } + + void WebServiceParameters::ClearHttpHeaders() + { + headers_.clear(); + } + + const WebServiceParameters::Dictionary &WebServiceParameters::GetHttpHeaders() const + { + return headers_; + } + void WebServiceParameters::FromSimpleFormat(const Json::Value& peer) { @@ -381,6 +441,16 @@ } } + void WebServiceParameters::ClearUserProperties() + { + userProperties_.clear(); + } + + const WebServiceParameters::Dictionary &WebServiceParameters::GetUserProperties() const + { + return userProperties_; + } + void WebServiceParameters::ListUserProperties(std::set& target) const { diff -r 3f85db78c441 -r b30a8de92ad9 OrthancFramework/Sources/WebServiceParameters.h --- a/OrthancFramework/Sources/WebServiceParameters.h Thu Nov 05 18:24:50 2020 +0100 +++ b/OrthancFramework/Sources/WebServiceParameters.h Thu Nov 05 19:33:18 2020 +0100 @@ -58,15 +58,9 @@ public: WebServiceParameters(); - explicit WebServiceParameters(const Json::Value& serialized) - { - Unserialize(serialized); - } + explicit WebServiceParameters(const Json::Value& serialized); - const std::string& GetUrl() const - { - return url_; - } + const std::string& GetUrl() const; void SetUrl(const std::string& url); @@ -75,15 +69,9 @@ void SetCredentials(const std::string& username, const std::string& password); - const std::string& GetUsername() const - { - return username_; - } + const std::string& GetUsername() const; - const std::string& GetPassword() const - { - return password_; - } + const std::string& GetPassword() const; void ClearClientCertificate(); @@ -91,46 +79,22 @@ const std::string& certificateKeyFile, const std::string& certificateKeyPassword); - const std::string& GetCertificateFile() const - { - return certificateFile_; - } + const std::string& GetCertificateFile() const; - const std::string& GetCertificateKeyFile() const - { - return certificateKeyFile_; - } + const std::string& GetCertificateKeyFile() const; - const std::string& GetCertificateKeyPassword() const - { - return certificateKeyPassword_; - } + const std::string& GetCertificateKeyPassword() const; - void SetPkcs11Enabled(bool enabled) - { - pkcs11Enabled_ = enabled; - } + void SetPkcs11Enabled(bool enabled); - bool IsPkcs11Enabled() const - { - return pkcs11Enabled_; - } + bool IsPkcs11Enabled() const; void AddHttpHeader(const std::string& key, - const std::string& value) - { - headers_[key] = value; - } + const std::string& value); - void ClearHttpHeaders() - { - headers_.clear(); - } + void ClearHttpHeaders(); - const Dictionary& GetHttpHeaders() const - { - return headers_; - } + const Dictionary& GetHttpHeaders() const; void ListHttpHeaders(std::set& target) const; @@ -140,15 +104,9 @@ void AddUserProperty(const std::string& key, const std::string& value); - void ClearUserProperties() - { - userProperties_.clear(); - } + void ClearUserProperties(); - const Dictionary& GetUserProperties() const - { - return userProperties_; - } + const Dictionary& GetUserProperties() const; void ListUserProperties(std::set& target) const;