| 231 | |
| 232 | |
| 233 | bool Foam::objectRegistry::checkOut(regIOobject& io) const |
| 234 | { |
| 235 | iterator iter = const_cast<objectRegistry&>(*this).find(io.name()); |
| 236 | |
| 237 | if (iter != end()) |
| 238 | { |
| 239 | if (objectRegistry::debug) |
| 240 | { |
| 241 | Pout<< "objectRegistry::checkOut(regIOobject&) : " |
| 242 | << name() << " : checking out " << iter.key() |
| 243 | << endl; |
| 244 | } |
| 245 | |
| 246 | if (iter() != &io) |
| 247 | { |
| 248 | if (objectRegistry::debug) |
| 249 | { |
| 250 | WarningInFunction |
| 251 | << name() << " : attempt to checkOut copy of " |
| 252 | << iter.key() |
| 253 | << endl; |
| 254 | } |
| 255 | |
| 256 | return false; |
| 257 | } |
| 258 | else |
| 259 | { |
| 260 | regIOobject* object = iter(); |
| 261 | |
| 262 | bool hasErased = const_cast<objectRegistry&>(*this).erase(iter); |
| 263 | |
| 264 | if (io.ownedByRegistry()) |
| 265 | { |
| 266 | delete object; |
| 267 | } |
| 268 | |
| 269 | return hasErased; |
| 270 | } |
| 271 | } |
| 272 | else |
| 273 | { |
| 274 | if (objectRegistry::debug) |
| 275 | { |
| 276 | Pout<< "objectRegistry::checkOut(regIOobject&) : " |
| 277 | << name() << " : could not find " << io.name() |
| 278 | << " in registry " << name() |
| 279 | << endl; |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | return false; |
| 284 | } |
| 285 | |
| 286 | |
| 287 | void Foam::objectRegistry::rename(const word& newName) |
no test coverage detected