Commit 42f49505 authored by andy's avatar andy
Browse files

ENH: Added foundObjectRe function

parent 193feb95
......@@ -163,6 +163,10 @@ public:
template<class Type>
HashTable<Type*> lookupClass(const bool strict = false);
//- Return the list of objects whose name matches the input regExp
template<class Type>
wordList foundObjectRe(const wordRe& name) const;
//- Is the named Type found?
template<class Type>
bool foundObject(const word& name) const;
......
......@@ -127,6 +127,31 @@ bool Foam::objectRegistry::foundObject(const word& name) const
}
template<class Type>
Foam::wordList Foam::objectRegistry::foundObjectRe(const wordRe& name) const
{
wordList objectNames(size());
label count = 0;
forAllConstIter(HashTable<regIOobject*>, *this, iter)
{
if (isA<Type>(*iter()))
{
const word& objectName = iter()->name();
if (name.match(objectName))
{
objectNames[count++] = objectName;
}
}
}
objectNames.setSize(count);
return objectNames;
}
template<class Type>
const Type& Foam::objectRegistry::lookupObject(const word& name) 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