Mercurial > hg > orthanc
comparison OrthancServer/ServerIndex.cpp @ 1898:e018037d4d0e
Support of optional tags for counting resources in C-Find
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 21 Dec 2015 19:26:38 +0100 |
parents | 0ef4e6e66b56 |
children | b1291df2f780 |
comparison
equal
deleted
inserted
replaced
1897:7110e2881dc0 | 1898:e018037d4d0e |
---|---|
2175 | 2175 |
2176 resources[pos] = db_.GetPublicId(*it); | 2176 resources[pos] = db_.GetPublicId(*it); |
2177 instances[pos] = db_.GetPublicId(instance); | 2177 instances[pos] = db_.GetPublicId(instance); |
2178 } | 2178 } |
2179 } | 2179 } |
2180 | |
2181 | |
2182 bool ServerIndex::LookupParent(std::string& target, | |
2183 const std::string& publicId, | |
2184 ResourceType parentType) | |
2185 { | |
2186 boost::mutex::scoped_lock lock(mutex_); | |
2187 | |
2188 ResourceType type; | |
2189 int64_t id; | |
2190 if (!db_.LookupResource(id, type, publicId)) | |
2191 { | |
2192 throw OrthancException(ErrorCode_UnknownResource); | |
2193 } | |
2194 | |
2195 while (type != parentType) | |
2196 { | |
2197 int64_t parentId; | |
2198 | |
2199 if (type == ResourceType_Patient || // Cannot further go up in hierarchy | |
2200 !db_.LookupParent(parentId, id)) | |
2201 { | |
2202 return false; | |
2203 } | |
2204 | |
2205 id = parentId; | |
2206 type = GetParentResourceType(type); | |
2207 } | |
2208 | |
2209 target = db_.GetPublicId(id); | |
2210 return true; | |
2211 } | |
2180 } | 2212 } |