| 1377 | |
| 1378 | |
| 1379 | bool Resources::Resource_::contains(const Resource_& that) const |
| 1380 | { |
| 1381 | // Both Resource_ objects should have the same sharedness. |
| 1382 | if (isShared() != that.isShared()) { |
| 1383 | return false; |
| 1384 | } |
| 1385 | |
| 1386 | // Assuming the wrapped Resource objects are equal, the 'contains' |
| 1387 | // relationship is determined by the relationship of the counters |
| 1388 | // for shared resources. |
| 1389 | if (isShared()) { |
| 1390 | return sharedCount.get() >= that.sharedCount.get() && |
| 1391 | resource == that.resource; |
| 1392 | } |
| 1393 | |
| 1394 | // For non-shared resources just compare the protobufs. |
| 1395 | return mesos::contains(resource, that.resource); |
| 1396 | } |
| 1397 | |
| 1398 | |
| 1399 | Resources::Resource_& Resources::Resource_::operator+=(const Resource_& that) |
no test coverage detected