[svn] commit: r3913 - in /branches/trac441/src/lib/datasrc: memory_datasrc.cc memory_datasrc.h zonetable.cc zonetable.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Dec 21 09:25:01 UTC 2010
Author: vorner
Date: Tue Dec 21 09:25:01 2010
New Revision: 3913
Log:
Move MemoryZone to memory_datasrc.{h,cc}
Modified:
branches/trac441/src/lib/datasrc/memory_datasrc.cc
branches/trac441/src/lib/datasrc/memory_datasrc.h
branches/trac441/src/lib/datasrc/zonetable.cc
branches/trac441/src/lib/datasrc/zonetable.h
Modified: branches/trac441/src/lib/datasrc/memory_datasrc.cc
==============================================================================
--- branches/trac441/src/lib/datasrc/memory_datasrc.cc (original)
+++ branches/trac441/src/lib/datasrc/memory_datasrc.cc Tue Dec 21 09:25:01 2010
@@ -13,6 +13,8 @@
// PERFORMANCE OF THIS SOFTWARE.
#include <dns/name.h>
+#include <dns/rrclass.h>
+
#include <datasrc/memory_datasrc.h>
using namespace std;
@@ -20,6 +22,39 @@
namespace isc {
namespace datasrc {
+
+struct MemoryZone::MemoryZoneImpl {
+ MemoryZoneImpl(const RRClass& zone_class, const Name& origin) :
+ zone_class_(zone_class), origin_(origin)
+ {}
+ RRClass zone_class_;
+ Name origin_;
+};
+
+MemoryZone::MemoryZone(const RRClass& zone_class, const Name& origin) :
+ impl_(new MemoryZoneImpl(zone_class, origin))
+{
+}
+
+MemoryZone::~MemoryZone() {
+ delete impl_;
+}
+
+const Name&
+MemoryZone::getOrigin() const {
+ return (impl_->origin_);
+}
+
+const RRClass&
+MemoryZone::getClass() const {
+ return (impl_->zone_class_);
+}
+
+Zone::FindResult
+MemoryZone::find(const Name&, const RRType&) const {
+ // This is a tentative implementation that always returns NXDOMAIN.
+ return (FindResult(NXDOMAIN, RRsetPtr()));
+}
/// Implementation details for \c MemoryDataSrc hidden from the public
/// interface.
Modified: branches/trac441/src/lib/datasrc/memory_datasrc.h
==============================================================================
--- branches/trac441/src/lib/datasrc/memory_datasrc.h (original)
+++ branches/trac441/src/lib/datasrc/memory_datasrc.h Tue Dec 21 09:25:01 2010
@@ -23,6 +23,50 @@
};
namespace datasrc {
+
+/// A derived zone class intended to be used with the memory data source.
+///
+/// Currently this is almost empty and is only used for testing the
+/// \c ZoneTable class. It will be substantially expanded, and will probably
+/// moved to a separate header file.
+///
+/// \todo Is this really needed in header file? If it is used only inside
+/// MemoryDataSrc, we could move it to .cc file and not care about the impl_.
+class MemoryZone : public Zone {
+ ///
+ /// \name Constructors and Destructor.
+ ///
+ /// \b Note:
+ /// The copy constructor and the assignment operator are intentionally
+ /// defined as private, making this class non copyable.
+ //@{
+private:
+ MemoryZone(const MemoryZone& source);
+ MemoryZone& operator=(const MemoryZone& source);
+public:
+ /// \brief Constructor from zone parameters.
+ ///
+ /// This constructor internally involves resource allocation, and if
+ /// it fails, a corresponding standard exception will be thrown.
+ /// It never throws an exception otherwise.
+ ///
+ /// \param rrclass The RR class of the zone.
+ /// \param origin The origin name of the zone.
+ MemoryZone(const isc::dns::RRClass& rrclass, const isc::dns::Name& origin);
+
+ /// The destructor.
+ virtual ~MemoryZone();
+ //@}
+
+ virtual const isc::dns::Name& getOrigin() const;
+ virtual const isc::dns::RRClass& getClass() const;
+ virtual FindResult find(const isc::dns::Name& name,
+ const isc::dns::RRType& type) const;
+
+private:
+ struct MemoryZoneImpl;
+ MemoryZoneImpl* impl_;
+};
/// \brief A data source that uses in memory dedicated backend.
///
Modified: branches/trac441/src/lib/datasrc/zonetable.cc
==============================================================================
--- branches/trac441/src/lib/datasrc/zonetable.cc (original)
+++ branches/trac441/src/lib/datasrc/zonetable.cc Tue Dec 21 09:25:01 2010
@@ -18,7 +18,6 @@
#include <utility>
#include <dns/name.h>
-#include <dns/rrclass.h>
#include <datasrc/zonetable.h>
@@ -27,39 +26,6 @@
namespace isc {
namespace datasrc {
-
-struct MemoryZone::MemoryZoneImpl {
- MemoryZoneImpl(const RRClass& zone_class, const Name& origin) :
- zone_class_(zone_class), origin_(origin)
- {}
- RRClass zone_class_;
- Name origin_;
-};
-
-MemoryZone::MemoryZone(const RRClass& zone_class, const Name& origin) :
- impl_(new MemoryZoneImpl(zone_class, origin))
-{
-}
-
-MemoryZone::~MemoryZone() {
- delete impl_;
-}
-
-const Name&
-MemoryZone::getOrigin() const {
- return (impl_->origin_);
-}
-
-const RRClass&
-MemoryZone::getClass() const {
- return (impl_->zone_class_);
-}
-
-Zone::FindResult
-MemoryZone::find(const Name&, const RRType&) const {
- // This is a tentative implementation that always returns NXDOMAIN.
- return (FindResult(NXDOMAIN, RRsetPtr()));
-}
// This is a temporary, inefficient implementation using std::map and handmade
// iteration to realize longest match.
Modified: branches/trac441/src/lib/datasrc/zonetable.h
==============================================================================
--- branches/trac441/src/lib/datasrc/zonetable.h (original)
+++ branches/trac441/src/lib/datasrc/zonetable.h Tue Dec 21 09:25:01 2010
@@ -28,47 +28,6 @@
};
namespace datasrc {
-
-/// A derived zone class intended to be used with the memory data source.
-///
-/// Currently this is almost empty and is only used for testing the
-/// \c ZoneTable class. It will be substantially expanded, and will probably
-/// moved to a separate header file.
-class MemoryZone : public Zone {
- ///
- /// \name Constructors and Destructor.
- ///
- /// \b Note:
- /// The copy constructor and the assignment operator are intentionally
- /// defined as private, making this class non copyable.
- //@{
-private:
- MemoryZone(const MemoryZone& source);
- MemoryZone& operator=(const MemoryZone& source);
-public:
- /// \brief Constructor from zone parameters.
- ///
- /// This constructor internally involves resource allocation, and if
- /// it fails, a corresponding standard exception will be thrown.
- /// It never throws an exception otherwise.
- ///
- /// \param rrclass The RR class of the zone.
- /// \param origin The origin name of the zone.
- MemoryZone(const isc::dns::RRClass& rrclass, const isc::dns::Name& origin);
-
- /// The destructor.
- virtual ~MemoryZone();
- //@}
-
- virtual const isc::dns::Name& getOrigin() const;
- virtual const isc::dns::RRClass& getClass() const;
- virtual FindResult find(const isc::dns::Name& name,
- const isc::dns::RRType& type) const;
-
-private:
- struct MemoryZoneImpl;
- MemoryZoneImpl* impl_;
-};
/// \brief A set of authoritative zones.
///
More information about the bind10-changes
mailing list