本文整理汇总了C++中FileHelper::ConfigureFile方法的典型用法代码示例。如果您正苦于以下问题:C++ FileHelper::ConfigureFile方法的具体用法?C++ FileHelper::ConfigureFile怎么用?C++ FileHelper::ConfigureFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHelper
的用法示例。
在下文中一共展示了FileHelper::ConfigureFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc, char *argv[])
{
CommandLine cmd;
cmd.Parse (argc, argv);
//
// This Emitter has a trace source object that will emit values at
// random times.
//
Ptr<Emitter> emitter = CreateObject<Emitter> ();
Names::Add ("/Names/Emitter", emitter);
//
// This Probe will be hooked to the Emitter's trace source object by
// accessing it by path name in the Config database.
//
Ptr<DoubleProbe> probe = CreateObject<DoubleProbe> ();
probe->SetName ("PathProbe");
Names::Add ("/Names/Probe", probe);
// Note, no return value is checked here.
probe->ConnectByPath ("/Names/Emitter/Counter");
//
// This file helper will be used to put data values into a file.
//
// Create the file helper.
FileHelper fileHelper;
// Configure the file to be written.
fileHelper.ConfigureFile ("file-helper-example",
FileAggregator::FORMATTED);
// Set the labels for this formatted output file.
fileHelper.Set2dFormat ("Time (Seconds) = %.3e\tCount = %.0f");
// Write the values generated by the probe. The path that we
// provide helps to disambiguate the source of the trace.
fileHelper.WriteProbe ("ns3::DoubleProbe",
"/Names/Probe/Output",
"Output");
// The Emitter object is not associated with an ns-3 node, so
// it won't get started automatically, so we need to do this ourselves
Simulator::Schedule (Seconds (0.0), &Emitter::Initialize, emitter);
Simulator::Stop (Seconds (100.0));
Simulator::Run ();
Simulator::Destroy ();
return 0;
}