ENH: codeStream: added codeLibs

This commit is contained in:
mattijs
2011-03-21 17:54:20 +00:00
parent c81dd4ee08
commit cf99e5c800
11 changed files with 122 additions and 48 deletions

View File

@ -31,8 +31,6 @@ License
#include "OFstream.H"
#include "OSspecific.H"
#include "dictionary.H"
#include "dlLibraryTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -557,22 +555,4 @@ bool Foam::dynamicCode::upToDate(const dynamicCodeContext& context) const
}
// bool Foam::dynamicCode::openLibrary() const
// {
// return dlLibraryTable::openLibrary(this->libPath(), false);
// }
//
//
// bool Foam::dynamicCode::closeLibrary() const
// {
// return dlLibraryTable::closeLibrary(this->libPath(), false);
// }
//
//
// void* Foam::dynamicCode::findLibrary() const
// {
// return dlLibraryTable::findLibrary(this->libPath());
// }
// ************************************************************************* //

View File

@ -37,10 +37,8 @@ SourceFiles
#define dynamicCode_H
#include "Tuple2.H"
#include "SHA1Digest.H"
#include "HashTable.H"
#include "DynamicList.H"
#include "dlLibraryTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,6 +49,7 @@ namespace Foam
class dynamicCodeContext;
class ISstream;
class OSstream;
class SHA1Digest;
/*---------------------------------------------------------------------------*\
Class dynamicCode Declaration
@ -283,16 +282,6 @@ public:
//- Compile a libso
bool wmakeLibso() const;
// //- Open the libPath() library
// bool openLibrary() const;
//
// //- Close the libPath() library
// bool closeLibrary() const;
//
// //- Find the handle of the libPath() library
// void* findLibrary() const;
};

View File

@ -37,7 +37,8 @@ Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict)
code_(stringOps::trim(dict["code"])),
localCode_(),
include_(),
options_()
options_(),
libs_()
{
// expand dictionary entries
stringOps::inplaceExpand(code_, dict);
@ -67,9 +68,16 @@ Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict)
stringOps::inplaceExpand(options_, dict);
}
// optional
if (dict.found("codeLibs"))
{
libs_ = stringOps::trim(dict["codeLibs"]);
stringOps::inplaceExpand(libs_, dict);
}
// calculate SHA1 digest from include, options, localCode, code
OSHA1stream os;
os << include_ << options_ << localCode_ << code_;
os << include_ << options_ << libs_ << localCode_ << code_;
sha1_ = os.digest();
}

View File

@ -66,6 +66,9 @@ class dynamicCodeContext
//- Optional "codeOptions" entry
string options_;
//- Optional "codeLib" entry
string libs_;
//- Calculated SHA1Digest
SHA1Digest sha1_;
@ -96,6 +99,12 @@ public:
return options_;
}
//- Return the code-libs
const string& libs() const
{
return libs_;
}
//- Return the code
const string& code() const
{