comparison OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp @ 5680:68fc5af30c03

added container class DatabaseConstraints
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Jul 2024 10:09:57 +0200
parents f7adfb22e20e
children 77875b51cf95 8279eaab0d1d
comparison
equal deleted inserted replaced
5678:e47ac5e133b1 5680:68fc5af30c03
796 } 796 }
797 797
798 798
799 virtual void ApplyLookupResources(std::list<std::string>& resourcesId, 799 virtual void ApplyLookupResources(std::list<std::string>& resourcesId,
800 std::list<std::string>* instancesId, // Can be NULL if not needed 800 std::list<std::string>* instancesId, // Can be NULL if not needed
801 const std::vector<DatabaseConstraint>& lookup, 801 const DatabaseConstraints& lookup,
802 ResourceType queryLevel, 802 ResourceType queryLevel,
803 const std::set<std::string>& labels, 803 const std::set<std::string>& labels,
804 LabelsConstraint labelsConstraint, 804 LabelsConstraint labelsConstraint,
805 uint32_t limit) ORTHANC_OVERRIDE 805 uint32_t limit) ORTHANC_OVERRIDE
806 { 806 {
810 } 810 }
811 811
812 std::vector<OrthancPluginDatabaseConstraint> constraints; 812 std::vector<OrthancPluginDatabaseConstraint> constraints;
813 std::vector< std::vector<const char*> > constraintsValues; 813 std::vector< std::vector<const char*> > constraintsValues;
814 814
815 constraints.resize(lookup.size()); 815 constraints.resize(lookup.GetSize());
816 constraintsValues.resize(lookup.size()); 816 constraintsValues.resize(lookup.GetSize());
817 817
818 for (size_t i = 0; i < lookup.size(); i++) 818 for (size_t i = 0; i < lookup.GetSize(); i++)
819 { 819 {
820 lookup[i].EncodeForPlugins(constraints[i], constraintsValues[i]); 820 lookup.GetConstraint(i).EncodeForPlugins(constraints[i], constraintsValues[i]);
821 } 821 }
822 822
823 CheckSuccess(that_.backend_.lookupResources(transaction_, lookup.size(), 823 CheckSuccess(that_.backend_.lookupResources(transaction_, lookup.GetSize(),
824 (lookup.empty() ? NULL : &constraints[0]), 824 (lookup.IsEmpty() ? NULL : &constraints[0]),
825 Plugins::Convert(queryLevel), 825 Plugins::Convert(queryLevel),
826 limit, (instancesId == NULL ? 0 : 1))); 826 limit, (instancesId == NULL ? 0 : 1)));
827 CheckNoEvent(); 827 CheckNoEvent();
828 828
829 uint32_t count; 829 uint32_t count;