iterator.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #include <dns/rrset.h>
  15. #include <boost/noncopyable.hpp>
  16. namespace isc {
  17. namespace datasrc {
  18. /**
  19. * \brief Read-only iterator to a zone.
  20. *
  21. * You can get an instance of (descendand of) ZoneIterator from
  22. * DataSourceClient::getIterator() method. The actual concrete implementation
  23. * will be different depending on the actual data source used. This is the
  24. * abstract interface.
  25. *
  26. * There's no way to start iterating from the beginning again or return.
  27. */
  28. class ZoneIterator : public boost::noncopyable {
  29. public:
  30. /**
  31. * \brief Destructor
  32. *
  33. * Virtual destructor. It is empty, but ensures the right destructor from
  34. * descendant is called.
  35. */
  36. virtual ~ ZoneIterator() { }
  37. /**
  38. * \brief Get next RRset from the zone.
  39. *
  40. * This returns the next RRset in the zone as a shared pointer. The
  41. * shared pointer is used to allow both accessing in-memory data and
  42. * automatic memory management.
  43. *
  44. * Any special order is not guaranteed.
  45. *
  46. * While this can potentially throw anything (including standard allocation
  47. * errors), it should be rare.
  48. *
  49. * \return Pointer to the next RRset or NULL pointer when the iteration
  50. * gets to the end of the zone.
  51. */
  52. virtual isc::dns::ConstRRsetPtr getNextRRset() = 0;
  53. };
  54. }
  55. }