std C/C++ patch #7

David Scott Page page at cs.utexas.edu
Fri Apr 26 11:40:25 EDT 2002


Hi,

This patch gives three nested classes legitimate access to the private
parts of their nesting class (!Java).

There are a few (about four) more issues that I'm not quite sure how
to patch in a clean manner, so I will probably just post the problems
and see what you think.

--
Scott Page

-------------------------------- 8< ---------------------------------
diff -Naur click-stdC++.6/elements/ip/ipratemon.hh click-stdC++.7/elements/ip/ipratemon.hh
--- click-stdC++.6/elements/ip/ipratemon.hh	Wed Apr 24 16:39:17 2002
+++ click-stdC++.7/elements/ip/ipratemon.hh	Fri Apr 26 15:28:02 2002
@@ -96,9 +96,13 @@
 
 private:
 
-  typedef RateEWMAX<5, 10, 2, IPRateMonitor_HalfSecondsTimer> MyEWMA;
-  
+  struct Counter;
+  friend Counter;
   struct Stats;
+  friend Stats;
+
+  typedef RateEWMAX<5, 10, 2, IPRateMonitor_HalfSecondsTimer> MyEWMA;
+
   struct Counter {
     // fwd_and_rev_rate.average[0] is forward rate
     // fwd_and_rev_rate.average[1] is reverse rate
@@ -124,7 +128,6 @@
 protected:
   
   // HACK! Functions for interaction between fold() and ~Stats()
-  friend struct Stats;
   void set_prev(Stats *s)                       { _prev_deleted = s; }
   void set_next(Stats *s)                       { _next_deleted = s; }
   void set_first(Stats *s)                      { _first = s; }
diff -Naur click-stdC++.6/elements/standard/stridesched.hh click-stdC++.7/elements/standard/stridesched.hh
--- click-stdC++.6/elements/standard/stridesched.hh	Wed Apr 24 16:39:19 2002
+++ click-stdC++.7/elements/standard/stridesched.hh	Fri Apr 26 15:21:05 2002
@@ -53,7 +53,8 @@
     void stride();
 
   };
-  
+  friend Client;
+
   Client *_list;
 
  public:




More information about the click mailing list