Index: src/stats/helper/file-helper.h |
=================================================================== |
--- a/src/stats/helper/file-helper.h |
+++ b/src/stats/helper/file-helper.h |
@@ -26,8 +26,8 @@ |
#include "ns3/object-factory.h" |
#include "ns3/ptr.h" |
#include "ns3/probe.h" |
+#include "ns3/collector.h" |
#include "ns3/file-aggregator.h" |
-#include "ns3/time-series-adaptor.h" |
namespace ns3 { |
@@ -40,13 +40,13 @@ |
public: |
/** |
* Constructs a file helper that will create a space separated file |
- * named "file-helper.txt" unless it is later configured otherwise. |
+ * named "file-helper.txt" unless it is later configured to a different name. |
*/ |
FileHelper (); |
/** |
* \param outputFileNameWithoutExtension name of output file to |
- * write with no extension |
+ * write with no extension |
* \param fileType type of file to write. |
* |
* Constructs a file helper that will create a file named |
@@ -55,13 +55,13 @@ |
* specified by fileType. The default file type is space-separated. |
*/ |
FileHelper (const std::string &outputFileNameWithoutExtension, |
- enum FileAggregator::FileType fileType = FileAggregator::SPACE_SEPARATED); |
+ enum FileAggregator::FileType fileType = FileAggregator::SPACE_SEPARATED) NS_DEPRECATED; |
virtual ~FileHelper (); |
/** |
* \param outputFileNameWithoutExtension name of output file to |
- * write with no extension |
+ * write with no extension |
* \param fileType type of file to write. |
* |
* Configures file related parameters for this file helper so that |
@@ -74,6 +74,43 @@ |
enum FileAggregator::FileType fileType = FileAggregator::SPACE_SEPARATED); |
/** |
+ * \param fileType file type setting for output |
+ */ |
+ void SetFileType (enum FileAggregator::FileType fileType); |
+ |
+ /** |
+ * Select the collector type and configure its attributes for any probes |
+ * added thereafter (but not affecting probes added before). |
+ * The default is "ns3::EventDrivenCollector". |
+ * \param collectorType the ns-3 TypeId string of the collector type |
+ * \param n0 the name of the attribute to set |
+ * \param v0 the value of the attribute to set |
+ * \param n1 the name of the attribute to set |
+ * \param v1 the value of the attribute to set |
+ * \param n2 the name of the attribute to set |
+ * \param v2 the value of the attribute to set |
+ * \param n3 the name of the attribute to set |
+ * \param v3 the value of the attribute to set |
+ * \param n4 the name of the attribute to set |
+ * \param v4 the value of the attribute to set |
+ * \param n5 the name of the attribute to set |
+ * \param v5 the value of the attribute to set |
+ * \param n6 the name of the attribute to set |
+ * \param v6 the value of the attribute to set |
+ * \param n7 the name of the attribute to set |
+ * \param v7 the value of the attribute to set |
+ */ |
+ void SetCollectorType (std::string collectorType, |
+ std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), |
+ std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), |
+ std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), |
+ std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), |
+ std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), |
+ std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), |
+ std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), |
+ std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); |
buherman
2015/06/29 08:53:53
std::string -> const std:string & in order to make
|
+ |
+ /** |
* \param typeId the type ID for the probe used when it is created. |
* \param path Config path for underlying trace source to be probed |
* \param probeTraceSource the probe trace source to access. |
@@ -105,14 +142,41 @@ |
*/ |
void WriteProbe (const std::string &typeId, |
const std::string &path, |
- const std::string &probeTraceSource); |
+ const std::string &probeTraceSource) NS_DEPRECATED; |
/** |
- * \param adaptorName the timeSeriesAdaptor's name. |
+ * \param typeId the type ID for the probe used when it is created. |
+ * \param path Config path for underlying trace source to be probed |
+ * \param probeTraceSource the probe trace source to access. |
* |
- * \brief Adds a time series adaptor to be used to write the file. |
+ * Creates output files generated by hooking the ns-3 trace source |
+ * with a probe, and then writing the values from the |
+ * probeTraceSource. The output file names will have the text stored |
+ * in m_outputFileNameWithoutExtension plus ".txt", and will consist |
+ * of the 'newValue' at each timestamp. |
+ * |
+ * This method will create one or more probes according to the TypeId |
+ * provided, connect the probe(s) to the trace source specified by |
+ * the config path, and hook the probeTraceSource(s) to the downstream |
+ * aggregator. |
+ * |
+ * If the config path has more than one match in the system |
+ * (e.g. there is a wildcard), then one output file for each match |
+ * will be created. The output file names will contain the text in |
+ * m_outputFileNameWithoutExtension plus the matched characters for |
+ * each of the wildcards in the config path, separated by dashes, |
+ * plus ".txt". For example, if the value in |
+ * m_outputFileNameWithoutExtension is the string |
+ * "packet-byte-count", and there are two wildcards in the path, |
+ * then output file names like "packet-byte-count-0-0.txt" or |
+ * "packet-byte-count-12-9.txt" will be possible as names for the |
+ * files that will be created. |
+ * |
+ * A fatal error will result if an unknown probe type is used. |
*/ |
- void AddTimeSeriesAdaptor (const std::string &adaptorName); |
+ void AddProbe (const std::string &typeId, |
+ const std::string &path, |
+ const std::string &probeTraceSource); |
/** |
* \param aggregatorName the aggregator's name. |
@@ -131,7 +195,7 @@ |
* \return Ptr to the probe |
* \brief Gets the specified probe. |
*/ |
- Ptr<Probe> GetProbe (std::string probeName) const; |
+ Ptr<Probe> GetProbe (std::string probeName) const NS_DEPRECATED; |
/** |
* \return Ptr to a FileAggregator object |
@@ -140,7 +204,7 @@ |
* This function is non-const because an aggregator may be lazily |
* created by this method. |
*/ |
- Ptr<FileAggregator> GetAggregatorSingle (); |
+ Ptr<FileAggregator> GetAggregatorSingle () NS_DEPRECATED; |
/** |
* \param aggregatorName name for aggregator. |
@@ -152,7 +216,7 @@ |
* created by this method. |
*/ |
Ptr<FileAggregator> GetAggregatorMultiple (const std::string &aggregatorName, |
- const std::string &outputFileName); |
+ const std::string &outputFileName) NS_DEPRECATED; |
/** |
* \param heading the heading string. |
@@ -253,9 +317,16 @@ |
* |
* \brief Adds a probe to be used to write values to files. |
*/ |
- void AddProbe (const std::string &typeId, |
- const std::string &probeName, |
- const std::string &path); |
+ void AddProbeToMap (const std::string &typeId, |
+ const std::string &probeName, |
+ const std::string &path); |
+ |
+ /** |
+ * \param collectorName the name of the collector |
+ * |
+ * \brief Adds the collector to the FileHelper. |
+ */ |
+ void AddCollector (const std::string &collectorName); |
/** |
* \param typeId the type ID for the probe used when it is created. |
@@ -272,13 +343,40 @@ |
* |
* A fatal error will result if an unknown probe type is used. |
*/ |
- void ConnectProbeToAggregator (const std::string &typeId, |
+ void CreateDataCollectionChain (const std::string &typeId, |
const std::string &matchIdentifier, |
const std::string &path, |
const std::string &probeTraceSource, |
const std::string &outputFileNameWithoutExtension, |
bool onlyOneAggregator); |
+ /** |
+ * \param probeTraceSource the trace source of the probe |
+ * \param probeName the name of the probe in the map |
+ * \param probeContext the context of the probe in the collector map |
+ * |
+ * \brief Connects a probe to a Collector object |
+ */ |
+ void ConnectProbeToCollector(const std::string probeTraceSource, |
+ const std::string probeName, |
+ const std::string probeContext); |
+ |
+ /** |
+ * \param probeContext the name of the collector in the map |
+ * |
+ * \brief connect a collector to an aggregator |
+ */ |
+ void ConnectCollectorToAggregator(const std::string probeContext); |
+ |
+ /** |
+ * \return Ptr to a FileAggregator object |
+ * \brief Gets the single aggregator that is always constructed. |
+ * |
+ * This function is non-const because an aggregator may be lazily |
+ * created by this method. |
+ */ |
+ Ptr<FileAggregator> GetAggregator (); |
+ |
/// Used to create the probes and collectors as they are added. |
ObjectFactory m_factory; |
@@ -292,8 +390,8 @@ |
/// Maps probe names to probes. |
std::map<std::string, std::pair <Ptr<Probe>, std::string> > m_probeMap; |
- /// Maps time series adaptor names to time series adaptors. |
- std::map<std::string, Ptr<TimeSeriesAdaptor> > m_timeSeriesAdaptorMap; |
+ /// Maps Collector names to Collectors |
+ std::map<std::string, Ptr<Collector> > m_collectorMap; |
/// Number of file probes that have been created. |
uint32_t m_fileProbeCount; |
@@ -304,6 +402,9 @@ |
/// The name of the output file to created without its extension. |
std::string m_outputFileNameWithoutExtension; |
+ /// Factory object for instantiating collector |
+ ObjectFactory m_collectorFactory; |
+ |
/// Indicates if the heading line for the file has been set. |
bool m_hasHeadingBeenSet; |