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/trie/counting-policy.hpp b/utils/trie/counting-policy.hpp
index 2c8656c..a44c290 100644
--- a/utils/trie/counting-policy.hpp
+++ b/utils/trie/counting-policy.hpp
@@ -32,76 +32,75 @@
* @brief Traits for policy that just keeps track of number of elements
* It's doing a rather expensive job, but just in case it needs to be extended later
*/
-struct counting_policy_traits
-{
+struct counting_policy_traits {
/// @brief Name that can be used to identify the policy (for NS-3 object model and logging)
- static std::string GetName () { return "Counting"; }
-
- struct policy_hook_type : public boost::intrusive::list_member_hook<> {};
-
- template<class Container>
- struct container_hook
+ static std::string
+ GetName()
{
- // could be class/struct implementation
- typedef boost::intrusive::member_hook< Container,
- policy_hook_type,
- &Container::policy_hook_ > type;
+ return "Counting";
+ }
+
+ struct policy_hook_type : public boost::intrusive::list_member_hook<> {
};
- template<class Base,
- class Container,
- class Hook>
- struct policy
- {
- typedef typename boost::intrusive::list< Container, Hook > policy_container;
-
+ template<class Container>
+ struct container_hook {
+ // could be class/struct implementation
+ typedef boost::intrusive::member_hook<Container, policy_hook_type, &Container::policy_hook_>
+ type;
+ };
+
+ template<class Base, class Container, class Hook>
+ struct policy {
+ typedef typename boost::intrusive::list<Container, Hook> policy_container;
+
// could be just typedef
- class type : public policy_container
- {
+ class type : public policy_container {
public:
typedef Container parent_trie;
- type (Base &base)
- : base_ (base)
+ type(Base& base)
+ : base_(base)
{
}
inline void
- update (typename parent_trie::iterator item)
+ update(typename parent_trie::iterator item)
{
// do nothing
}
-
+
inline bool
- insert (typename parent_trie::iterator item)
+ insert(typename parent_trie::iterator item)
{
- policy_container::push_back (*item);
+ policy_container::push_back(*item);
return true;
}
-
+
inline void
- lookup (typename parent_trie::iterator item)
+ lookup(typename parent_trie::iterator item)
{
// do nothing
}
-
+
inline void
- erase (typename parent_trie::iterator item)
+ erase(typename parent_trie::iterator item)
{
- policy_container::erase (policy_container::s_iterator_to (*item));
+ policy_container::erase(policy_container::s_iterator_to(*item));
}
inline void
- clear ()
+ clear()
{
- policy_container::clear ();
+ policy_container::clear();
}
private:
- type () : base_(*((Base*)0)) { };
+ type()
+ : base_(*((Base*)0)){};
private:
- Base &base_;
+ Base& base_;
};
};
};