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/model/cs/content-store-with-stats.hpp b/model/cs/content-store-with-stats.hpp
index 542b88c..b5f7540 100644
--- a/model/cs/content-store-with-stats.hpp
+++ b/model/cs/content-store-with-stats.hpp
@@ -37,54 +37,62 @@
* @brief Special content store realization that provides ability to track stats of CS operations
*/
template<class Policy>
-class ContentStoreWithStats :
- public ContentStoreImpl< ndnSIM::multi_policy_traits< boost::mpl::vector2< Policy, ndnSIM::lifetime_stats_policy_traits > > >
-{
+class ContentStoreWithStats
+ : public ContentStoreImpl<ndnSIM::
+ multi_policy_traits<boost::mpl::
+ vector2<Policy,
+ ndnSIM::
+ lifetime_stats_policy_traits>>> {
public:
- typedef ContentStoreImpl< ndnSIM::multi_policy_traits< boost::mpl::vector2< Policy, ndnSIM::lifetime_stats_policy_traits > > > super;
+ typedef ContentStoreImpl<ndnSIM::
+ multi_policy_traits<boost::mpl::
+ vector2<Policy,
+ ndnSIM::lifetime_stats_policy_traits>>>
+ super;
typedef typename super::policy_container::template index<1>::type lifetime_stats_container;
- ContentStoreWithStats ()
+ ContentStoreWithStats()
{
// connect traceback to the policy
- super::getPolicy ().template get<1> ().set_traced_callback (&m_willRemoveEntry);
+ super::getPolicy().template get<1>().set_traced_callback(&m_willRemoveEntry);
}
static TypeId
- GetTypeId ();
+ GetTypeId();
virtual inline void
- Print (std::ostream &os) const;
+ Print(std::ostream& os) const;
private:
static LogComponent g_log; ///< @brief Logging variable
- /// @brief trace of for entry removal: first parameter is pointer to the CS entry, second is how long entry was in the cache
- TracedCallback< Ptr<const Entry>, Time > m_willRemoveEntry;
+ /// @brief trace of for entry removal: first parameter is pointer to the CS entry, second is how
+ /// long entry was in the cache
+ TracedCallback<Ptr<const Entry>, Time> m_willRemoveEntry;
};
//////////////////////////////////////////
////////// Implementation ////////////////
//////////////////////////////////////////
-
template<class Policy>
-LogComponent
-ContentStoreWithStats< Policy >::g_log = LogComponent (("ndn.cs.Stats." + Policy::GetName ()).c_str ());
-
+LogComponent ContentStoreWithStats<Policy>::g_log = LogComponent(("ndn.cs.Stats."
+ + Policy::GetName()).c_str());
template<class Policy>
TypeId
-ContentStoreWithStats< Policy >::GetTypeId ()
+ContentStoreWithStats<Policy>::GetTypeId()
{
- static TypeId tid = TypeId (("ns3::ndn::cs::Stats::"+Policy::GetName ()).c_str ())
- .SetGroupName ("Ndn")
- .SetParent<super> ()
- .template AddConstructor< ContentStoreWithStats< Policy > > ()
+ static TypeId tid =
+ TypeId(("ns3::ndn::cs::Stats::" + Policy::GetName()).c_str())
+ .SetGroupName("Ndn")
+ .SetParent<super>()
+ .template AddConstructor<ContentStoreWithStats<Policy>>()
- .AddTraceSource ("WillRemoveEntry", "Trace called just before content store entry will be removed",
- MakeTraceSourceAccessor (&ContentStoreWithStats< Policy >::m_willRemoveEntry))
+ .AddTraceSource("WillRemoveEntry",
+ "Trace called just before content store entry will be removed",
+ MakeTraceSourceAccessor(&ContentStoreWithStats<Policy>::m_willRemoveEntry))
// trace stuff here
;
@@ -94,21 +102,18 @@
template<class Policy>
void
-ContentStoreWithStats< Policy >::Print (std::ostream &os) const
+ContentStoreWithStats<Policy>::Print(std::ostream& os) const
{
- // const freshness_policy_container &freshness = this->getPolicy ().template get<freshness_policy_container> ();
+ // const freshness_policy_container &freshness = this->getPolicy ().template
+ // get<freshness_policy_container> ();
- for (typename super::policy_container::const_iterator item = this->getPolicy ().begin ();
- item != this->getPolicy ().end ();
- item++)
- {
- Time alive = lifetime_stats_container::policy_base::get_time (&(*item)) - Simulator::Now ();
- os << item->payload ()->GetName () << "(alive: " << alive.ToDouble (Time::S) << "s)" << std::endl;
- }
+ for (typename super::policy_container::const_iterator item = this->getPolicy().begin();
+ item != this->getPolicy().end(); item++) {
+ Time alive = lifetime_stats_container::policy_base::get_time(&(*item)) - Simulator::Now();
+ os << item->payload()->GetName() << "(alive: " << alive.ToDouble(Time::S) << "s)" << std::endl;
+ }
}
-
-
} // namespace cs
} // namespace ndn
} // namespace ns3