Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Statistics.cti

Go to the documentation of this file.
00001 // $Id: Statistics.cti 1751 2010-11-22 15:11:15Z jmo $
00002 //
00003 // Copyright (C) 2009
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Stefan Bund <g0dil@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00026 //#include "Statistics.ih"
00027 
00028 // Custom includes
00029 
00030 #define prefix_ inline
00031 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00032 
00033 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00034 // senf::StatisticsBase::OutputProxy
00035 
00036 template <class Owner>
00037 prefix_ senf::StatisticsBase::OutputProxy<Owner>::OutputProxy(Owner * owner, OutputEntry * entry)
00038     : owner_ (owner), entry_ (entry)
00039 {}
00040 
00041 template <class Owner>
00042 template <class OtherOwner>
00043 prefix_ senf::StatisticsBase::OutputProxy<Owner>::
00044 OutputProxy(Owner * owner, OutputProxy<OtherOwner> const & other)
00045     : owner_ (owner), entry_ (other.entry_)
00046 {}
00047 
00048 template <class Owner>
00049 template <class Target>
00050 prefix_ Owner & senf::StatisticsBase::OutputProxy<Owner>::connect(Target & target, std::string label)
00051     const
00052 {
00053     if (label.empty())
00054         label = prettyName(typeid(Target));
00055     entry_->signal.connect(boost::ref(target));
00056     entry_->targets_.push_back(new OutputEntry::Target<Target>(label));
00057     return * owner_;
00058 }
00059 
00060 template <class Owner>
00061 template <class PTarget>
00062 prefix_ Owner &
00063 senf::StatisticsBase::OutputProxy<Owner>::connect(std::auto_ptr<PTarget> target, std::string label)
00064     const
00065 {
00066     if (label.empty())
00067         label = prettyName(typeid(PTarget));
00068     PTarget * targetp (target.get());
00069     entry_->targets_.push_back(new OutputEntry::Target<PTarget>(target,label));
00070     entry_->signal.connect(boost::ref(*targetp));
00071     return * owner_;
00072 }
00073 
00074 template <class Owner>
00075 prefix_ Owner & senf::StatisticsBase::OutputProxy<Owner>::noconnect()
00076     const
00077 {
00078     return * owner_;
00079 }
00080 
00081 template <class Owner>
00082 prefix_ senf::console::ScopedDirectory<> & senf::StatisticsBase::OutputProxy<Owner>::dir()
00083     const
00084 {
00085     return entry_->dir;
00086 }
00087 
00089 // senf::Statistics
00090 
00091 template <class Value>
00092 prefix_ void senf::Statistics::operator()(unsigned n, StatisticAccumulator<Value> & sa)
00093 {
00094     enter(n, float(sa.min()), sa.avg(), float(sa.max()), sa.stddev());
00095     sa.clear();
00096 }
00097 
00098 
00099 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00100 #undef prefix_
00101 
00102 
00103 // Local Variables:
00104 // mode: c++
00105 // fill-column: 100
00106 // comment-column: 40
00107 // c-file-style: "senf"
00108 // indent-tabs-mode: nil
00109 // ispell-local-dictionary: "american"
00110 // compile-command: "scons -u test"
00111 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research