namespace detail File descriptor as a scoped resource. */
| 406 | /** File descriptor as a scoped resource. |
| 407 | */ |
| 408 | class ats_scoped_fd : public ats_scoped_resource<detail::SCOPED_FD_TRAITS> |
| 409 | { |
| 410 | public: |
| 411 | using super_type = ats_scoped_resource<detail::SCOPED_FD_TRAITS>; ///< Super type. |
| 412 | using self_type = ats_scoped_fd; ///< Self reference type. |
| 413 | |
| 414 | /// Default constructor - an empty container. |
| 415 | ats_scoped_fd() : super_type() {} |
| 416 | /// Construct with contained resource. |
| 417 | explicit ats_scoped_fd(value_type rt) : super_type(rt) {} |
| 418 | /// Move ownership constructor. |
| 419 | ats_scoped_fd(self_type &&that) : super_type(that.release()) {} |
| 420 | /** Place a new resource @a rt in the container. |
| 421 | Any resource currently contained is destroyed. |
| 422 | This object becomes the owner of @a rt. |
| 423 | */ |
| 424 | self_type & |
| 425 | operator=(value_type rt) |
| 426 | { |
| 427 | super_type::operator=(rt); |
| 428 | return *this; |
| 429 | } |
| 430 | /** Move the resource from @a that to @a this. |
| 431 | If @a this has a resource, that resource is destroyed. |
| 432 | This object becomes the owner of the resource in @a that. |
| 433 | */ |
| 434 | self_type & |
| 435 | operator=(self_type &&that) |
| 436 | { |
| 437 | super_type::operator=(that.release()); |
| 438 | return *this; |
| 439 | } |
| 440 | }; |
| 441 | |
| 442 | namespace detail |
| 443 | { |
no test coverage detected