reverted changes in Statistics.[hh][cci] from rev.1829 to anable
pug [Tue, 29 Nov 2011 13:09:59 +0000 (13:09 +0000)]
callbacks.

git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1832 270642c3-0616-0410-b53a-bc976706d245

senf/Utils/Statistics.cci
senf/Utils/Statistics.hh

index 8842ac5..8e7b093 100644 (file)
 //-/////////////////////////////////////////////////////////////////////////////////////////////////
 
 //-/////////////////////////////////////////////////////////////////////////////////////////////////
+// senf::StatisticsBase::Transform
+
+prefix_ senf::StatisticsBase::Transform::result_type
+senf::StatisticsBase::Transform::operator()(first_argument_type i)
+    const
+{
+    return i.second;
+}
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
 // senf::StatisticsBase::OutputEntry
 
 prefix_ senf::StatisticsBase::OutputEntry::OutputEntry()
@@ -88,13 +98,7 @@ prefix_ senf::StatisticsBase::~StatisticsBase()
 
 prefix_ senf::StatisticsBase::CollectorRange senf::StatisticsBase::collectors()
 {
-    return senf::make_transform_range(children_,__gnu_cxx::select2nd<Children::value_type>());
-}
-
-prefix_ senf::StatisticsBase::const_CollectorRange senf::StatisticsBase::collectors()
-    const
-{
-    return senf::make_transform_range(children_,__gnu_cxx::select2nd<Children::value_type>());
+    return senf::make_transform_range(children_, Transform());
 }
 
 prefix_ float senf::StatisticsBase::min()
@@ -132,12 +136,6 @@ prefix_ senf::Statistics & senf::StatisticsBase::base()
     return v_base();
 }
 
-prefix_ senf::Statistics const & senf::StatisticsBase::base()
-    const
-{
-    return const_cast<StatisticsBase *>(this)->v_base();
-}
-
 prefix_ std::string senf::StatisticsBase::path()
     const
 {
@@ -145,7 +143,6 @@ prefix_ std::string senf::StatisticsBase::path()
 }
 
 prefix_ senf::StatisticsData senf::StatisticsBase::data()
-    const
 {
     return StatisticsData(min_, avg_, max_, dev_, 0);
 }
index 0e79361..cdea0da 100644 (file)
@@ -74,10 +74,13 @@ namespace senf {
     {
         typedef std::map<unsigned, Collector> Children;
 
-        typedef boost::transform_iterator< ::__gnu_cxx::select2nd<Children::value_type>,
-                Children::iterator > collector_iterator;
-        typedef boost::transform_iterator< ::__gnu_cxx::select2nd<Children::value_type>,
-                Children::const_iterator > collector_const_iterator;
+        struct Transform {
+            typedef Children::value_type & first_argument_type;
+            typedef Collector & result_type;
+            result_type operator()(first_argument_type i) const;
+        };
+
+        typedef boost::transform_iterator<Transform,Children::iterator> ValueIterator;
 
         struct OutputEntry;
 
@@ -85,8 +88,7 @@ namespace senf {
         //-////////////////////////////////////////////////////////////////////////
         // Types
 
-        typedef boost::iterator_range<collector_iterator> CollectorRange;
-        typedef boost::iterator_range<collector_const_iterator> const_CollectorRange;
+        typedef boost::iterator_range<ValueIterator> CollectorRange;
 
         /** \brief Output connection interface
 
@@ -188,10 +190,6 @@ namespace senf {
         CollectorRange collectors();    ///< List all child collectors
                                         /**< \returns iterator range of child collector
                                              references */
-        const_CollectorRange collectors() const;
-                                        ///< List all child collectors
-                                        /**< \returns const iterator range of child collector
-                                             references */
 
         Collector & collect(unsigned rank); ///< Register a new collector
                                         /**< Adds a collector collecting \a rank values into each
@@ -201,11 +199,6 @@ namespace senf {
                                              \throws DuplicateRankException if a collector
                                                  collecting \a rank values already exists. */
 
-        Statistics const & base() const; ///< Get const base statistics object
-                                        /**< Returns the base statistics object as const reference.
-                                             If this is a child collector, this will return the outermost
-                                             statistics object, otherwise it will return
-                                             \c *this. */
         Statistics & base();            ///< Get base statistics object
                                         /**< Returns the base statistics object. If this is
                                              a child collector, this will return the outermost
@@ -236,9 +229,10 @@ namespace senf {
                                              \param[in] n size of sliding average window */
 
         //\}
-        StatisticsData data() const;    ///< Get the Statistics data as senf::StatisticsData
-                                        /**< Return a Statistic Data object containing values
-                                             from this instance. */
+        StatisticsData data();      ///< Get the Statistics data as senf::StatisticsData
+                                    /**< Return a Statistic Data object containing values
+                                         from this instance.
+                                     */
 
 
         //-////////////////////////////////////////////////////////////////////////