mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Info -> InfoInFunction and updated comments
This commit is contained in:
@ -121,13 +121,12 @@ bool Foam::HashTable<T, Key, Hash>::found(const Key& key) const
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef FULLDEBUG
|
||||
#ifdef FULLDEBUG
|
||||
if (debug)
|
||||
{
|
||||
Info<< "HashTable<T, Key, Hash>::found(const Key& key) : "
|
||||
<< "Entry " << key << " not found in hash table\n";
|
||||
InfoInFunction << "Entry " << key << " not found in hash table\n";
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -153,13 +152,12 @@ Foam::HashTable<T, Key, Hash>::find
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef FULLDEBUG
|
||||
#ifdef FULLDEBUG
|
||||
if (debug)
|
||||
{
|
||||
Info<< "HashTable<T, Key, Hash>::find(const Key& key) : "
|
||||
<< "Entry " << key << " not found in hash table\n";
|
||||
InfoInFunction << "Entry " << key << " not found in hash table\n";
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return iterator();
|
||||
}
|
||||
@ -185,13 +183,12 @@ Foam::HashTable<T, Key, Hash>::find
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef FULLDEBUG
|
||||
#ifdef FULLDEBUG
|
||||
if (debug)
|
||||
{
|
||||
Info<< "HashTable<T, Key, Hash>::find(const Key& key) const : "
|
||||
<< "Entry " << key << " not found in hash table\n";
|
||||
InfoInFunction << "Entry " << key << " not found in hash table\n";
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return const_iterator();
|
||||
}
|
||||
@ -250,7 +247,7 @@ bool Foam::HashTable<T, Key, Hash>::set
|
||||
prev = ep;
|
||||
}
|
||||
|
||||
// not found, insert it at the head
|
||||
// Not found, insert it at the head
|
||||
if (!existing)
|
||||
{
|
||||
table_[hashIdx] = new hashedEntry(key, table_[hashIdx], newEntry);
|
||||
@ -258,39 +255,36 @@ bool Foam::HashTable<T, Key, Hash>::set
|
||||
|
||||
if (double(nElmts_)/tableSize_ > 0.8 && tableSize_ < maxTableSize)
|
||||
{
|
||||
# ifdef FULLDEBUG
|
||||
#ifdef FULLDEBUG
|
||||
if (debug)
|
||||
{
|
||||
Info<< "HashTable<T, Key, Hash>::set"
|
||||
"(const Key& key, T newEntry) : "
|
||||
"Doubling table size\n";
|
||||
InfoInFunction << "Doubling table size\n";
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
resize(2*tableSize_);
|
||||
}
|
||||
}
|
||||
else if (protect)
|
||||
{
|
||||
// found - but protected from overwriting
|
||||
// Found - but protected from overwriting
|
||||
// this corresponds to the STL 'insert' convention
|
||||
# ifdef FULLDEBUG
|
||||
#ifdef FULLDEBUG
|
||||
if (debug)
|
||||
{
|
||||
Info<< "HashTable<T, Key, Hash>::set"
|
||||
"(const Key& key, T newEntry, true) : "
|
||||
"Cannot insert " << key << " already in hash table\n";
|
||||
InfoInFunction
|
||||
<< "Cannot insert " << key << " already in hash table\n";
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// found - overwrite existing entry
|
||||
// Found - overwrite existing entry
|
||||
// this corresponds to the Perl convention
|
||||
hashedEntry* ep = new hashedEntry(key, existing->next_, newEntry);
|
||||
|
||||
// replace existing element - within list or insert at the head
|
||||
// Replace existing element - within list or insert at the head
|
||||
if (prev)
|
||||
{
|
||||
prev->next_ = ep;
|
||||
@ -310,7 +304,7 @@ bool Foam::HashTable<T, Key, Hash>::set
|
||||
template<class T, class Key, class Hash>
|
||||
bool Foam::HashTable<T, Key, Hash>::iteratorBase::erase()
|
||||
{
|
||||
// note: entryPtr_ is NULL for end(), so this catches that too
|
||||
// Note: entryPtr_ is NULL for end(), so this catches that too
|
||||
if (entryPtr_)
|
||||
{
|
||||
// Search element before entryPtr_
|
||||
@ -332,7 +326,7 @@ bool Foam::HashTable<T, Key, Hash>::iteratorBase::erase()
|
||||
|
||||
if (prev)
|
||||
{
|
||||
// has an element before entryPtr - reposition to there
|
||||
// Has an element before entryPtr - reposition to there
|
||||
prev->next_ = entryPtr_->next_;
|
||||
delete entryPtr_;
|
||||
entryPtr_ = prev;
|
||||
@ -343,7 +337,7 @@ bool Foam::HashTable<T, Key, Hash>::iteratorBase::erase()
|
||||
hashTable_->table_[hashIndex_] = entryPtr_->next_;
|
||||
delete entryPtr_;
|
||||
|
||||
// assign any non-NULL pointer value so it doesn't look
|
||||
// Assign any non-NULL pointer value so it doesn't look
|
||||
// like end()/cend()
|
||||
entryPtr_ = reinterpret_cast<hashedEntry*>(this);
|
||||
|
||||
@ -378,7 +372,7 @@ bool Foam::HashTable<T, Key, Hash>::iteratorBase::erase()
|
||||
template<class T, class Key, class Hash>
|
||||
bool Foam::HashTable<T, Key, Hash>::erase(const iterator& iter)
|
||||
{
|
||||
// adjust iterator after erase
|
||||
// Adjust iterator after erase
|
||||
return const_cast<iterator&>(iter).erase();
|
||||
}
|
||||
|
||||
@ -439,13 +433,12 @@ void Foam::HashTable<T, Key, Hash>::resize(const label sz)
|
||||
|
||||
if (newSize == tableSize_)
|
||||
{
|
||||
# ifdef FULLDEBUG
|
||||
#ifdef FULLDEBUG
|
||||
if (debug)
|
||||
{
|
||||
Info<< "HashTable<T, Key, Hash>::resize(const label) : "
|
||||
<< "new table size == old table size\n";
|
||||
InfoInFunction << "New table size == old table size\n";
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
@ -508,7 +501,7 @@ void Foam::HashTable<T, Key, Hash>::shrink()
|
||||
|
||||
if (newSize < tableSize_)
|
||||
{
|
||||
// avoid having the table disappear on us
|
||||
// Avoid having the table disappear on us
|
||||
resize(newSize ? newSize : 2);
|
||||
}
|
||||
}
|
||||
@ -517,7 +510,7 @@ void Foam::HashTable<T, Key, Hash>::shrink()
|
||||
template<class T, class Key, class Hash>
|
||||
void Foam::HashTable<T, Key, Hash>::transfer(HashTable<T, Key, Hash>& ht)
|
||||
{
|
||||
// as per the Destructor
|
||||
// As per the Destructor
|
||||
if (table_)
|
||||
{
|
||||
clear();
|
||||
@ -551,7 +544,7 @@ void Foam::HashTable<T, Key, Hash>::operator=
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// could be zero-sized from a previous transfer()
|
||||
// Could be zero-sized from a previous transfer()
|
||||
if (!tableSize_)
|
||||
{
|
||||
resize(rhs.tableSize_);
|
||||
@ -574,7 +567,7 @@ bool Foam::HashTable<T, Key, Hash>::operator==
|
||||
const HashTable<T, Key, Hash>& rhs
|
||||
) const
|
||||
{
|
||||
// sizes (number of keys) must match
|
||||
// Sizes (number of keys) must match
|
||||
if (size() != rhs.size())
|
||||
{
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user