rdataset.cc 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. #include "rdataset.h"
  15. #include <new> // for the placement new
  16. namespace isc {
  17. namespace datasrc {
  18. namespace memory {
  19. RdataSet*
  20. RdataSet::create(util::MemorySegment& mem_sgmt) {
  21. void* p = mem_sgmt.allocate(sizeof(RdataSet));
  22. RdataSet* rdataset = new(p) RdataSet();
  23. return (rdataset);
  24. }
  25. void
  26. RdataSet::destroy(util::MemorySegment& mem_sgmt, RdataSet* rdataset) {
  27. rdataset->~RdataSet();
  28. mem_sgmt.deallocate(rdataset, sizeof(RdataSet));
  29. }
  30. } // namespace memory
  31. } // namespace datasrc
  32. } // datasrc isc