本文整理汇总了C++中TNode::Write_AllTNodes方法的典型用法代码示例。如果您正苦于以下问题:C++ TNode::Write_AllTNodes方法的具体用法?C++ TNode::Write_AllTNodes怎么用?C++ TNode::Write_AllTNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TNode
的用法示例。
在下文中一共展示了TNode::Write_AllTNodes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readLeftNode
ostream & TNode<Whatever> ::
Write_AllTNodes (ostream & stream, fstream * fio) const {
if (left) {
TNode<Whatever> readLeftNode (left, fio);
readLeftNode.Write_AllTNodes (stream, fio);
}
stream << *this;
if (right) {
TNode<Whatever> readRightNode (right, fio);
readRightNode.Write_AllTNodes (stream, fio);
}
return stream;
}
示例2: Write
ostream & Tree<Whatever> :: Write (ostream & stream) const
/***************************************************************************
% Routine Name : Tree :: Write (public)
% File : Tree.c
%
% Description : This funtion will output the contents of the Tree table
% to the stream specificed by the caller. The stream could be
% cerr, cout, or any other valid stream.
%
% Parameters descriptions :
%
% name description
% ------------------ ------------------------------------------------------
% stream A reference to the output stream.
% <return> A reference to the output stream.
***************************************************************************/
{
long old_cost = cost;
stream << "Tree " << tree_count << ":\n"
<< "occupancy is " << occupancy << " elements.\n";
fio->seekg (0, ios :: end);
offset end = fio->tellg ();
// check for new file
if (root != end) {
TNode<Whatever> readRootNode (root, fio);
readRootNode.Write_AllTNodes (stream, fio);
}
// ignore cost when displaying nodes to users
cost = old_cost;
return stream;
}