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/helper/ndn-stack-helper.hpp b/helper/ndn-stack-helper.hpp
index dc11bcf..155c22d 100644
--- a/helper/ndn-stack-helper.hpp
+++ b/helper/ndn-stack-helper.hpp
@@ -59,8 +59,7 @@
* attribute or a set of functionality that may be of interest to many other
* classes.
*/
-class StackHelper
-{
+class StackHelper {
public:
/**
* \brief Create a new NdnStackHelper with a default NDN_FLOODING forwarding stategy
@@ -70,17 +69,16 @@
/**
* \brief Destroy the NdnStackHelper
*/
- virtual ~StackHelper ();
+ virtual ~StackHelper();
/**
* @brief Set parameters of NdnL3Protocol
*/
void
- SetStackAttributes (const std::string &attr1 = "", const std::string &value1 = "",
- const std::string &attr2 = "", const std::string &value2 = "",
- const std::string &attr3 = "", const std::string &value3 = "",
- const std::string &attr4 = "", const std::string &value4 = "");
-
+ SetStackAttributes(const std::string& attr1 = "", const std::string& value1 = "",
+ const std::string& attr2 = "", const std::string& value2 = "",
+ const std::string& attr3 = "", const std::string& value3 = "",
+ const std::string& attr4 = "", const std::string& value4 = "");
/**
* @brief Set forwarding strategy class and its attributes
@@ -91,75 +89,79 @@
* Other strategies can be implemented, inheriting ns3::NdnForwardingStrategy class
*/
void
- SetForwardingStrategy (const std::string &forwardingStrategyClass,
- const std::string &attr1 = "", const std::string &value1 = "",
- const std::string &attr2 = "", const std::string &value2 = "",
- const std::string &attr3 = "", const std::string &value3 = "",
- const std::string &attr4 = "", const std::string &value4 = "");
+ SetForwardingStrategy(const std::string& forwardingStrategyClass, const std::string& attr1 = "",
+ const std::string& value1 = "", const std::string& attr2 = "",
+ const std::string& value2 = "", const std::string& attr3 = "",
+ const std::string& value3 = "", const std::string& attr4 = "",
+ const std::string& value4 = "");
/**
* @brief Set content store class and its attributes
* @param contentStoreClass string, representing class of the content store
*/
void
- SetContentStore (const std::string &contentStoreClass,
- const std::string &attr1 = "", const std::string &value1 = "",
- const std::string &attr2 = "", const std::string &value2 = "",
- const std::string &attr3 = "", const std::string &value3 = "",
- const std::string &attr4 = "", const std::string &value4 = "");
+ SetContentStore(const std::string& contentStoreClass, const std::string& attr1 = "",
+ const std::string& value1 = "", const std::string& attr2 = "",
+ const std::string& value2 = "", const std::string& attr3 = "",
+ const std::string& value3 = "", const std::string& attr4 = "",
+ const std::string& value4 = "");
/**
* @brief Set PIT class and its attributes
* @param pitClass string, representing class of PIT
*/
void
- SetPit (const std::string &pitClass,
- const std::string &attr1 = "", const std::string &value1 = "",
- const std::string &attr2 = "", const std::string &value2 = "",
- const std::string &attr3 = "", const std::string &value3 = "",
- const std::string &attr4 = "", const std::string &value4 = "");
+ SetPit(const std::string& pitClass, const std::string& attr1 = "", const std::string& value1 = "",
+ const std::string& attr2 = "", const std::string& value2 = "",
+ const std::string& attr3 = "", const std::string& value3 = "",
+ const std::string& attr4 = "", const std::string& value4 = "");
/**
* @brief Set FIB class and its attributes
* @param pitClass string, representing class of FIB
*/
void
- SetFib (const std::string &fibClass,
- const std::string &attr1 = "", const std::string &value1 = "",
- const std::string &attr2 = "", const std::string &value2 = "",
- const std::string &attr3 = "", const std::string &value3 = "",
- const std::string &attr4 = "", const std::string &value4 = "");
+ SetFib(const std::string& fibClass, const std::string& attr1 = "", const std::string& value1 = "",
+ const std::string& attr2 = "", const std::string& value2 = "",
+ const std::string& attr3 = "", const std::string& value3 = "",
+ const std::string& attr4 = "", const std::string& value4 = "");
- typedef Callback< Ptr<NetDeviceFace>, Ptr<Node>, Ptr<L3Protocol>, Ptr<NetDevice> > NetDeviceFaceCreateCallback;
+ typedef Callback<Ptr<NetDeviceFace>, Ptr<Node>, Ptr<L3Protocol>, Ptr<NetDevice>>
+ NetDeviceFaceCreateCallback;
/**
- * @brief Add callback to create and configure instance of the face, based on supplied Ptr<Node> and Ptr<NetDevice>
+ * @brief Add callback to create and configure instance of the face, based on supplied Ptr<Node>
+ *and Ptr<NetDevice>
*
* It is possible to set up several callbacks for different NetDevice types.
*
- * Currently, there is only one specialized callback for PointToPointNetDevice, which creates face and sets limits (if enabled)
+ * Currently, there is only one specialized callback for PointToPointNetDevice, which creates face
+ *and sets limits (if enabled)
* based on PointToPoint link parameters
*
- * If none of the callbacks fit the TypeId of NetDevice, a default callback is used (DefaultNetDeviceCallback)
+ * If none of the callbacks fit the TypeId of NetDevice, a default callback is used
+ *(DefaultNetDeviceCallback)
*/
void
- AddNetDeviceFaceCreateCallback (TypeId netDeviceType, NetDeviceFaceCreateCallback callback);
+ AddNetDeviceFaceCreateCallback(TypeId netDeviceType, NetDeviceFaceCreateCallback callback);
/**
- * @brief Update callback to create and configure instance of the face, based on supplied Ptr<Node> and Ptr<NetDevice>
+ * @brief Update callback to create and configure instance of the face, based on supplied
+ *Ptr<Node> and Ptr<NetDevice>
*
* It is possible to set up several callbacks for different NetDevice types.
*
* Using this method, it is possible to override Face creation for PointToPointNetDevices
*/
void
- UpdateNetDeviceFaceCreateCallback (TypeId netDeviceType, NetDeviceFaceCreateCallback callback);
+ UpdateNetDeviceFaceCreateCallback(TypeId netDeviceType, NetDeviceFaceCreateCallback callback);
/**
- * @brief Remove callback to create and configure instance of the face, based on supplied Ptr<Node> and Ptr<NetDevice>
+ * @brief Remove callback to create and configure instance of the face, based on supplied
+ * Ptr<Node> and Ptr<NetDevice>
*/
void
- RemoveNetDeviceFaceCreateCallback (TypeId netDeviceType, NetDeviceFaceCreateCallback callback);
+ RemoveNetDeviceFaceCreateCallback(TypeId netDeviceType, NetDeviceFaceCreateCallback callback);
/**
* @brief Enable Interest limits (disabled by default)
@@ -170,7 +172,8 @@
* @param avgInterest Average size of interest packets (including all headers)
*/
void
- EnableLimits (bool enable = true, Time avgRtt=Seconds(0.1), uint32_t avgData=1100, uint32_t avgInterest=40);
+ EnableLimits(bool enable = true, Time avgRtt = Seconds(0.1), uint32_t avgData = 1100,
+ uint32_t avgInterest = 40);
/**
* \brief Install Ndn stack on the node
@@ -184,7 +187,7 @@
* to NdnFaceContainer object
*/
Ptr<FaceContainer>
- Install (const std::string &nodeName) const;
+ Install(const std::string& nodeName) const;
/**
* \brief Install Ndn stack on the node
@@ -198,7 +201,7 @@
* to FaceContainer object
*/
Ptr<FaceContainer>
- Install (Ptr<Node> node) const;
+ Install(Ptr<Node> node) const;
/**
* \brief Install Ndn stack on each node in the input container
@@ -213,7 +216,7 @@
* to FaceContainer object
*/
Ptr<FaceContainer>
- Install (const NodeContainer &c) const;
+ Install(const NodeContainer& c) const;
/**
* \brief Install Ndn stack on all nodes in the simulation
@@ -222,7 +225,7 @@
* to FaceContainer object
*/
Ptr<FaceContainer>
- InstallAll () const;
+ InstallAll() const;
/**
* \brief Add forwarding entry to FIB
@@ -233,7 +236,7 @@
* \param metric Routing metric
*/
static void
- AddRoute (const std::string &nodeName, const std::string &prefix, uint32_t faceId, int32_t metric);
+ AddRoute(const std::string& nodeName, const std::string& prefix, uint32_t faceId, int32_t metric);
/**
* \brief Add forwarding entry to FIB
@@ -244,7 +247,7 @@
* \param metric Routing metric
*/
static void
- AddRoute (Ptr<Node> node, const std::string &prefix, uint32_t faceId, int32_t metric);
+ AddRoute(Ptr<Node> node, const std::string& prefix, uint32_t faceId, int32_t metric);
/**
* \brief Add forwarding entry to FIB
@@ -255,7 +258,7 @@
* \param metric Routing metric
*/
static void
- AddRoute (Ptr<Node> node, const std::string &prefix, Ptr<Face> face, int32_t metric);
+ AddRoute(Ptr<Node> node, const std::string& prefix, Ptr<Face> face, int32_t metric);
/**
* @brief Add forwarding entry to FIB (work only with point-to-point links)
@@ -266,35 +269,39 @@
* \param metric Routing metric
*/
static void
- AddRoute (Ptr<Node> node, const std::string &prefix, Ptr<Node> otherNode, int32_t metric);
+ AddRoute(Ptr<Node> node, const std::string& prefix, Ptr<Node> otherNode, int32_t metric);
/**
* @brief Add forwarding entry to FIB (work only with point-to-point links)
*
* \param nodeName Node name (refer to ns3::Names)
* \param prefix Routing prefix
- * \param otherNode The other node name, to which interests (will be used to infer face id (refer to ns3::Names)
+ * \param otherNode The other node name, to which interests (will be used to infer face id (refer
+ *to ns3::Names)
* \param metric Routing metric
*/
static void
- AddRoute (const std::string &nodeName, const std::string &prefix, const std::string &otherNodeName, int32_t metric);
+ AddRoute(const std::string& nodeName, const std::string& prefix, const std::string& otherNodeName,
+ int32_t metric);
/**
* \brief Set flag indicating necessity to install default routes in FIB
*/
void
- SetDefaultRoutes (bool needSet);
+ SetDefaultRoutes(bool needSet);
private:
Ptr<NetDeviceFace>
- DefaultNetDeviceCallback (Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const;
+ DefaultNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const;
Ptr<NetDeviceFace>
- PointToPointNetDeviceCallback (Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const;
+ PointToPointNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn,
+ Ptr<NetDevice> netDevice) const;
private:
- StackHelper (const StackHelper &);
- StackHelper &operator = (const StackHelper &o);
+ StackHelper(const StackHelper&);
+ StackHelper&
+ operator=(const StackHelper& o);
private:
ObjectFactory m_ndnFactory;
@@ -303,13 +310,13 @@
ObjectFactory m_pitFactory;
ObjectFactory m_fibFactory;
- bool m_limitsEnabled;
- Time m_avgRtt;
+ bool m_limitsEnabled;
+ Time m_avgRtt;
uint32_t m_avgDataSize;
uint32_t m_avgInterestSize;
- bool m_needSetDefaultRoutes;
+ bool m_needSetDefaultRoutes;
- typedef std::list< std::pair<TypeId, NetDeviceFaceCreateCallback> > NetDeviceCallbackList;
+ typedef std::list<std::pair<TypeId, NetDeviceFaceCreateCallback>> NetDeviceCallbackList;
NetDeviceCallbackList m_netDeviceCallbacks;
};