mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
DictionaryBase gets transfer() method
This commit is contained in:
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -48,7 +48,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
myList.append(100.3);
|
||||
|
||||
myList.append(500.3);
|
||||
|
||||
Info<< nl << "And again using STL iterator: " << nl << endl;
|
||||
@ -120,7 +119,18 @@ int main(int argc, char *argv[])
|
||||
Info<< "element:" << *iter << endl;
|
||||
}
|
||||
|
||||
Info<< nl << "Bye." << endl;
|
||||
|
||||
Info<< nl << "Testing transfer: " << nl << endl;
|
||||
Info<< "original: " << myList << endl;
|
||||
|
||||
DLList<scalar> newList;
|
||||
newList.transfer(myList);
|
||||
|
||||
Info<< nl << "source: " << myList << nl
|
||||
<< nl << "target: " << newList << endl;
|
||||
|
||||
|
||||
Info<< nl << "Done." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -92,12 +92,11 @@ int main(int argc, char *argv[])
|
||||
Info<< "element : " << *iter;
|
||||
}
|
||||
|
||||
Info<< dict.toc() << endl;
|
||||
Info<< "keys: " << dict.toc() << endl;
|
||||
|
||||
delete dictPtr;
|
||||
|
||||
dictPtr = new Dictionary<ent>;
|
||||
Dictionary<ent>& dict2 = *dictPtr;
|
||||
Dictionary<ent> dict2;
|
||||
|
||||
for (int i = 0; i<10; i++)
|
||||
{
|
||||
@ -106,9 +105,20 @@ int main(int argc, char *argv[])
|
||||
dict2.swapUp(ePtr);
|
||||
}
|
||||
|
||||
Info<< dict2 << endl;
|
||||
Info<< "dict:\n" << dict2 << endl;
|
||||
|
||||
Info<< nl << "Bye." << endl;
|
||||
Info<< nl << "Testing transfer: " << nl << endl;
|
||||
Info<< "original: " << dict2 << endl;
|
||||
|
||||
Dictionary<ent> newDict;
|
||||
newDict.transfer(dict2);
|
||||
|
||||
Info<< nl << "source: " << dict2 << nl
|
||||
<< "keys: " << dict2.toc() << nl
|
||||
<< "target: " << newDict << nl
|
||||
<< "keys: " << newDict.toc() << endl;
|
||||
|
||||
Info<< nl << "Done." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -52,6 +52,13 @@ public:
|
||||
:
|
||||
data_(s)
|
||||
{}
|
||||
|
||||
friend Ostream& operator<<(Ostream& os, const Scalar& s)
|
||||
{
|
||||
os << s.data_;
|
||||
return os;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -68,10 +75,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
myList.append(new Scalar(100.3));
|
||||
|
||||
myList.append(new Scalar(500.3));
|
||||
|
||||
|
||||
Info<< nl << "And again using STL iterator: " << nl << endl;
|
||||
|
||||
for
|
||||
@ -99,6 +104,15 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
Info<< nl << "Testing transfer: " << nl << endl;
|
||||
Info<< "original: " << myList << endl;
|
||||
|
||||
ISLList<Scalar> newList;
|
||||
newList.transfer(myList);
|
||||
|
||||
Info<< nl << "source: " << myList << nl
|
||||
<< nl << "target: " << newList << endl;
|
||||
|
||||
Info<< nl << "Bye." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -48,10 +48,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
myList.append(100.3);
|
||||
|
||||
myList.append(500.3);
|
||||
|
||||
|
||||
Info<< nl << "And again using STL iterator: " << nl << endl;
|
||||
|
||||
for
|
||||
@ -99,7 +97,27 @@ int main(int argc, char *argv[])
|
||||
Info<< "element:" << *iter2 << endl;
|
||||
}
|
||||
|
||||
Info<< nl << "Bye." << endl;
|
||||
|
||||
|
||||
for (int i = 0; i<10; i++)
|
||||
{
|
||||
myList.append(1.3*i);
|
||||
}
|
||||
|
||||
myList.append(100.3);
|
||||
myList.append(500.3);
|
||||
|
||||
Info<< nl << "Testing transfer: " << nl << endl;
|
||||
Info<< "original: " << myList << endl;
|
||||
|
||||
SLList<scalar> newList;
|
||||
newList.transfer(myList);
|
||||
|
||||
Info<< nl << "source: " << myList << nl
|
||||
<< nl << "target: " << newList << endl;
|
||||
|
||||
|
||||
Info<< nl << "Done." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -113,7 +113,20 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< dict2 << endl;
|
||||
|
||||
Info<< nl << "Bye." << endl;
|
||||
|
||||
Info<< nl << "Testing transfer: " << nl << endl;
|
||||
Info<< "original: " << dict2 << endl;
|
||||
|
||||
UDictionary<ent> newDict;
|
||||
newDict.transfer(dict2);
|
||||
|
||||
Info<< nl << "source: " << dict2 << nl
|
||||
<< "keys: " << dict2.toc() << nl
|
||||
<< "target: " << newDict << nl
|
||||
<< "keys: " << newDict.toc() << endl;
|
||||
|
||||
Info<< nl << "Done." << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -237,6 +237,17 @@ void Foam::DictionaryBase<IDLListType, T>::clear()
|
||||
}
|
||||
|
||||
|
||||
template<class IDLListType, class T>
|
||||
void Foam::DictionaryBase<IDLListType, T>::transfer
|
||||
(
|
||||
DictionaryBase<IDLListType, T>& dict
|
||||
)
|
||||
{
|
||||
IDLListType::transfer(dict);
|
||||
hashedTs_.transfer(dict.hashedTs_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class IDLListType, class T>
|
||||
|
||||
@ -143,6 +143,9 @@ public:
|
||||
//- Clear the dictionary
|
||||
void clear();
|
||||
|
||||
//- Transfer the contents of the argument into this DictionaryBase
|
||||
// and annull the argument.
|
||||
void transfer(DictionaryBase<IDLListType, T>&);
|
||||
|
||||
// Member operators
|
||||
|
||||
|
||||
Reference in New Issue
Block a user