| 190 | } |
| 191 | |
| 192 | Status ResourceMgr::DoLookup(const string& container, TypeIndex type, |
| 193 | const string& name, |
| 194 | ResourceBase** resource) const { |
| 195 | const Container* b = gtl::FindPtrOrNull(containers_, container); |
| 196 | if (b == nullptr) { |
| 197 | return errors::NotFound("Container ", container, |
| 198 | " does not exist. (Could not find resource: ", |
| 199 | container, "/", name, ")"); |
| 200 | } |
| 201 | auto iter = b->find({type.hash_code(), name}); |
| 202 | if (iter == b->end()) { |
| 203 | return errors::NotFound("Resource ", container, "/", name, "/", type.name(), |
| 204 | " does not exist."); |
| 205 | } |
| 206 | *resource = const_cast<ResourceBase*>(iter->second.resource.get()); |
| 207 | (*resource)->Ref(); |
| 208 | return Status::OK(); |
| 209 | } |
| 210 | |
| 211 | Status ResourceMgr::DoDelete(const string& container, uint64 type_hash_code, |
| 212 | const string& resource_name, |