comparison OrthancServer/ServerIndex.cpp @ 714:6a1dbba0cca7

new implementation of C-Find handler
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Feb 2014 11:26:12 +0100
parents 4789da60d655
children 696dbb4fd390
comparison
equal deleted inserted replaced
713:9d1973813d8b 714:6a1dbba0cca7
1105 else 1105 else
1106 LOG(INFO) << "Patient " << publicId << " has been unprotected"; 1106 LOG(INFO) << "Patient " << publicId << " has been unprotected";
1107 } 1107 }
1108 1108
1109 1109
1110 void ServerIndex::GetChildren(std::list<std::string>& result,
1111 const std::string& publicId)
1112 {
1113 result.clear();
1114
1115 boost::mutex::scoped_lock lock(mutex_);
1116
1117 ResourceType type;
1118 int64_t resource;
1119 if (!db_->LookupResource(publicId, resource, type))
1120 {
1121 throw OrthancException(ErrorCode_UnknownResource);
1122 }
1123
1124 if (type == ResourceType_Instance)
1125 {
1126 // An instance cannot have a child
1127 throw OrthancException(ErrorCode_BadParameterType);
1128 }
1129
1130 std::list<int64_t> tmp;
1131 db_->GetChildrenInternalId(tmp, resource);
1132
1133 for (std::list<int64_t>::const_iterator
1134 it = tmp.begin(); it != tmp.end(); ++it)
1135 {
1136 result.push_back(db_->GetPublicId(*it));
1137 }
1138 }
1139
1140
1110 void ServerIndex::GetChildInstances(std::list<std::string>& result, 1141 void ServerIndex::GetChildInstances(std::list<std::string>& result,
1111 const std::string& publicId) 1142 const std::string& publicId)
1112 { 1143 {
1113 result.clear(); 1144 result.clear();
1114 1145