22 #include "ns3/abort.h"
46 : m_outputFileName(outputFileName),
48 m_hasHeadingBeenSet(false),
51 m_3dFormat(
"%e %e %e"),
52 m_4dFormat(
"%e %e %e %e"),
53 m_5dFormat(
"%e %e %e %e %e"),
54 m_6dFormat(
"%e %e %e %e %e %e"),
55 m_7dFormat(
"%e %e %e %e %e %e %e"),
56 m_8dFormat(
"%e %e %e %e %e %e %e %e"),
57 m_9dFormat(
"%e %e %e %e %e %e %e %e %e"),
58 m_10dFormat(
"%e %e %e %e %e %e %e %e %e %e")
190 int maxBufferSize = 500;
194 int charWritten = snprintf(buffer, maxBufferSize,
m_1dFormat.c_str(), v1);
201 m_file << buffer << std::endl;
206 m_file << v1 << std::endl;
224 int maxBufferSize = 500;
228 int charWritten = snprintf(buffer, maxBufferSize,
m_2dFormat.c_str(), v1, v2);
235 m_file << buffer << std::endl;
258 int maxBufferSize = 500;
262 int charWritten = snprintf(buffer, maxBufferSize,
m_3dFormat.c_str(), v1, v2, v3);
269 m_file << buffer << std::endl;
292 int maxBufferSize = 500;
296 int charWritten = snprintf(buffer, maxBufferSize,
m_4dFormat.c_str(), v1, v2, v3, v4);
303 m_file << buffer << std::endl;
327 int maxBufferSize = 500;
332 snprintf(buffer, maxBufferSize,
m_5dFormat.c_str(), v1, v2, v3, v4, v5);
339 m_file << buffer << std::endl;
369 int maxBufferSize = 500;
374 snprintf(buffer, maxBufferSize,
m_6dFormat.c_str(), v1, v2, v3, v4, v5, v6);
381 m_file << buffer << std::endl;
402 NS_LOG_FUNCTION(
this << context << v1 << v2 << v3 << v4 << v5 << v6 << v7);
412 int maxBufferSize = 500;
417 snprintf(buffer, maxBufferSize,
m_7dFormat.c_str(), v1, v2, v3, v4, v5, v6, v7);
424 m_file << buffer << std::endl;
446 NS_LOG_FUNCTION(
this << context << v1 << v2 << v3 << v4 << v5 << v6 << v7 << v8);
456 int maxBufferSize = 500;
461 snprintf(buffer, maxBufferSize,
m_8dFormat.c_str(), v1, v2, v3, v4, v5, v6, v7, v8);
468 m_file << buffer << std::endl;
492 NS_LOG_FUNCTION(
this << context << v1 << v2 << v3 << v4 << v5 << v6 << v7 << v8 << v9);
501 int maxBufferSize = 500;
505 int charWritten = snprintf(buffer,
523 m_file << buffer << std::endl;
548 NS_LOG_FUNCTION(
this << context << v1 << v2 << v3 << v4 << v5 << v6 << v7 << v8 << v9 << v10);
557 int maxBufferSize = 500;
561 int charWritten = snprintf(buffer,
580 m_file << buffer << std::endl;
Base class for data collection framework objects.
bool m_enabled
Object's activation state.
~FileAggregator() override
void Set4dFormat(const std::string &format)
Sets the 4D format string for the C-style sprintf() function.
void Write7d(std::string context, double v1, double v2, double v3, double v4, double v5, double v6, double v7)
Writes 7 values to the file.
void Write3d(std::string context, double v1, double v2, double v3)
Writes 3 values to the file.
std::string m_separator
Printed between values in the file.
void Set6dFormat(const std::string &format)
Sets the 6D format string for the C-style sprintf() function.
std::string m_5dFormat
Format string for 5D C-style sprintf() function.
FileType m_fileType
Determines the kind of file written by the aggregator.
std::string m_4dFormat
Format string for 4D C-style sprintf() function.
void Set8dFormat(const std::string &format)
Sets the 8D format string for the C-style sprintf() function.
void Write1d(std::string context, double v1)
Writes 1 value to the file.
void Set7dFormat(const std::string &format)
Sets the 7D format string for the C-style sprintf() function.
void Write9d(std::string context, double v1, double v2, double v3, double v4, double v5, double v6, double v7, double v8, double v9)
Writes 9 values to the file.
void Write4d(std::string context, double v1, double v2, double v3, double v4)
Writes 4 values to the file.
void Set2dFormat(const std::string &format)
Sets the 2D format string for the C-style sprintf() function.
void SetFileType(FileType fileType)
Set the file type to create, which determines the separator to use when printing values to the file.
void Set9dFormat(const std::string &format)
Sets the 9D format string for the C-style sprintf() function.
std::string m_10dFormat
Format string for 10D C-style sprintf() function.
std::ofstream m_file
Used to write values to the file.
void Write2d(std::string context, double v1, double v2)
Writes 2 values to the file.
std::string m_9dFormat
Format string for 9D C-style sprintf() function.
void Write5d(std::string context, double v1, double v2, double v3, double v4, double v5)
Writes 5 values to the file.
void Set3dFormat(const std::string &format)
Sets the 3D format string for the C-style sprintf() function.
void Set1dFormat(const std::string &format)
Sets the 1D format string for the C-style sprintf() function.
bool m_hasHeadingBeenSet
Indicates if the heading line for the file has been set.
std::string m_7dFormat
Format string for 7D C-style sprintf() function.
std::string m_heading
Heading line for the outputfile.
void Set10dFormat(const std::string &format)
Sets the 10D format string for the C-style sprintf() function.
FileAggregator(const std::string &outputFileName, FileType fileType=SPACE_SEPARATED)
void Write6d(std::string context, double v1, double v2, double v3, double v4, double v5, double v6)
Writes 6 values to the file.
void Set5dFormat(const std::string &format)
Sets the 5D format string for the C-style sprintf() function.
std::string m_3dFormat
Format string for 3D C-style sprintf() function.
void SetHeading(const std::string &heading)
Sets the heading string that will be printed on the first line of the file.
std::string m_1dFormat
Format string for 1D C-style sprintf() function.
std::string m_outputFileName
The file name.
std::string m_6dFormat
Format string for 6D C-style sprintf() function.
std::string m_8dFormat
Format string for 8D C-style sprintf() function.
void Write8d(std::string context, double v1, double v2, double v3, double v4, double v5, double v6, double v7, double v8)
Writes 8 values to the file.
FileType
The type of file written by the aggregator.
std::string m_2dFormat
Format string for 2D C-style sprintf() function.
void Write10d(std::string context, double v1, double v2, double v3, double v4, double v5, double v6, double v7, double v8, double v9, double v10)
Writes 10 values to the file.
static TypeId GetTypeId()
Get the type ID.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.