A Discrete-Event Network Simulator
API
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
ns3::FileAggregator Class Reference

This aggregator sends values it receives to a file. More...

#include "file-aggregator.h"

+ Inheritance diagram for ns3::FileAggregator:

Public Types

enum  FileType { FORMATTED, SPACE_SEPARATED, COMMA_SEPARATED, TAB_SEPARATED }
 The type of file written by the aggregator. More...
 

Public Member Functions

 FileAggregator (const std::string &outputFileName, enum FileType fileType=SPACE_SEPARATED)
 
virtual ~FileAggregator ()
 
void Set10dFormat (const std::string &format)
 Sets the 10D format string for the C-style sprintf() function. More...
 
void Set1dFormat (const std::string &format)
 Sets the 1D format string for the C-style sprintf() function. More...
 
void Set2dFormat (const std::string &format)
 Sets the 2D format string for the C-style sprintf() function. More...
 
void Set3dFormat (const std::string &format)
 Sets the 3D format string for the C-style sprintf() function. More...
 
void Set4dFormat (const std::string &format)
 Sets the 4D format string for the C-style sprintf() function. More...
 
void Set5dFormat (const std::string &format)
 Sets the 5D format string for the C-style sprintf() function. More...
 
void Set6dFormat (const std::string &format)
 Sets the 6D format string for the C-style sprintf() function. More...
 
void Set7dFormat (const std::string &format)
 Sets the 7D format string for the C-style sprintf() function. More...
 
void Set8dFormat (const std::string &format)
 Sets the 8D format string for the C-style sprintf() function. More...
 
void Set9dFormat (const std::string &format)
 Sets the 9D format string for the C-style sprintf() function. More...
 
void SetFileType (enum FileType fileType)
 Set the file type to create, which determines the separator to use when printing values to the file. More...
 
void SetHeading (const std::string &heading)
 Sets the heading string that will be printed on the first line of the file. More...
 
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. More...
 
void Write1d (std::string context, double v1)
 Writes 1 value to the file. More...
 
void Write2d (std::string context, double v1, double v2)
 Writes 2 values to the file. More...
 
void Write3d (std::string context, double v1, double v2, double v3)
 Writes 3 values to the file. More...
 
void Write4d (std::string context, double v1, double v2, double v3, double v4)
 Writes 4 values to the file. More...
 
void Write5d (std::string context, double v1, double v2, double v3, double v4, double v5)
 Writes 5 values to the file. More...
 
void Write6d (std::string context, double v1, double v2, double v3, double v4, double v5, double v6)
 Writes 6 values to the file. More...
 
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. More...
 
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. More...
 
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. More...
 
- Public Member Functions inherited from ns3::DataCollectionObject
 DataCollectionObject ()
 
virtual ~DataCollectionObject ()
 
void Disable (void)
 Unset the status of an individual object. More...
 
void Enable (void)
 Set the status of an individual object. More...
 
std::string GetName (void) const
 Get the object's name. More...
 
virtual bool IsEnabled (void) const
 Check the status of an individual object. More...
 
void SetName (std::string name)
 Set the object's name. All spaces are replaced by underscores. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::DataCollectionObject
static TypeId GetTypeId ()
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Private Attributes

std::string m_10dFormat
 Format string for 10D C-style sprintf() function. More...
 
std::string m_1dFormat
 Format string for 1D C-style sprintf() function. More...
 
std::string m_2dFormat
 Format string for 2D C-style sprintf() function. More...
 
std::string m_3dFormat
 Format string for 3D C-style sprintf() function. More...
 
std::string m_4dFormat
 Format string for 4D C-style sprintf() function. More...
 
std::string m_5dFormat
 Format string for 5D C-style sprintf() function. More...
 
std::string m_6dFormat
 Format string for 6D C-style sprintf() function. More...
 
std::string m_7dFormat
 Format string for 7D C-style sprintf() function. More...
 
std::string m_8dFormat
 Format string for 8D C-style sprintf() function. More...
 
std::string m_9dFormat
 Format string for 9D C-style sprintf() function. More...
 
std::ofstream m_file
 Used to write values to the file. More...
 
enum FileType m_fileType
 Determines the kind of file written by the aggregator. More...
 
bool m_hasHeadingBeenSet
 Indicates if the heading line for the file has been set. More...
 
std::string m_heading
 Heading line for the outputfile. More...
 
std::string m_outputFileName
 The file name. More...
 
std::string m_separator
 Printed between values in the file. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoDispose (void)
 Destructor implementation. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 
- Protected Attributes inherited from ns3::DataCollectionObject
bool m_enabled
 Object's activation state. More...
 
std::string m_name
 Name of the object within the data collection framework. More...
 

Detailed Description

This aggregator sends values it receives to a file.


Introspection did not find any typical Config paths.


No Attributes are defined for this type.

Attributes defined in parent class ns3::DataCollectionObject

No TraceSources are defined for this type.
Size of this type is 952 bytes (on a 64-bit architecture).

Definition at line 39 of file file-aggregator.h.

Member Enumeration Documentation

◆ FileType

The type of file written by the aggregator.

Enumerator
FORMATTED 
SPACE_SEPARATED 
COMMA_SEPARATED 
TAB_SEPARATED 

Definition at line 43 of file file-aggregator.h.

Constructor & Destructor Documentation

◆ FileAggregator()

ns3::FileAggregator::FileAggregator ( const std::string &  outputFileName,
enum FileType  fileType = SPACE_SEPARATED 
)
Parameters
outputFileNamename of the file to write.
fileTypetype of file to write.

Constructs a file aggregator that will create a file named outputFileName with values printed as specified by fileType. The default file type is space-separated.

Definition at line 46 of file file-aggregator.cc.

References COMMA_SEPARATED, m_file, m_fileType, m_outputFileName, m_separator, NS_LOG_FUNCTION, and TAB_SEPARATED.

◆ ~FileAggregator()

ns3::FileAggregator::~FileAggregator ( )
virtual

Definition at line 82 of file file-aggregator.cc.

References m_file, and NS_LOG_FUNCTION.

Member Function Documentation

◆ GetTypeId()

TypeId ns3::FileAggregator::GetTypeId ( void  )
static

Get the type ID.

Returns
the object TypeId

Definition at line 36 of file file-aggregator.cc.

References ns3::TypeId::SetParent().

◆ Set10dFormat()

void ns3::FileAggregator::Set10dFormat ( const std::string &  format)

Sets the 10D format string for the C-style sprintf() function.

Parameters
formatthe 10D format string.

Definition at line 173 of file file-aggregator.cc.

References m_10dFormat, and NS_LOG_FUNCTION.

◆ Set1dFormat()

void ns3::FileAggregator::Set1dFormat ( const std::string &  format)

Sets the 1D format string for the C-style sprintf() function.

Parameters
formatthe 1D format string.

Definition at line 110 of file file-aggregator.cc.

References m_1dFormat, and NS_LOG_FUNCTION.

◆ Set2dFormat()

void ns3::FileAggregator::Set2dFormat ( const std::string &  format)

Sets the 2D format string for the C-style sprintf() function.

Parameters
formatthe 2D format string.

Definition at line 117 of file file-aggregator.cc.

References m_2dFormat, and NS_LOG_FUNCTION.

Referenced by anonymous_namespace{file-aggregator-example.cc}::CreateFormattedFile().

◆ Set3dFormat()

void ns3::FileAggregator::Set3dFormat ( const std::string &  format)

Sets the 3D format string for the C-style sprintf() function.

Parameters
formatthe 3D format string.

Definition at line 124 of file file-aggregator.cc.

References m_3dFormat, and NS_LOG_FUNCTION.

◆ Set4dFormat()

void ns3::FileAggregator::Set4dFormat ( const std::string &  format)

Sets the 4D format string for the C-style sprintf() function.

Parameters
formatthe 4D format string.

Definition at line 131 of file file-aggregator.cc.

References m_4dFormat, and NS_LOG_FUNCTION.

◆ Set5dFormat()

void ns3::FileAggregator::Set5dFormat ( const std::string &  format)

Sets the 5D format string for the C-style sprintf() function.

Parameters
formatthe 5D format string.

Definition at line 138 of file file-aggregator.cc.

References m_5dFormat, and NS_LOG_FUNCTION.

◆ Set6dFormat()

void ns3::FileAggregator::Set6dFormat ( const std::string &  format)

Sets the 6D format string for the C-style sprintf() function.

Parameters
formatthe 6D format string.

Definition at line 145 of file file-aggregator.cc.

References m_6dFormat, and NS_LOG_FUNCTION.

◆ Set7dFormat()

void ns3::FileAggregator::Set7dFormat ( const std::string &  format)

Sets the 7D format string for the C-style sprintf() function.

Parameters
formatthe 7D format string.

Definition at line 152 of file file-aggregator.cc.

References m_7dFormat, and NS_LOG_FUNCTION.

◆ Set8dFormat()

void ns3::FileAggregator::Set8dFormat ( const std::string &  format)

Sets the 8D format string for the C-style sprintf() function.

Parameters
formatthe 8D format string.

Definition at line 159 of file file-aggregator.cc.

References m_8dFormat, and NS_LOG_FUNCTION.

◆ Set9dFormat()

void ns3::FileAggregator::Set9dFormat ( const std::string &  format)

Sets the 9D format string for the C-style sprintf() function.

Parameters
formatthe 9D format string.

Definition at line 166 of file file-aggregator.cc.

References m_9dFormat, and NS_LOG_FUNCTION.

◆ SetFileType()

void ns3::FileAggregator::SetFileType ( enum FileType  fileType)

Set the file type to create, which determines the separator to use when printing values to the file.

Parameters
fileTypefile type specifies the separator to use in printing the file.

Definition at line 89 of file file-aggregator.cc.

References m_fileType, and NS_LOG_FUNCTION.

◆ SetHeading()

void ns3::FileAggregator::SetHeading ( const std::string &  heading)

Sets the heading string that will be printed on the first line of the file.

Parameters
headingthe heading string.

Note that the heading string will only be printed if it has been set by calling this function.

Definition at line 96 of file file-aggregator.cc.

References m_file, m_hasHeadingBeenSet, m_heading, and NS_LOG_FUNCTION.

◆ Write10d()

void ns3::FileAggregator::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.

Parameters
contextspecifies the 10D dataset these values came from.
v1first value for the new data point.
v2second value for the new data point.
v3third value for the new data point.
v4fourth value for the new data point.
v5fifth value for the new data point.
v6sixth value for the new data point.
v7seventh value for the new data point.
v8eighth value for the new data point.
v9ninth value for the new data point.
v10tenth value for the new data point.

Definition at line 629 of file file-aggregator.cc.

References FORMATTED, m_10dFormat, ns3::DataCollectionObject::m_enabled, m_file, m_fileType, m_separator, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

◆ Write1d()

void ns3::FileAggregator::Write1d ( std::string  context,
double  v1 
)

Writes 1 value to the file.

Parameters
contextspecifies the 1D dataset these values came from.
v1value for the new data point.

Definition at line 180 of file file-aggregator.cc.

References FORMATTED, m_1dFormat, ns3::DataCollectionObject::m_enabled, m_file, m_fileType, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

◆ Write2d()

void ns3::FileAggregator::Write2d ( std::string  context,
double  v1,
double  v2 
)

◆ Write3d()

void ns3::FileAggregator::Write3d ( std::string  context,
double  v1,
double  v2,
double  v3 
)

Writes 3 values to the file.

Parameters
contextspecifies the 3D dataset these values came from.
v1first value for the new data point.
v2second value for the new data point.
v3third value for the new data point.

Definition at line 259 of file file-aggregator.cc.

References FORMATTED, m_3dFormat, ns3::DataCollectionObject::m_enabled, m_file, m_fileType, m_separator, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

◆ Write4d()

void ns3::FileAggregator::Write4d ( std::string  context,
double  v1,
double  v2,
double  v3,
double  v4 
)

Writes 4 values to the file.

Parameters
contextspecifies the 4D dataset these values came from.
v1first value for the new data point.
v2second value for the new data point.
v3third value for the new data point.
v4fourth value for the new data point.

Definition at line 303 of file file-aggregator.cc.

References FORMATTED, m_4dFormat, ns3::DataCollectionObject::m_enabled, m_file, m_fileType, m_separator, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

◆ Write5d()

void ns3::FileAggregator::Write5d ( std::string  context,
double  v1,
double  v2,
double  v3,
double  v4,
double  v5 
)

Writes 5 values to the file.

Parameters
contextspecifies the 5D dataset these values came from.
v1first value for the new data point.
v2second value for the new data point.
v3third value for the new data point.
v4fourth value for the new data point.
v5fifth value for the new data point.

Definition at line 350 of file file-aggregator.cc.

References FORMATTED, m_5dFormat, ns3::DataCollectionObject::m_enabled, m_file, m_fileType, m_separator, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

◆ Write6d()

void ns3::FileAggregator::Write6d ( std::string  context,
double  v1,
double  v2,
double  v3,
double  v4,
double  v5,
double  v6 
)

Writes 6 values to the file.

Parameters
contextspecifies the 6D dataset these values came from.
v1first value for the new data point.
v2second value for the new data point.
v3third value for the new data point.
v4fourth value for the new data point.
v5fifth value for the new data point.
v6sixth value for the new data point.

Definition at line 400 of file file-aggregator.cc.

References FORMATTED, m_6dFormat, ns3::DataCollectionObject::m_enabled, m_file, m_fileType, m_separator, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

◆ Write7d()

void ns3::FileAggregator::Write7d ( std::string  context,
double  v1,
double  v2,
double  v3,
double  v4,
double  v5,
double  v6,
double  v7 
)

Writes 7 values to the file.

Parameters
contextspecifies the 7D dataset these values came from.
v1first value for the new data point.
v2second value for the new data point.
v3third value for the new data point.
v4fourth value for the new data point.
v5fifth value for the new data point.
v6sixth value for the new data point.
v7seventh value for the new data point.

Definition at line 453 of file file-aggregator.cc.

References FORMATTED, m_7dFormat, ns3::DataCollectionObject::m_enabled, m_file, m_fileType, m_separator, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

◆ Write8d()

void ns3::FileAggregator::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.

Parameters
contextspecifies the 8D dataset these values came from.
v1first value for the new data point.
v2second value for the new data point.
v3third value for the new data point.
v4fourth value for the new data point.
v5fifth value for the new data point.
v6sixth value for the new data point.
v7seventh value for the new data point.
v8eighth value for the new data point.

Definition at line 509 of file file-aggregator.cc.

References FORMATTED, m_8dFormat, ns3::DataCollectionObject::m_enabled, m_file, m_fileType, m_separator, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

◆ Write9d()

void ns3::FileAggregator::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.

Parameters
contextspecifies the 9D dataset these values came from.
v1first value for the new data point.
v2second value for the new data point.
v3third value for the new data point.
v4fourth value for the new data point.
v5fifth value for the new data point.
v6sixth value for the new data point.
v7seventh value for the new data point.
v8eighth value for the new data point.
v9ninth value for the new data point.

Definition at line 568 of file file-aggregator.cc.

References FORMATTED, m_9dFormat, ns3::DataCollectionObject::m_enabled, m_file, m_fileType, m_separator, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Member Data Documentation

◆ m_10dFormat

std::string ns3::FileAggregator::m_10dFormat
private

Format string for 10D C-style sprintf() function.

Definition at line 382 of file file-aggregator.h.

Referenced by Set10dFormat(), and Write10d().

◆ m_1dFormat

std::string ns3::FileAggregator::m_1dFormat
private

Format string for 1D C-style sprintf() function.

Definition at line 373 of file file-aggregator.h.

Referenced by Set1dFormat(), and Write1d().

◆ m_2dFormat

std::string ns3::FileAggregator::m_2dFormat
private

Format string for 2D C-style sprintf() function.

Definition at line 374 of file file-aggregator.h.

Referenced by Set2dFormat(), and Write2d().

◆ m_3dFormat

std::string ns3::FileAggregator::m_3dFormat
private

Format string for 3D C-style sprintf() function.

Definition at line 375 of file file-aggregator.h.

Referenced by Set3dFormat(), and Write3d().

◆ m_4dFormat

std::string ns3::FileAggregator::m_4dFormat
private

Format string for 4D C-style sprintf() function.

Definition at line 376 of file file-aggregator.h.

Referenced by Set4dFormat(), and Write4d().

◆ m_5dFormat

std::string ns3::FileAggregator::m_5dFormat
private

Format string for 5D C-style sprintf() function.

Definition at line 377 of file file-aggregator.h.

Referenced by Set5dFormat(), and Write5d().

◆ m_6dFormat

std::string ns3::FileAggregator::m_6dFormat
private

Format string for 6D C-style sprintf() function.

Definition at line 378 of file file-aggregator.h.

Referenced by Set6dFormat(), and Write6d().

◆ m_7dFormat

std::string ns3::FileAggregator::m_7dFormat
private

Format string for 7D C-style sprintf() function.

Definition at line 379 of file file-aggregator.h.

Referenced by Set7dFormat(), and Write7d().

◆ m_8dFormat

std::string ns3::FileAggregator::m_8dFormat
private

Format string for 8D C-style sprintf() function.

Definition at line 380 of file file-aggregator.h.

Referenced by Set8dFormat(), and Write8d().

◆ m_9dFormat

std::string ns3::FileAggregator::m_9dFormat
private

Format string for 9D C-style sprintf() function.

Definition at line 381 of file file-aggregator.h.

Referenced by Set9dFormat(), and Write9d().

◆ m_file

std::ofstream ns3::FileAggregator::m_file
private

Used to write values to the file.

Definition at line 359 of file file-aggregator.h.

Referenced by FileAggregator(), SetHeading(), Write10d(), Write1d(), Write2d(), Write3d(), Write4d(), Write5d(), Write6d(), Write7d(), Write8d(), Write9d(), and ~FileAggregator().

◆ m_fileType

enum FileType ns3::FileAggregator::m_fileType
private

Determines the kind of file written by the aggregator.

Definition at line 362 of file file-aggregator.h.

Referenced by FileAggregator(), SetFileType(), Write10d(), Write1d(), Write2d(), Write3d(), Write4d(), Write5d(), Write6d(), Write7d(), Write8d(), and Write9d().

◆ m_hasHeadingBeenSet

bool ns3::FileAggregator::m_hasHeadingBeenSet
private

Indicates if the heading line for the file has been set.

Definition at line 368 of file file-aggregator.h.

Referenced by SetHeading().

◆ m_heading

std::string ns3::FileAggregator::m_heading
private

Heading line for the outputfile.

Definition at line 371 of file file-aggregator.h.

Referenced by SetHeading().

◆ m_outputFileName

std::string ns3::FileAggregator::m_outputFileName
private

The file name.

Definition at line 356 of file file-aggregator.h.

Referenced by FileAggregator().

◆ m_separator

std::string ns3::FileAggregator::m_separator
private

Printed between values in the file.

Definition at line 365 of file file-aggregator.h.

Referenced by FileAggregator(), Write10d(), Write2d(), Write3d(), Write4d(), Write5d(), Write6d(), Write7d(), Write8d(), and Write9d().


The documentation for this class was generated from the following files: