Commit a51d6b87 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[1067] some style fixes

parent 89bd1bf6
......@@ -150,6 +150,7 @@ public:
/// \param name A domain name for which the search is performed.
/// \return A \c FindResult object enclosing the search result (see above).
virtual FindResult findZone(const isc::dns::Name& name) const = 0;
/// \brief Returns an iterator to the given zone
///
/// This allows for traversing the whole zone. The returned object can
......
......@@ -111,6 +111,7 @@ public:
// Prepare data for the next time
getData();
}
virtual isc::dns::ConstRRsetPtr getNextRRset() {
if (!ready_) {
isc_throw(isc::Unexpected, "Iterating past the zone end");
......@@ -120,14 +121,14 @@ public:
ready_ = false;
return (ConstRRsetPtr());
}
string nameStr(name_), rtypeStr(rtype_), ttl(ttl_);
Name name(nameStr);
RRType rtype(rtypeStr);
string name_str(name_), rtype_str(rtype_), ttl(ttl_);
Name name(name_str);
RRType rtype(rtype_str);
RRsetPtr rrset(new RRset(name, class_, rtype, RRTTL(ttl)));
while (data_ready_ && name_ == nameStr && rtypeStr == rtype_) {
while (data_ready_ && name_ == name_str && rtype_str == rtype_) {
if (ttl_ != ttl) {
isc_throw(DataSourceError, "TTLs in rrset " + nameStr + "/" +
rtypeStr + " differ");
isc_throw(DataSourceError, "TTLs in rrset " + name_str + "/" +
rtype_str + " differ");
}
rrset->addRdata(rdata::createRdata(rtype, class_, rdata_));
getData();
......@@ -144,6 +145,7 @@ private:
ttl_ = data[2];
rdata_ = data[3];
}
// The context
const DatabaseAccessor::IteratorContextPtr context_;
// Class of the zone
......
......@@ -74,6 +74,7 @@ public:
* an opaque handle.
*/
virtual std::pair<bool, int> getZone(const isc::dns::Name& name) const = 0;
/**
* \brief This holds the internal context of ZoneIterator for databases
*
......@@ -96,14 +97,15 @@ public:
* Virtual destructor, so any descendand class is destroyed correctly.
*/
virtual ~IteratorContext() { }
/**
* \brief Function to provide next resource record
*
* This function should provide data about the next resource record
* from the iterated zone. The data are not converted yet.
*
* The order of RRs is not strictly set, but the RRs for single RRset
* must not be interlieved with any other RRs (eg. RRsets must be
* \note The order of RRs is not strictly set, but the RRs for single
* RRset must not be interleaved with any other RRs (eg. RRsets must be
* "together").
*
* \param data The data are to be returned by this parameter. They are
......@@ -114,7 +116,9 @@ public:
*/
virtual bool getNext(std::string data[4]) = 0;
};
typedef boost::shared_ptr<IteratorContext> IteratorContextPtr;
/**
* \brief Creates an iterator context for given zone.
*
......@@ -250,6 +254,7 @@ public:
* should use it as a ZoneFinder only.
*/
virtual FindResult findZone(const isc::dns::Name& name) const;
/**
* \brief Get the zone iterator
*
......@@ -268,6 +273,7 @@ public:
* \return Shared pointer to the iterator (it will never be NULL)
*/
virtual ZoneIteratorPtr getIterator(const isc::dns::Name& name) const;
private:
/// \brief Our database.
const boost::shared_ptr<DatabaseAccessor> database_;
......
......@@ -38,6 +38,7 @@ public:
* descendant is called.
*/
virtual ~ ZoneIterator() { }
/**
* \brief Get next RRset from the zone.
*
......
......@@ -736,6 +736,7 @@ public:
dom_iterator_ = node_->getData()->begin();
}
}
virtual ConstRRsetPtr getNextRRset() {
if (!ready_) {
isc_throw(Unexpected, "Iterating past the zone end");
......@@ -757,12 +758,12 @@ public:
if (node_ == NULL) {
// That's all, folks
ready_ = false;
return ConstRRsetPtr();
return (ConstRRsetPtr());
}
// The iterator points to the next yet unused RRset now
ConstRRsetPtr result(dom_iterator_->second);
// This one is used, move it to the next time for next call
++ dom_iterator_;
++dom_iterator_;
return (result);
}
......@@ -789,7 +790,7 @@ InMemoryClient::getIterator(const Name& name) const {
isc_throw(Unexpected, "The zone at " + name.toText() +
" is not InMemoryZoneFinder");
}
return ZoneIteratorPtr(new MemoryIterator(zone->impl_->domains_, name));
return (ZoneIteratorPtr(new MemoryIterator(zone->impl_->domains_, name)));
}
} // end of namespace datasrc
......
......@@ -90,6 +90,7 @@ public:
* element and the zone id in the second if it was.
*/
virtual std::pair<bool, int> getZone(const isc::dns::Name& name) const;
/// \brief Implementation of DatabaseAbstraction::getIteratorContext
virtual IteratorContextPtr getIteratorContext(const isc::dns::Name&,
int id) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment