STYLE: cleanup doxygen for HashTable/HashSet

- remove stray canonicalSize declaration
This commit is contained in:
Mark Olesen
2017-04-11 09:32:53 +02:00
parent ef88dd3e44
commit 31da01d1ea
4 changed files with 61 additions and 65 deletions

View File

@ -51,10 +51,10 @@ class Ostream;
template<class T, class Key, class Hash> class HashPtrTable; template<class T, class Key, class Hash> class HashPtrTable;
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Istream& operator>>(Istream&, HashPtrTable<T, Key, Hash>&); Istream& operator>>(Istream& is, HashPtrTable<T, Key, Hash>& L);
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Ostream& operator<<(Ostream&, const HashPtrTable<T, Key, Hash>&); Ostream& operator<<(Ostream& os, const HashPtrTable<T, Key, Hash>& L);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -96,8 +96,7 @@ public:
//- Construct from Istream using default Istream constructor class //- Construct from Istream using default Istream constructor class
HashPtrTable(Istream& is); HashPtrTable(Istream& is);
//- Construct from dictionary using default dictionary constructor //- Construct from dictionary with default dictionary constructor class
// class
HashPtrTable(const dictionary& dict); HashPtrTable(const dictionary& dict);
//- Construct as copy //- Construct as copy
@ -135,14 +134,14 @@ public:
friend Istream& operator>> <T, Key, Hash> friend Istream& operator>> <T, Key, Hash>
( (
Istream&, Istream& is,
HashPtrTable<T, Key, Hash>& HashPtrTable<T, Key, Hash>& L
); );
friend Ostream& operator<< <T, Key, Hash> friend Ostream& operator<< <T, Key, Hash>
( (
Ostream&, Ostream& os,
const HashPtrTable<T, Key, Hash>& const HashPtrTable<T, Key, Hash>& L
); );
}; };

View File

@ -83,7 +83,7 @@ public:
{} {}
//- Construct from UList of Key //- Construct from UList of Key
HashSet(const UList<Key>&); HashSet(const UList<Key>& lst);
//- Construct from an initializer list of Key //- Construct from an initializer list of Key
HashSet(std::initializer_list<Key>); HashSet(std::initializer_list<Key>);
@ -109,7 +109,7 @@ public:
//- Construct from the keys of another HashTable, //- Construct from the keys of another HashTable,
// the type of values held is arbitrary. // the type of values held is arbitrary.
template<class AnyType, class AnyHash> template<class AnyType, class AnyHash>
HashSet(const HashTable<AnyType, Key, AnyHash>&); HashSet(const HashTable<AnyType, Key, AnyHash>& h);
// Member Functions // Member Functions
@ -158,24 +158,24 @@ public:
// Member Operators // Member Operators
//- Return true if the entry exists, same as found() //- Return true if the entry exists, same as found()
inline bool operator[](const Key&) const; inline bool operator[](const Key& key) const;
//- Equality. Two hashtables are equal when their contents are equal. //- Equality. Two hashset are equal when they have the same keys.
// Independent of table size or order. // Independent of table size or order.
bool operator==(const HashSet<Key, Hash>&) const; bool operator==(const HashSet<Key, Hash>& rhs) const;
//- The opposite of the equality operation. //- The opposite of the equality operation.
bool operator!=(const HashSet<Key, Hash>&) const; bool operator!=(const HashSet<Key, Hash>& rhs) const;
//- Combine entries from HashSets //- Combine entries from HashSets
void operator|=(const HashSet<Key, Hash>&); void operator|=(const HashSet<Key, Hash>& rhs);
//- Only retain entries found in both HashSets //- Only retain entries found in both HashSets
void operator&=(const HashSet<Key, Hash>&); void operator&=(const HashSet<Key, Hash>& rhs);
//- Only retain unique entries (xor) //- Only retain unique entries (xor)
void operator^=(const HashSet<Key, Hash>&); void operator^=(const HashSet<Key, Hash>& rhs);
//- Add entries listed in the given HashSet to this HashSet //- Add entries listed in the given HashSet to this HashSet
inline void operator+=(const HashSet<Key, Hash>& rhs) inline void operator+=(const HashSet<Key, Hash>& rhs)
@ -184,7 +184,7 @@ public:
} }
//- Remove entries listed in the given HashSet from this HashSet //- Remove entries listed in the given HashSet from this HashSet
void operator-=(const HashSet<Key, Hash>&); void operator-=(const HashSet<Key, Hash>& rhs);
}; };

View File

@ -397,7 +397,7 @@ Foam::label Foam::HashTable<T, Key, Hash>::erase(const UList<Key>& keys)
{ {
if (erase(keys[keyI])) if (erase(keys[keyI]))
{ {
count++; ++count;
} }
} }
@ -420,7 +420,7 @@ Foam::label Foam::HashTable<T, Key, Hash>::erase
{ {
if (rhs.found(iter.key()) && erase(iter)) if (rhs.found(iter.key()) && erase(iter))
{ {
count++; ++count;
} }
} }

View File

@ -67,10 +67,10 @@ template<class Type1, class Type2>
class Tuple2; class Tuple2;
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Istream& operator>>(Istream&, HashTable<T, Key, Hash>&); Istream& operator>>(Istream& is, HashTable<T, Key, Hash>& L);
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Ostream& operator<<(Ostream&, const HashTable<T, Key, Hash>&); Ostream& operator<<(Ostream& os, const HashTable<T, Key, Hash>& L);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -81,7 +81,7 @@ Ostream& operator<<(Ostream&, const HashTable<T, Key, Hash>&);
struct HashTableCore struct HashTableCore
{ {
//- Return a canonical (power-of-two) size //- Return a canonical (power-of-two) size
static label canonicalSize(const label); static label canonicalSize(const label size);
//- Maximum allowable table size //- Maximum allowable table size
static const label maxTableSize; static const label maxTableSize;
@ -165,15 +165,12 @@ class HashTable
// Private Member Functions // Private Member Functions
//- Return a canonical (power-of-two) size
static label canonicalSize(const label);
//- Return the hash index of the Key within the current table size. //- Return the hash index of the Key within the current table size.
// No checks for zero-sized tables. // No checks for zero-sized tables.
inline label hashKeyIndex(const Key&) const; inline label hashKeyIndex(const Key& key) const;
//- Assign a new hashedEntry to a possibly already existing key //- Assign a new hashedEntry to a possibly already existing key
bool set(const Key&, const T& newElmt, bool protect); bool set(const Key& key, const T& newEntry, const bool protect);
public: public:
@ -207,13 +204,13 @@ public:
HashTable(Istream&, const label size = 128); HashTable(Istream&, const label size = 128);
//- Construct as copy //- Construct as copy
HashTable(const HashTable<T, Key, Hash>&); HashTable(const HashTable<T, Key, Hash>& ht);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
HashTable(const Xfer<HashTable<T, Key, Hash>>&); HashTable(const Xfer<HashTable<T, Key, Hash>>& ht);
//- Construct from an initializer list //- Construct from an initializer list
HashTable(std::initializer_list<Tuple2<Key, T>>); HashTable(std::initializer_list<Tuple2<Key, T>> lst);
//- Destructor //- Destructor
@ -234,15 +231,15 @@ public:
inline bool empty() const; inline bool empty() const;
//- Return true if hashedEntry is found in table //- Return true if hashedEntry is found in table
bool found(const Key&) const; bool found(const Key& key) const;
//- Find and return an iterator set at the hashedEntry //- Find and return an iterator set at the hashedEntry
// If not found iterator = end() // If not found iterator = end()
iterator find(const Key&); iterator find(const Key& key);
//- Find and return an const_iterator set at the hashedEntry //- Find and return an const_iterator set at the hashedEntry
// If not found iterator = end() // If not found iterator = end()
const_iterator find(const Key&) const; const_iterator find(const Key& key) const;
//- Return the table of contents //- Return the table of contents
List<Key> toc() const; List<Key> toc() const;
@ -251,37 +248,37 @@ public:
List<Key> sortedToc() const; List<Key> sortedToc() const;
//- Print information //- Print information
Ostream& printInfo(Ostream&) const; Ostream& printInfo(Ostream& os) const;
// Edit // Edit
//- Insert a new hashedEntry //- Insert a new hashedEntry
inline bool insert(const Key&, const T& newElmt); inline bool insert(const Key& key, const T& newEntry);
//- Assign a new hashedEntry, overwriting existing entries //- Assign a new hashedEntry, overwriting existing entries
inline bool set(const Key&, const T& newElmt); inline bool set(const Key& key, const T& newEntry);
//- Erase a hashedEntry specified by given iterator //- Erase a hashedEntry specified by given iterator
// This invalidates the iterator until the next operator++ // This invalidates the iterator until the next operator++
bool erase(const iterator&); bool erase(const iterator& iter);
//- Erase a hashedEntry specified by the given key //- Erase a hashedEntry specified by the given key
bool erase(const Key&); bool erase(const Key& key);
//- Remove entries given by the listed keys from this HashTable //- Remove entries given by the listed keys from this HashTable
// Return the number of elements removed // Return the number of elements removed
label erase(const UList<Key>&); label erase(const UList<Key>& keys);
//- Remove entries given by the given keys from this HashTable //- Remove entries given by the given keys from this HashTable
// Return the number of elements removed. // Return the number of elements removed.
// The parameter HashTable needs the same type of key, but the // The parameter HashTable needs the same type of key, but the
// type of values held and the hashing function are arbitrary. // type of values held and the hashing function are arbitrary.
template<class AnyType, class AnyHash> template<class AnyType, class AnyHash>
label erase(const HashTable<AnyType, Key, AnyHash>&); label erase(const HashTable<AnyType, Key, AnyHash>& rhs);
//- Resize the hash table for efficiency //- Resize the hash table for efficiency
void resize(const label newSize); void resize(const label sz);
//- Clear all entries from table //- Clear all entries from table
void clear(); void clear();
@ -295,7 +292,7 @@ public:
//- Transfer the contents of the argument table into this table //- Transfer the contents of the argument table into this table
// and annul the argument table. // and annul the argument table.
void transfer(HashTable<T, Key, Hash>&); void transfer(HashTable<T, Key, Hash>& ht);
//- Transfer contents to the Xfer container //- Transfer contents to the Xfer container
inline Xfer<HashTable<T, Key, Hash>> xfer(); inline Xfer<HashTable<T, Key, Hash>> xfer();
@ -304,26 +301,26 @@ public:
// Member Operators // Member Operators
//- Find and return a hashedEntry //- Find and return a hashedEntry
inline T& operator[](const Key&); inline T& operator[](const Key& key);
//- Find and return a hashedEntry //- Find and return a hashedEntry
inline const T& operator[](const Key&) const; inline const T& operator[](const Key& key) const;
//- Find and return a hashedEntry, create it null if not present //- Find and return a hashedEntry, create it null if not present
inline T& operator()(const Key&); inline T& operator()(const Key& key);
//- Assignment //- Assignment
void operator=(const HashTable<T, Key, Hash>&); void operator=(const HashTable<T, Key, Hash>& rhs);
//- Assignment to an initializer list //- Assignment to an initializer list
void operator=(std::initializer_list<Tuple2<Key, T>>); void operator=(std::initializer_list<Tuple2<Key, T>> lst);
//- Equality. Hash tables are equal if the keys and values are equal. //- Equality. Hash tables are equal if the keys and values are equal.
// Independent of table storage size and table order. // Independent of table storage size and table order.
bool operator==(const HashTable<T, Key, Hash>&) const; bool operator==(const HashTable<T, Key, Hash>& rhs) const;
//- The opposite of the equality operation. Takes linear time. //- The opposite of the equality operation. Takes linear time.
bool operator!=(const HashTable<T, Key, Hash>&) const; bool operator!=(const HashTable<T, Key, Hash>& rhs) const;
@ -357,7 +354,7 @@ public:
// Private Data // Private Data
//- Pointer to the HashTable for which this is an iterator //- Pointer to the HashTable for which this is an iterator
// This also lets us use the default bitwise copy/assignment // This allows use of the default bitwise copy/assignment
HashTable<T, Key, Hash>* hashTable_; HashTable<T, Key, Hash>* hashTable_;
//- Current element //- Current element
@ -377,13 +374,13 @@ public:
//- Construct from hash table, moving to its 'begin' position //- Construct from hash table, moving to its 'begin' position
inline explicit iteratorBase inline explicit iteratorBase
( (
const HashTable<T, Key, Hash>* curHashTable const HashTable<T, Key, Hash>* hashTbl
); );
//- Construct from hash table, element and hash index //- Construct from hash table, element and hash index
inline iteratorBase inline iteratorBase
( (
const HashTable<T, Key, Hash>* curHashTable, const HashTable<T, Key, Hash>* hashTbl,
const hashedEntry* elmt, const hashedEntry* elmt,
const label hashIndex const label hashIndex
); );
@ -404,7 +401,7 @@ public:
// Member operators // Member operators
// Access // Access
//- Return the Key corresponding to the iterator //- Return the Key corresponding to the iterator
inline const Key& key() const; inline const Key& key() const;
@ -413,8 +410,8 @@ public:
inline const T& cobject() const; inline const T& cobject() const;
//- Compare hashedEntry element pointers //- Compare hashedEntry element pointers
inline bool operator==(const iteratorBase&) const; inline bool operator==(const iteratorBase& iter) const;
inline bool operator!=(const iteratorBase&) const; inline bool operator!=(const iteratorBase& iter) const;
//- Compare hashedEntry to iteratorEnd pointers //- Compare hashedEntry to iteratorEnd pointers
inline bool operator==(const iteratorEnd& unused) const; inline bool operator==(const iteratorEnd& unused) const;
@ -434,13 +431,13 @@ public:
//- Construct from hash table, moving to its 'begin' position //- Construct from hash table, moving to its 'begin' position
inline explicit iterator inline explicit iterator
( (
HashTable<T, Key, Hash>* curHashTable HashTable<T, Key, Hash>* hashTbl
); );
//- Construct from hash table, element and hash index //- Construct from hash table, element and hash index
inline iterator inline iterator
( (
HashTable<T, Key, Hash>* curHashTable, HashTable<T, Key, Hash>* hashTbl,
hashedEntry* elmt, hashedEntry* elmt,
const label hashIndex const label hashIndex
); );
@ -492,13 +489,13 @@ public:
//- Construct from hash table, moving to its 'begin' position //- Construct from hash table, moving to its 'begin' position
inline explicit const_iterator inline explicit const_iterator
( (
const HashTable<T, Key, Hash>* curHashTable const HashTable<T, Key, Hash>* hashTbl
); );
//- Construct from hash table, element and hash index //- Construct from hash table, element and hash index
inline const_iterator inline const_iterator
( (
const HashTable<T, Key, Hash>* curHashTable, const HashTable<T, Key, Hash>* hashTbl,
const hashedEntry* elmt, const hashedEntry* elmt,
const label hashIndex const label hashIndex
); );
@ -512,7 +509,7 @@ public:
inline const_iterator(); inline const_iterator();
//- Construct from iterator //- Construct from iterator
inline const_iterator(const iterator&); inline const_iterator(const iterator& iter);
//- Construct end iterator //- Construct end iterator
inline const_iterator(const iteratorEnd& unused); inline const_iterator(const iteratorEnd& unused);
@ -540,14 +537,14 @@ public:
friend Istream& operator>> <T, Key, Hash> friend Istream& operator>> <T, Key, Hash>
( (
Istream&, Istream& is,
HashTable<T, Key, Hash>& HashTable<T, Key, Hash>& L
); );
friend Ostream& operator<< <T, Key, Hash> friend Ostream& operator<< <T, Key, Hash>
( (
Ostream&, Ostream& os,
const HashTable<T, Key, Hash>& const HashTable<T, Key, Hash>& L
); );
}; };