当前位置: 首页>>代码示例>>C++>>正文


C++ FileHelper::Set2dFormat方法代码示例

本文整理汇总了C++中FileHelper::Set2dFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ FileHelper::Set2dFormat方法的具体用法?C++ FileHelper::Set2dFormat怎么用?C++ FileHelper::Set2dFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileHelper的用法示例。


在下文中一共展示了FileHelper::Set2dFormat方法的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;
}
开发者ID:shuiziliuBUPT,项目名称:HelloWorld,代码行数:55,代码来源:file-helper-example.cpp


注:本文中的FileHelper::Set2dFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。