zone_table_segment_local.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Copyright (C) 2012 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. #ifndef ZONE_TABLE_SEGMENT_LOCAL_H
  15. #define ZONE_TABLE_SEGMENT_LOCAL_H
  16. #include <datasrc/memory/zone_table_segment.h>
  17. #include <util/memory_segment_local.h>
  18. namespace isc {
  19. namespace datasrc {
  20. namespace memory {
  21. /// \brief Local implementation of ZoneTableSegment class
  22. ///
  23. /// This class specifies a concrete implementation for a
  24. /// MemorySegmentLocal based ZoneTableSegment. Please see the
  25. /// ZoneTableSegment class documentation for usage.
  26. class ZoneTableSegmentLocal : public ZoneTableSegment {
  27. // This is so that ZoneTableSegmentLocal can be instantiated from
  28. // ZoneTableSegment::create().
  29. friend class ZoneTableSegment;
  30. protected:
  31. /// \brief Protected constructor
  32. ///
  33. /// Instances are expected to be created by the factory method
  34. /// (\c ZoneTableSegment::create()), so this constructor is
  35. /// protected.
  36. ZoneTableSegmentLocal(const isc::dns::RRClass& rrclass);
  37. public:
  38. /// \brief Destructor
  39. virtual ~ZoneTableSegmentLocal();
  40. /// \brief Return the ZoneTableHeader for the local zone table
  41. /// segment implementation.
  42. virtual ZoneTableHeader& getHeader();
  43. /// \brief const version of \c getHeader().
  44. virtual const ZoneTableHeader& getHeader() const;
  45. /// \brief Return the MemorySegment for the local zone table segment
  46. /// implementation (a MemorySegmentLocal instance).
  47. virtual isc::util::MemorySegment& getMemorySegment();
  48. /// \brief Return true if the segment is writable.
  49. ///
  50. /// Local segments are always writable. This implementation always
  51. /// returns true.
  52. virtual bool isWritable() const {
  53. return (true);
  54. }
  55. /// \brief This method currently doesn't do anything.
  56. ///
  57. /// \c mode and \c params args are currently ignored.
  58. virtual void reset(MemorySegmentOpenMode mode,
  59. isc::data::ConstElementPtr params);
  60. private:
  61. isc::util::MemorySegmentLocal mem_sgmt_;
  62. ZoneTableHeader header_;
  63. };
  64. } // namespace memory
  65. } // namespace datasrc
  66. } // namespace isc
  67. #endif // ZONE_TABLE_SEGMENT_LOCAL_H