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/ndn-limits.hpp b/utils/ndn-limits.hpp
index d8f848b..ebb8d15 100644
--- a/utils/ndn-limits.hpp
+++ b/utils/ndn-limits.hpp
@@ -19,7 +19,7 @@
*/
#ifndef _NDN_LIMITS_H_
-#define _NDN_LIMITS_H_
+#define _NDN_LIMITS_H_
#include "ns3/ptr.h"
#include "ns3/object.h"
@@ -30,45 +30,44 @@
/**
* \ingroup ndn-fw
- * \brief Abstract class to manage Interest limits
+ * \brief Abstract class to manage Interest limits
*/
-class Limits :
- public Object
-{
+class Limits : public Object {
public:
typedef Callback<void> CallbackHandler;
static TypeId
- GetTypeId ();
+ GetTypeId();
/**
* @brief Default constructor
*/
- Limits ();
+ Limits();
/**
* @brief Virtual destructor
*/
- virtual
- ~Limits () {}
-
+ virtual ~Limits()
+ {
+ }
+
/**
* @brief Set limit for the number of outstanding interests
* @param rate Maximum rate that needs to be enforced
* @param delay Maximum delay for BDP product for window-based limits
*/
virtual void
- SetLimits (double rate, double delay)
+ SetLimits(double rate, double delay)
{
m_maxRate = rate;
m_maxDelay = delay;
- }
+ }
/**
* @brief Get maximum rate that needs to be enforced
*/
virtual double
- GetMaxRate () const
+ GetMaxRate() const
{
return m_maxRate;
}
@@ -77,7 +76,7 @@
* @brief Get maximum delay for BDP product for window-based limits
*/
virtual double
- GetMaxDelay () const
+ GetMaxDelay() const
{
return m_maxDelay;
}
@@ -85,15 +84,14 @@
/**
* @brief Get maximum limit (interpretation of the limit depends on realization)
*/
- virtual
- double
- GetMaxLimit () const = 0;
+ virtual double
+ GetMaxLimit() const = 0;
/**
* @brief Check whether limits are enabled or not
*/
virtual inline bool
- IsEnabled () const
+ IsEnabled() const
{
return m_maxRate > 0.0;
}
@@ -104,11 +102,12 @@
*
* Note that interpretation of this value may be different in different ndn::Limit realizations
*
- * All realizations will try to guarantee that if limit is larger than previously set value of maximum limit,
+ * All realizations will try to guarantee that if limit is larger than previously set value of
+ *maximum limit,
* then the current limit will be limited to that maximum value
*/
virtual void
- UpdateCurrentLimit (double limit) = 0;
+ UpdateCurrentLimit(double limit) = 0;
/**
* @brief Get value of the current limit
@@ -116,17 +115,18 @@
* Note that interpretation of this value may be different in different ndn::Limit realizations
*/
virtual double
- GetCurrentLimit () const = 0;
+ GetCurrentLimit() const = 0;
/**
* @brief Get value of the current limit in terms of maximum rate that needs to be enforced
*
- * Compared to GetCurrentLimit, this method guarantees that the returned value is maximum number of packets
+ * Compared to GetCurrentLimit, this method guarantees that the returned value is maximum number
+ *of packets
* that can be send out within one second (max "rate")
*/
virtual double
- GetCurrentLimitRate () const = 0;
-
+ GetCurrentLimitRate() const = 0;
+
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
@@ -135,7 +135,7 @@
* @brief Realization-specific method called to check availability of the limit
*/
virtual bool
- IsBelowLimit () = 0;
+ IsBelowLimit() = 0;
/**
* @brief "Borrow" limit
@@ -143,13 +143,13 @@
* IsBelowLimit **must** be true, otherwise assert fail
*/
virtual void
- BorrowLimit () = 0;
+ BorrowLimit() = 0;
/**
* @brief "Return" limit
*/
virtual void
- ReturnLimit () = 0;
+ ReturnLimit() = 0;
/**
* @brief Set link delay (in seconds)
@@ -157,7 +157,7 @@
* This is a supplementary information that may or may not be useful for limits
*/
virtual void
- SetLinkDelay (double delay)
+ SetLinkDelay(double delay)
{
m_linkDelay = delay;
}
@@ -166,11 +166,11 @@
* @brief Get link delay (in seconds)
*/
virtual double
- GetLinkDelay () const
+ GetLinkDelay() const
{
return m_linkDelay;
}
-
+
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
@@ -179,12 +179,12 @@
* @brief Set callback which will be called when exhausted limit gets a new slot
*/
void
- RegisterAvailableSlotCallback (CallbackHandler handler);
+ RegisterAvailableSlotCallback(CallbackHandler handler);
protected:
void
- FireAvailableSlotCallback ();
-
+ FireAvailableSlotCallback();
+
private:
double m_maxRate;
double m_maxDelay;
@@ -193,7 +193,6 @@
double m_linkDelay;
};
-
} // namespace ndn
} // namespace ns3