Commit a3c6d6ac authored by Mark Olesen's avatar Mark Olesen
Browse files

COMP: incomplete Time class used in objectRegistryTemplates

parent f5f51aeb
......@@ -64,6 +64,11 @@ $(sha1)/SHA1Digest.C
primitives/random/Random/Random.C
primitives/random/cachedRandom/cachedRandom.H
ranges = primitives/ranges
$(ranges)/scalarRange/scalarRange.C
$(ranges)/scalarRange/scalarRanges.C
containers/HashTables/HashTable/HashTableCore.C
containers/HashTables/StaticHashTable/StaticHashTableCore.C
containers/Lists/SortableList/ParSortableListName.C
......@@ -194,9 +199,6 @@ $(Time)/timeSelector.C
$(Time)/instant/instant.C
db/scalarRange/scalarRange.C
db/scalarRange/scalarRanges.C
dimensionSet/dimensionSet.C
dimensionSet/dimensionSetIO.C
dimensionSet/dimensionSets.C
......
......@@ -31,6 +31,14 @@ License
defineTypeNameAndDebug(Foam::objectRegistry, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::objectRegistry::parentNotTime() const
{
return (&parent_ != dynamic_cast<const objectRegistry*>(&time_));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::objectRegistry::objectRegistry
......
......@@ -69,6 +69,10 @@ class objectRegistry
// Private Member Functions
//- Is the objectRegistry parent_ different from time_
// Used to terminate searching within the ancestors
bool parentNotTime() const;
//- Disallow Copy constructor
objectRegistry(const objectRegistry&);
......
......@@ -84,22 +84,13 @@ bool Foam::objectRegistry::foundObject(const word& name) const
{
return true;
}
else
{
return false;
}
}
else
else if (this->parentNotTime())
{
if (&parent_ != dynamic_cast<const objectRegistry*>(&time_))
{
return parent_.foundObject<Type>(name);
}
else
{
return false;
}
return parent_.foundObject<Type>(name);
}
return false;
}
......@@ -117,8 +108,10 @@ const Type& Foam::objectRegistry::lookupObject(const word& name) const
return *vpsiPtr_;
}
FatalErrorIn("objectRegistry::lookupObject<Type>(const word&) const")
<< nl
FatalErrorIn
(
"objectRegistry::lookupObject<Type>(const word&) const"
) << nl
<< " lookup of " << name << " from objectRegistry "
<< this->name()
<< " successful\n but it is not a " << Type::typeName
......@@ -127,23 +120,21 @@ const Type& Foam::objectRegistry::lookupObject(const word& name) const
}
else
{
if (&parent_ != dynamic_cast<const objectRegistry*>(&time_))
if (this->parentNotTime())
{
return parent_.lookupObject<Type>(name);
}
else
{
FatalErrorIn
(
"objectRegistry::lookupObject<Type>(const word&) const"
) << nl
<< " request for " << Type::typeName
<< " " << name << " from objectRegistry " << this->name()
<< " failed\n available objects of type " << Type::typeName
<< " are" << nl
<< names<Type>()
<< abort(FatalError);
}
FatalErrorIn
(
"objectRegistry::lookupObject<Type>(const word&) const"
) << nl
<< " request for " << Type::typeName
<< " " << name << " from objectRegistry " << this->name()
<< " failed\n available objects of type " << Type::typeName
<< " are" << nl
<< names<Type>()
<< abort(FatalError);
}
return *reinterpret_cast< const Type* >(0);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2007-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2007-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2007-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2007-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......
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