This aggregator sends values it receives to a file. More...
#include "file-aggregator.h"
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, FileType fileType=SPACE_SEPARATED) | |
~FileAggregator () override | |
void | Set10dFormat (const std::string &format) |
Sets the 10D 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. | |
void | Set2dFormat (const std::string &format) |
Sets the 2D format string for the C-style sprintf() function. | |
void | Set3dFormat (const std::string &format) |
Sets the 3D format string for the C-style sprintf() function. | |
void | Set4dFormat (const std::string &format) |
Sets the 4D format string for the C-style sprintf() function. | |
void | Set5dFormat (const std::string &format) |
Sets the 5D format string for the C-style sprintf() function. | |
void | Set6dFormat (const std::string &format) |
Sets the 6D format string for the C-style sprintf() function. | |
void | Set7dFormat (const std::string &format) |
Sets the 7D format string for the C-style sprintf() function. | |
void | Set8dFormat (const std::string &format) |
Sets the 8D format string for the C-style sprintf() function. | |
void | Set9dFormat (const std::string &format) |
Sets the 9D 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 | SetHeading (const std::string &heading) |
Sets the heading string that will be printed on the first line of the file. | |
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. | |
void | Write1d (std::string context, double v1) |
Writes 1 value to the file. | |
void | Write2d (std::string context, double v1, double v2) |
Writes 2 values to the file. | |
void | Write3d (std::string context, double v1, double v2, double v3) |
Writes 3 values to the file. | |
void | Write4d (std::string context, double v1, double v2, double v3, double v4) |
Writes 4 values to the file. | |
void | Write5d (std::string context, double v1, double v2, double v3, double v4, double v5) |
Writes 5 values to the file. | |
void | Write6d (std::string context, double v1, double v2, double v3, double v4, double v5, double v6) |
Writes 6 values to the file. | |
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 | 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. | |
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. | |
Public Member Functions inherited from ns3::DataCollectionObject | |
DataCollectionObject () | |
~DataCollectionObject () override | |
void | Disable () |
Unset the status of an individual object. | |
void | Enable () |
Set the status of an individual object. | |
std::string | GetName () const |
Get the object's name. | |
virtual bool | IsEnabled () const |
Check the status of an individual object. | |
void | SetName (std::string name) |
Set the object's name. | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
void | UnidirectionalAggregateObject (Ptr< Object > other) |
Aggregate an Object to another Object. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::DataCollectionObject | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Private Attributes | |
std::string | m_10dFormat |
Format string for 10D C-style sprintf() function. | |
std::string | m_1dFormat |
Format string for 1D C-style sprintf() function. | |
std::string | m_2dFormat |
Format string for 2D C-style sprintf() function. | |
std::string | m_3dFormat |
Format string for 3D C-style sprintf() function. | |
std::string | m_4dFormat |
Format string for 4D C-style sprintf() function. | |
std::string | m_5dFormat |
Format string for 5D C-style sprintf() function. | |
std::string | m_6dFormat |
Format string for 6D C-style sprintf() function. | |
std::string | m_7dFormat |
Format string for 7D C-style sprintf() function. | |
std::string | m_8dFormat |
Format string for 8D C-style sprintf() function. | |
std::string | m_9dFormat |
Format string for 9D C-style sprintf() function. | |
std::ofstream | m_file |
Used to write values to the file. | |
FileType | m_fileType |
Determines the kind of file written by the aggregator. | |
bool | m_hasHeadingBeenSet |
Indicates if the heading line for the file has been set. | |
std::string | m_heading |
Heading line for the outputfile. | |
std::string | m_outputFileName |
The file name. | |
std::string | m_separator |
Printed between values in the file. | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | DoDispose () |
Destructor implementation. | |
virtual void | DoInitialize () |
Initialize() implementation. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Protected Attributes inherited from ns3::DataCollectionObject | |
bool | m_enabled |
Object's activation state. | |
std::string | m_name |
Name of the object within the data collection framework. | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
This aggregator sends values it receives to a file.
Definition at line 29 of file file-aggregator.h.
The type of file written by the aggregator.
Enumerator | |
---|---|
FORMATTED | |
SPACE_SEPARATED | |
COMMA_SEPARATED | |
TAB_SEPARATED |
Definition at line 33 of file file-aggregator.h.
ns3::FileAggregator::FileAggregator | ( | const std::string & | outputFileName, |
FileType | fileType = SPACE_SEPARATED ) |
outputFileName | name of the file to write. |
fileType | type 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 34 of file file-aggregator.cc.
References COMMA_SEPARATED, m_file, m_fileType, m_outputFileName, m_separator, NS_LOG_FUNCTION, and TAB_SEPARATED.
|
override |
Definition at line 69 of file file-aggregator.cc.
References m_file, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 26 of file file-aggregator.cc.
References ns3::TypeId::SetParent().
void ns3::FileAggregator::Set10dFormat | ( | const std::string & | format | ) |
Sets the 10D format string for the C-style sprintf() function.
format | the 10D format string. |
Definition at line 160 of file file-aggregator.cc.
References m_10dFormat, and NS_LOG_FUNCTION.
void ns3::FileAggregator::Set1dFormat | ( | const std::string & | format | ) |
Sets the 1D format string for the C-style sprintf() function.
format | the 1D format string. |
Definition at line 97 of file file-aggregator.cc.
References m_1dFormat, and NS_LOG_FUNCTION.
void ns3::FileAggregator::Set2dFormat | ( | const std::string & | format | ) |
Sets the 2D format string for the C-style sprintf() function.
format | the 2D format string. |
Definition at line 104 of file file-aggregator.cc.
References m_2dFormat, and NS_LOG_FUNCTION.
void ns3::FileAggregator::Set3dFormat | ( | const std::string & | format | ) |
Sets the 3D format string for the C-style sprintf() function.
format | the 3D format string. |
Definition at line 111 of file file-aggregator.cc.
References m_3dFormat, and NS_LOG_FUNCTION.
void ns3::FileAggregator::Set4dFormat | ( | const std::string & | format | ) |
Sets the 4D format string for the C-style sprintf() function.
format | the 4D format string. |
Definition at line 118 of file file-aggregator.cc.
References m_4dFormat, and NS_LOG_FUNCTION.
void ns3::FileAggregator::Set5dFormat | ( | const std::string & | format | ) |
Sets the 5D format string for the C-style sprintf() function.
format | the 5D format string. |
Definition at line 125 of file file-aggregator.cc.
References m_5dFormat, and NS_LOG_FUNCTION.
void ns3::FileAggregator::Set6dFormat | ( | const std::string & | format | ) |
Sets the 6D format string for the C-style sprintf() function.
format | the 6D format string. |
Definition at line 132 of file file-aggregator.cc.
References m_6dFormat, and NS_LOG_FUNCTION.
void ns3::FileAggregator::Set7dFormat | ( | const std::string & | format | ) |
Sets the 7D format string for the C-style sprintf() function.
format | the 7D format string. |
Definition at line 139 of file file-aggregator.cc.
References m_7dFormat, and NS_LOG_FUNCTION.
void ns3::FileAggregator::Set8dFormat | ( | const std::string & | format | ) |
Sets the 8D format string for the C-style sprintf() function.
format | the 8D format string. |
Definition at line 146 of file file-aggregator.cc.
References m_8dFormat, and NS_LOG_FUNCTION.
void ns3::FileAggregator::Set9dFormat | ( | const std::string & | format | ) |
Sets the 9D format string for the C-style sprintf() function.
format | the 9D format string. |
Definition at line 153 of file file-aggregator.cc.
References m_9dFormat, and NS_LOG_FUNCTION.
void ns3::FileAggregator::SetFileType | ( | FileType | fileType | ) |
Set the file type to create, which determines the separator to use when printing values to the file.
fileType | file type specifies the separator to use in printing the file. |
Definition at line 76 of file file-aggregator.cc.
References m_fileType, and NS_LOG_FUNCTION.
void ns3::FileAggregator::SetHeading | ( | const std::string & | heading | ) |
Sets the heading string that will be printed on the first line of the file.
heading | the heading string. |
Note that the heading string will only be printed if it has been set by calling this function.
Definition at line 83 of file file-aggregator.cc.
References m_file, m_hasHeadingBeenSet, m_heading, and NS_LOG_FUNCTION.
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.
context | specifies the 10D dataset these values came from. |
v1 | first value for the new data point. |
v2 | second value for the new data point. |
v3 | third value for the new data point. |
v4 | fourth value for the new data point. |
v5 | fifth value for the new data point. |
v6 | sixth value for the new data point. |
v7 | seventh value for the new data point. |
v8 | eighth value for the new data point. |
v9 | ninth value for the new data point. |
v10 | tenth value for the new data point. |
Definition at line 525 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.
void ns3::FileAggregator::Write1d | ( | std::string | context, |
double | v1 ) |
Writes 1 value to the file.
context | specifies the 1D dataset these values came from. |
v1 | value for the new data point. |
Definition at line 167 of file file-aggregator.cc.
References FORMATTED, m_1dFormat, ns3::DataCollectionObject::m_enabled, m_file, m_fileType, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Writes 2 values to the file.
context | specifies the 2D dataset these values came from. |
v1 | first value for the new data point. |
v2 | second value for the new data point. |
Definition at line 201 of file file-aggregator.cc.
References FORMATTED, m_2dFormat, ns3::DataCollectionObject::m_enabled, m_file, m_fileType, m_separator, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by ns3::FileHelper::ConnectProbeToAggregator().
Writes 3 values to the file.
context | specifies the 3D dataset these values came from. |
v1 | first value for the new data point. |
v2 | second value for the new data point. |
v3 | third value for the new data point. |
Definition at line 235 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.
void ns3::FileAggregator::Write4d | ( | std::string | context, |
double | v1, | ||
double | v2, | ||
double | v3, | ||
double | v4 ) |
Writes 4 values to the file.
context | specifies the 4D dataset these values came from. |
v1 | first value for the new data point. |
v2 | second value for the new data point. |
v3 | third value for the new data point. |
v4 | fourth value for the new data point. |
Definition at line 269 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.
void ns3::FileAggregator::Write5d | ( | std::string | context, |
double | v1, | ||
double | v2, | ||
double | v3, | ||
double | v4, | ||
double | v5 ) |
Writes 5 values to the file.
context | specifies the 5D dataset these values came from. |
v1 | first value for the new data point. |
v2 | second value for the new data point. |
v3 | third value for the new data point. |
v4 | fourth value for the new data point. |
v5 | fifth value for the new data point. |
Definition at line 304 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.
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.
context | specifies the 6D dataset these values came from. |
v1 | first value for the new data point. |
v2 | second value for the new data point. |
v3 | third value for the new data point. |
v4 | fourth value for the new data point. |
v5 | fifth value for the new data point. |
v6 | sixth value for the new data point. |
Definition at line 340 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.
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.
context | specifies the 7D dataset these values came from. |
v1 | first value for the new data point. |
v2 | second value for the new data point. |
v3 | third value for the new data point. |
v4 | fourth value for the new data point. |
v5 | fifth value for the new data point. |
v6 | sixth value for the new data point. |
v7 | seventh value for the new data point. |
Definition at line 382 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.
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.
context | specifies the 8D dataset these values came from. |
v1 | first value for the new data point. |
v2 | second value for the new data point. |
v3 | third value for the new data point. |
v4 | fourth value for the new data point. |
v5 | fifth value for the new data point. |
v6 | sixth value for the new data point. |
v7 | seventh value for the new data point. |
v8 | eighth value for the new data point. |
Definition at line 425 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.
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.
context | specifies the 9D dataset these values came from. |
v1 | first value for the new data point. |
v2 | second value for the new data point. |
v3 | third value for the new data point. |
v4 | fourth value for the new data point. |
v5 | fifth value for the new data point. |
v6 | sixth value for the new data point. |
v7 | seventh value for the new data point. |
v8 | eighth value for the new data point. |
v9 | ninth value for the new data point. |
Definition at line 470 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.
|
private |
Format string for 10D C-style sprintf() function.
Definition at line 356 of file file-aggregator.h.
Referenced by Set10dFormat(), and Write10d().
|
private |
Format string for 1D C-style sprintf() function.
Definition at line 347 of file file-aggregator.h.
Referenced by Set1dFormat(), and Write1d().
|
private |
Format string for 2D C-style sprintf() function.
Definition at line 348 of file file-aggregator.h.
Referenced by Set2dFormat(), and Write2d().
|
private |
Format string for 3D C-style sprintf() function.
Definition at line 349 of file file-aggregator.h.
Referenced by Set3dFormat(), and Write3d().
|
private |
Format string for 4D C-style sprintf() function.
Definition at line 350 of file file-aggregator.h.
Referenced by Set4dFormat(), and Write4d().
|
private |
Format string for 5D C-style sprintf() function.
Definition at line 351 of file file-aggregator.h.
Referenced by Set5dFormat(), and Write5d().
|
private |
Format string for 6D C-style sprintf() function.
Definition at line 352 of file file-aggregator.h.
Referenced by Set6dFormat(), and Write6d().
|
private |
Format string for 7D C-style sprintf() function.
Definition at line 353 of file file-aggregator.h.
Referenced by Set7dFormat(), and Write7d().
|
private |
Format string for 8D C-style sprintf() function.
Definition at line 354 of file file-aggregator.h.
Referenced by Set8dFormat(), and Write8d().
|
private |
Format string for 9D C-style sprintf() function.
Definition at line 355 of file file-aggregator.h.
Referenced by Set9dFormat(), and Write9d().
|
private |
Used to write values to the file.
Definition at line 333 of file file-aggregator.h.
Referenced by FileAggregator(), ~FileAggregator(), SetHeading(), Write10d(), Write1d(), Write2d(), Write3d(), Write4d(), Write5d(), Write6d(), Write7d(), Write8d(), and Write9d().
|
private |
Determines the kind of file written by the aggregator.
Definition at line 336 of file file-aggregator.h.
Referenced by FileAggregator(), SetFileType(), Write10d(), Write1d(), Write2d(), Write3d(), Write4d(), Write5d(), Write6d(), Write7d(), Write8d(), and Write9d().
|
private |
Indicates if the heading line for the file has been set.
Definition at line 342 of file file-aggregator.h.
Referenced by SetHeading().
|
private |
Heading line for the outputfile.
Definition at line 345 of file file-aggregator.h.
Referenced by SetHeading().
|
private |
|
private |
Printed between values in the file.
Definition at line 339 of file file-aggregator.h.
Referenced by FileAggregator(), Write10d(), Write2d(), Write3d(), Write4d(), Write5d(), Write6d(), Write7d(), Write8d(), and Write9d().