src: Updating code style to conform (more or less) to ndn-cxx style
Also, adding .clang-format that describes the applied style. Note that
this style requires a slightly customized version of clang-format.
diff --git a/utils/tracers/ndn-cs-tracer.hpp b/utils/tracers/ndn-cs-tracer.hpp
index eb07585..939df9b 100644
--- a/utils/tracers/ndn-cs-tracer.hpp
+++ b/utils/tracers/ndn-cs-tracer.hpp
@@ -49,80 +49,87 @@
namespace cs {
/// @cond include_hidden
-struct Stats
-{
- inline void Reset ()
+struct Stats {
+ inline void
+ Reset()
{
- m_cacheHits = 0;
+ m_cacheHits = 0;
m_cacheMisses = 0;
}
double m_cacheHits;
double m_cacheMisses;
};
/// @endcond
-
-}
+}
/**
* @ingroup ndn-tracers
* @brief NDN tracer for cache performance (hits and misses)
*/
-class CsTracer : public SimpleRefCount<CsTracer>
-{
+class CsTracer : public SimpleRefCount<CsTracer> {
public:
/**
* @brief Helper method to install tracers on all simulation nodes
*
* @param file File to which traces will be written. If filename is -, then std::out is used
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
- *
+ *
*/
static void
- InstallAll (const std::string &file, Time averagingPeriod = Seconds (0.5));
+ InstallAll(const std::string& file, Time averagingPeriod = Seconds(0.5));
/**
* @brief Helper method to install tracers on the selected simulation nodes
*
* @param nodes Nodes on which to install tracer
* @param file File to which traces will be written. If filename is -, then std::out is used
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*
*/
static void
- Install (const NodeContainer &nodes, const std::string &file, Time averagingPeriod = Seconds (0.5));
+ Install(const NodeContainer& nodes, const std::string& file, Time averagingPeriod = Seconds(0.5));
/**
* @brief Helper method to install tracers on a specific simulation node
*
* @param nodes Nodes on which to install tracer
* @param file File to which traces will be written. If filename is -, then std::out is used
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*
*/
static void
- Install (Ptr<Node> node, const std::string &file, Time averagingPeriod = Seconds (0.5));
+ Install(Ptr<Node> node, const std::string& file, Time averagingPeriod = Seconds(0.5));
/**
* @brief Helper method to install tracers on a specific simulation node
*
* @param nodes Nodes on which to install tracer
* @param outputStream Smart pointer to a stream
- * @param averagingPeriod How often data will be written into the trace file (default, every half second)
+ * @param averagingPeriod How often data will be written into the trace file (default, every half
+ *second)
*
- * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This tuple needs to be preserved
+ * @returns a tuple of reference to output stream and list of tracers. !!! Attention !!! This
+ *tuple needs to be preserved
* for the lifetime of simulation, otherwise SEGFAULTs are inevitable
*/
static Ptr<CsTracer>
- Install (Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream, Time averagingPeriod = Seconds (0.5));
+ Install(Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream,
+ Time averagingPeriod = Seconds(0.5));
/**
* @brief Explicit request to remove all statically created tracers
@@ -131,26 +138,26 @@
* or if it is desired to do a postprocessing of the resulting data
*/
static void
- Destroy ();
-
+ Destroy();
+
/**
* @brief Trace constructor that attaches to the node using node pointer
* @param os reference to the output stream
* @param node pointer to the node
*/
- CsTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node);
+ CsTracer(boost::shared_ptr<std::ostream> os, Ptr<Node> node);
/**
* @brief Trace constructor that attaches to the node using node name
* @param os reference to the output stream
* @param nodeName name of the node registered using Names::Add
*/
- CsTracer (boost::shared_ptr<std::ostream> os, const std::string &node);
+ CsTracer(boost::shared_ptr<std::ostream> os, const std::string& node);
/**
* @brief Destructor
*/
- ~CsTracer ();
+ ~CsTracer();
/**
* @brief Print head of the trace (e.g., for post-processing)
@@ -158,7 +165,7 @@
* @param os reference to output stream
*/
void
- PrintHeader (std::ostream &os) const;
+ PrintHeader(std::ostream& os) const;
/**
* @brief Print current trace data
@@ -166,28 +173,28 @@
* @param os reference to output stream
*/
void
- Print (std::ostream &os) const;
-
-private:
- void
- Connect ();
-
- void
- CacheHits (Ptr<const Interest>, Ptr<const Data>);
-
- void
- CacheMisses (Ptr<const Interest>);
+ Print(std::ostream& os) const;
private:
void
- SetAveragingPeriod (const Time &period);
+ Connect();
void
- Reset ();
+ CacheHits(Ptr<const Interest>, Ptr<const Data>);
void
- PeriodicPrinter ();
-
+ CacheMisses(Ptr<const Interest>);
+
+private:
+ void
+ SetAveragingPeriod(const Time& period);
+
+ void
+ Reset();
+
+ void
+ PeriodicPrinter();
+
private:
std::string m_node;
Ptr<Node> m_nodePtr;
@@ -196,19 +203,19 @@
Time m_period;
EventId m_printEvent;
- cs::Stats m_stats;
+ cs::Stats m_stats;
};
/**
* @brief Helper to dump the trace to an output stream
*/
inline std::ostream&
-operator << (std::ostream &os, const CsTracer &tracer)
+operator<<(std::ostream& os, const CsTracer& tracer)
{
os << "# ";
- tracer.PrintHeader (os);
+ tracer.PrintHeader(os);
os << "\n";
- tracer.Print (os);
+ tracer.Print(os);
return os;
}