[svn] commit: r3672 - in /branches/trac408/src/lib/nsas: asiolink.h hash_table.h lru_list.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Nov 30 12:30:06 UTC 2010
Author: vorner
Date: Tue Nov 30 12:30:06 2010
New Revision: 3672
Log:
Fix virtual destructors
Classes with virtual functions and non-virtual destructors are probably
wrong. Some destructors were added, one class had its virtual functions
changed to ordinary, since it did not need them.
Modified:
branches/trac408/src/lib/nsas/asiolink.h
branches/trac408/src/lib/nsas/hash_table.h
branches/trac408/src/lib/nsas/lru_list.h
Modified: branches/trac408/src/lib/nsas/asiolink.h
==============================================================================
--- branches/trac408/src/lib/nsas/asiolink.h (original)
+++ branches/trac408/src/lib/nsas/asiolink.h Tue Nov 30 12:30:06 2010
@@ -35,6 +35,9 @@
IOAddress(const std::string& address_str) : address_(address_str)
{}
+ /// \param Just a virtual destructor
+ virtual ~ IOAddress() { }
+
/// \return Textual representation of the address
std::string toText() const
{return address_;}
Modified: branches/trac408/src/lib/nsas/hash_table.h
==============================================================================
--- branches/trac408/src/lib/nsas/hash_table.h (original)
+++ branches/trac408/src/lib/nsas/hash_table.h Tue Nov 30 12:30:06 2010
@@ -100,6 +100,8 @@
///
/// \return bool true of the name of the object is equal to the name given.
virtual bool operator()(T* object, const HashKey& key) const = 0;
+ /// \brief Virtual destructor
+ virtual ~ HashTableCompare() { }
};
@@ -152,7 +154,7 @@
/// calculated and used to index the table.
///
/// \return Shared pointer to the object or NULL if it is not there.
- virtual boost::shared_ptr<T> get(const HashKey& key) {
+ boost::shared_ptr<T> get(const HashKey& key) {
uint32_t index = hash_(key);
sharable_lock lock(table_[index].mutex_);
return getInternal(key, index);
@@ -168,7 +170,7 @@
/// calculated and used to index the table.
///
/// \return true if the object was deleted, false if it was not found.
- virtual bool remove(const HashKey& key);
+ bool remove(const HashKey& key);
/// \brief Add Entry
///
@@ -184,7 +186,7 @@
/// same name already exists, the existing object is replaced. If false,
// the addition fails and a status is returned.
/// \return true if the object was successfully added, false otherwise.
- virtual bool add(boost::shared_ptr<T>& object, const HashKey& key,
+ bool add(boost::shared_ptr<T>& object, const HashKey& key,
bool replace = false)
{
uint32_t index = hash_(key);
@@ -234,15 +236,15 @@
/// \brief Returns Size of Hash Table
///
/// \return Size of hash table
- virtual uint32_t tableSize() const {
+ uint32_t tableSize() const {
return table_.size();
}
protected:
// Internal parts, expect to be already locked
- virtual boost::shared_ptr<T> getInternal(const HashKey& key,
+ boost::shared_ptr<T> getInternal(const HashKey& key,
uint32_t index);
- virtual bool addInternal(boost::shared_ptr<T>& object, const HashKey& key,
+ bool addInternal(boost::shared_ptr<T>& object, const HashKey& key,
uint32_t index, bool replace = false);
private:
Modified: branches/trac408/src/lib/nsas/lru_list.h
==============================================================================
--- branches/trac408/src/lib/nsas/lru_list.h (original)
+++ branches/trac408/src/lib/nsas/lru_list.h Tue Nov 30 12:30:06 2010
@@ -66,6 +66,8 @@
///
/// \param drop Object being dropped.
virtual void operator()(T* drop) const = 0;
+ /// \brief Virtual destructor
+ virtual ~ Dropped() { }
};
/// \brief Constructor
More information about the bind10-changes
mailing list