Mercurial > hg > orthanc
diff OrthancServer/Sources/Search/DatabaseConstraint.h @ 5809:023a99146dd0 attach-custom-data
merged find-refactoring -> attach-custom-data
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 24 Sep 2024 12:53:43 +0200 |
parents | e2771185dad6 |
children |
line wrap: on
line diff
--- a/OrthancServer/Sources/Search/DatabaseConstraint.h Tue Sep 24 12:11:25 2024 +0200 +++ b/OrthancServer/Sources/Search/DatabaseConstraint.h Tue Sep 24 12:53:43 2024 +0200 @@ -23,63 +23,15 @@ #pragma once -#if !defined(ORTHANC_BUILDING_SERVER_LIBRARY) -# error Macro ORTHANC_BUILDING_SERVER_LIBRARY must be defined -#endif - -#if ORTHANC_BUILDING_SERVER_LIBRARY == 1 -# include "../../../OrthancFramework/Sources/DicomFormat/DicomMap.h" -#else -// This is for the "orthanc-databases" project to reuse this file -# include <DicomFormat/DicomMap.h> -#endif - -#define ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT 0 +#include "../../../OrthancFramework/Sources/DicomFormat/DicomMap.h" +#include "../ServerEnumerations.h" #if ORTHANC_ENABLE_PLUGINS == 1 -# include <orthanc/OrthancCDatabasePlugin.h> -# if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in 1.3.1 -# if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 2) -# undef ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT -# define ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT 1 -# endif -# endif +# include "../../Plugins/Include/orthanc/OrthancCDatabasePlugin.h" #endif -#include <deque> - namespace Orthanc { - enum ConstraintType - { - ConstraintType_Equal, - ConstraintType_SmallerOrEqual, - ConstraintType_GreaterOrEqual, - ConstraintType_Wildcard, - ConstraintType_List - }; - - namespace Plugins - { -#if ORTHANC_ENABLE_PLUGINS == 1 - OrthancPluginResourceType Convert(ResourceType type); -#endif - -#if ORTHANC_ENABLE_PLUGINS == 1 - ResourceType Convert(OrthancPluginResourceType type); -#endif - -#if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 - OrthancPluginConstraintType Convert(ConstraintType constraint); -#endif - -#if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 - ConstraintType Convert(OrthancPluginConstraintType constraint); -#endif - } - - - // This class is also used by the "orthanc-databases" project class DatabaseConstraint : public boost::noncopyable { private: @@ -99,10 +51,6 @@ const std::vector<std::string>& values, bool caseSensitive, bool mandatory); - -#if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 - explicit DatabaseConstraint(const OrthancPluginDatabaseConstraint& constraint); -#endif ResourceType GetLevel() const { @@ -145,38 +93,9 @@ bool IsMatch(const DicomMap& dicom) const; -#if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 +#if ORTHANC_ENABLE_PLUGINS == 1 void EncodeForPlugins(OrthancPluginDatabaseConstraint& constraint, std::vector<const char*>& tmpValues) const; #endif }; - - - class DatabaseConstraints : public boost::noncopyable - { - private: - std::deque<DatabaseConstraint*> constraints_; - - public: - ~DatabaseConstraints() - { - Clear(); - } - - void Clear(); - - void AddConstraint(DatabaseConstraint* constraint); // Takes ownership - - bool IsEmpty() const - { - return constraints_.empty(); - } - - size_t GetSize() const - { - return constraints_.size(); - } - - const DatabaseConstraint& GetConstraint(size_t index) const; - }; }