irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

collection_iterator.hpp
Go to the documentation of this file.
1 #ifndef IRODS_FILESYSTEM_COLLECTION_ITERATOR_HPP
2 #define IRODS_FILESYSTEM_COLLECTION_ITERATOR_HPP
3 
4 #include "filesystem/config.hpp"
7 #include "filesystem/path.hpp"
8 
9 #include "rcConnect.h"
10 
11 #include <iterator>
12 #include <memory>
13 
15 {
16  enum class collection_options
17  {
18  none,
20  };
21 
23  {
24  public:
25  // clang-format off
27  using difference_type = std::ptrdiff_t;
28  using pointer = const value_type*;
29  using reference = const value_type&;
30  using iterator_category = std::input_iterator_tag;
31  // clang-format on
32 
33  // Constructors and destructor
34 
35  collection_iterator() = default;
36 
38  const path& _p,
39  collection_options _opts = collection_options::none);
40 
41  collection_iterator(const collection_iterator& _other) = default;
42  auto operator=(const collection_iterator& _other) -> collection_iterator& = default;
43 
45  auto operator=(collection_iterator&& _other) -> collection_iterator& = default;
46 
48 
49  // Observers
50 
51  auto connection() -> rxComm* { return ctx_->comm; }
52 
53  // clang-format off
54  auto operator*() const -> reference { return ctx_->entry; }
55  auto operator->() const -> pointer { return &ctx_->entry; }
56  // clang-format on
57 
58  // Modifiers
59 
60  auto operator++() -> collection_iterator&;
61 
62  // Compare
63 
64  // clang-format off
65  auto operator==(const collection_iterator& _rhs) const noexcept -> bool { return _rhs.ctx_ == ctx_; }
66  auto operator!=(const collection_iterator& _rhs) const noexcept -> bool { return !(*this == _rhs); }
67  // clang-format on
68 
69  private:
70  struct context
71  {
72  rxComm* comm{};
74  int handle{};
76  };
77 
78  std::shared_ptr<context> ctx_;
79  };
80 
81  // Enables support for range-based for-loops.
82 
83  inline auto begin(collection_iterator _iter) noexcept -> collection_iterator
84  {
85  return _iter;
86  }
87 
88  inline auto end(const collection_iterator&) noexcept -> const collection_iterator
89  {
90  return {};
91  }
92 } // namespace irods::experimental::filesystem::NAMESPACE_IMPL
93 
94 #endif // IRODS_FILESYSTEM_COLLECTION_ITERATOR_HPP
irods::experimental::filesystem::client::collection_iterator::connection
auto connection() -> rcComm_t *
Definition: collection_iterator.hpp:51
collection_entry.hpp
irods::experimental::filesystem::path
Definition: path.hpp:15
config.hpp
irods::experimental::filesystem::collection_entry
Definition: collection_entry.hpp:20
irods::experimental::filesystem::client::collection_iterator::ctx_
std::shared_ptr< context > ctx_
Definition: collection_iterator.hpp:78
rcConnect.h
NAMESPACE_IMPL
#define NAMESPACE_IMPL
Definition: default_transport.hpp:36
rxComm
#define rxComm
Definition: default_transport.hpp:38
irods::experimental::filesystem::client::collection_iterator::collection_iterator
collection_iterator()=default
irods::experimental::filesystem::client::end
auto end(const collection_iterator &) noexcept -> const collection_iterator
Definition: collection_iterator.hpp:88
irods::experimental::filesystem::client::collection_iterator::operator*
auto operator*() const -> reference
Definition: collection_iterator.hpp:54
irods::experimental::filesystem::client::begin
auto begin(collection_iterator _iter) noexcept -> collection_iterator
Definition: collection_iterator.hpp:83
irods::experimental::filesystem::client::collection_iterator::operator=
auto operator=(const collection_iterator &_other) -> collection_iterator &=default
irods::experimental::filesystem::client::collection_iterator::context
Definition: collection_iterator.hpp:71
irods::experimental::filesystem::client::collection_iterator::operator=
auto operator=(collection_iterator &&_other) -> collection_iterator &=default
irods::experimental::filesystem::client::collection_iterator::operator!=
auto operator!=(const collection_iterator &_rhs) const noexcept -> bool
Definition: collection_iterator.hpp:66
irods::experimental::filesystem::client::collection_iterator::collection_iterator
collection_iterator(const collection_iterator &_other)=default
irods::experimental::filesystem::client::collection_iterator
Definition: collection_iterator.hpp:23
irods::experimental::filesystem::client::collection_iterator::difference_type
std::ptrdiff_t difference_type
Definition: collection_iterator.hpp:27
irods::experimental::filesystem::client::collection_iterator::iterator_category
std::input_iterator_tag iterator_category
Definition: collection_iterator.hpp:30
entry
Definition: ruleAdmin.cpp:22
filesystem.hpp
irods::experimental::filesystem::client::collection_iterator::operator==
auto operator==(const collection_iterator &_rhs) const noexcept -> bool
Definition: collection_iterator.hpp:65
irods::experimental::filesystem::client::collection_options::none
@ none
irods::experimental::filesystem::client::collection_options
collection_options
Definition: collection_iterator.hpp:17
irods::experimental::filesystem::client::collection_iterator::collection_iterator
collection_iterator(collection_iterator &&_other)=default
path.hpp
irods::experimental::filesystem::client::collection_iterator::operator->
auto operator->() const -> pointer
Definition: collection_iterator.hpp:55