CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   IOdictionary (https://www.cfd-online.com/Forums/openfoam-programming-development/237375-iodictionary.html)

ecles July 14, 2021 15:18

IOdictionary
 
Dear all,

Supposing I want to construct an object belonging to the IOdictionary class by calling this constructor:

IOdictionary(const IOobject&);

This routine constructs the baseIOdictionary through the object io:


Foam::baseIOdictionary::baseIOdictionary(const IOobject& io)
:
regIOobject(io)
{
dictionary::name() = IOobject:: objectPath();
}


Well, but I do not understand how dictionary has been instantiated. When was it constructed?

I first thought baseIOdictionary would call a dictionary constructor when it's being instantiated. Can anyone give me a help?

deepsterblue July 15, 2021 16:36

Pretty simple. IOdictionary derives from both dictionary (which has a null constructor) and regIOobject (which cannot be null-constructed). The initializer list forwards "io" to the regIOobject, and dictionary is simply null-constructed.

P.S: Which version of OpenFOAM is this? I don't see a "baseIOdictionary" anywhere.


All times are GMT -4. The time now is 17:05.