CXXFLAGS = [ '-Wall', '-Woverloaded-virtual', '-Wno-long-long', '$INLINE_OPTS',
'-pipe', '$CXXFLAGS_', '-fno-strict-aliasing',
"${profile and '-pg' or None}" ],
- CXXFLAGS_final = [ '-O3', '-fno-threadsafe-statics' ],
+ CXXFLAGS_final = [ '-O3', '-fno-threadsafe-statics','-fno-stack-protector',
+ '-ffunction-sections' ],
CXXFLAGS_normal = [ '-O2', '-g' ],
CXXFLAGS_debug = [ '-O0', '-g' ],
CPPDEFINES = [ '$expandLogOption', '$CPPDEFINES_' ],
- CPPDEFINES_final = [ 'SENF_PPI_NOTRACE', 'BOOST_NO_MT', 'NDEBUG', 'BOOST_DISABLE_ASSERTS', 'BOOST_DISABLE_THREADS' ],
+ CPPDEFINES_final = [ 'SENF_PPI_NOTRACE', 'NDEBUG',
+ 'BOOST_NO_MT', 'BOOST_DISABLE_ASSERTS', 'BOOST_DISABLE_THREADS' ],
CPPDEFINES_normal = [ 'SENF_DEBUG' ],
CPPDEFINES_debug = [ '$CPPDEFINES_normal' ],
LINKFLAGS = [ '-rdynamic', '$LINKFLAGS_', "${profile and '-pg' or None}" ],
- LINKFLAGS_final = [ ],
+ LINKFLAGS_final = [ '-Wl,--gc-sections' ],
LINKFLAGS_normal = [ '-Wl,-S' ],
LINKFLAGS_debug = [ '-g' ],
)
#include "Module.ih"
// Custom includes
+#include "Events.hh"
+#include "Connectors.hh"
//#include "Module.mpp"
#define prefix_
// senf::ppi::module::Module
//-/////////////////////////////////////////////////////////////////////////////////////////////////
+// public members
+
+#ifdef DOXYGEN
+
+prefix_ senf::ppi::Route<connector::InputConnector, connector::OutputConnector> &
+senf::ppi::module::Module::route(connector::InputConnector & input,
+ connector::OutputConnector & output)
+{}
+prefix_ senf::ppi::Route<connector::InputConnector, EventDescriptor> &
+senf::ppi::module::Module::route(connector::InputConnector & input, EventDescriptor & output)
+{}
+
+prefix_ senf::ppi::RouteRoute<connector::EventDescriptor, connector::OutputConnector> &
+senf::ppi::module::Module::route(EventDescriptor & input, connector::OutputConnector & output);
+
+#else
+
+#define route_impl( Source, Target ) \
+ prefix_ senf::ppi::Route<senf::ppi::Source, senf::ppi::Target> & \
+ senf::ppi::module::Module::route(Source & source, Target & target) \
+ { \
+ detail::RouteHelper<Source,Target>::route(*this, source, target, source, target); \
+ return static_cast< Route<Source,Target> & >( \
+ addRoute(std::auto_ptr< RouteBase >( \
+ new Route<Source,Target>(*this, source, target)))); \
+ }
+
+route_impl( connector::GenericPassiveInput, connector::GenericActiveOutput);
+route_impl( connector::GenericActiveInput, connector::GenericPassiveOutput);
+route_impl( connector::GenericActiveInput, connector::GenericActiveOutput);
+route_impl( connector::GenericPassiveInput, connector::GenericPassiveOutput);
+route_impl( connector::GenericPassiveInput, EventDescriptor);
+route_impl( connector::GenericActiveInput, EventDescriptor);
+route_impl( EventDescriptor, connector::GenericPassiveOutput);
+route_impl( EventDescriptor, connector::GenericActiveOutput);
+
+#undef route_impl
+
+#endif
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
// private members
prefix_ void senf::ppi::module::Module::registerConnector(connector::Connector & connector)
#ifndef DOXYGEN
-template <class Source, class Target>
-prefix_ senf::ppi::Route<Source, Target> &
-senf::ppi::module::Module::route(Source & source, Target & target)
-{
- detail::RouteHelper<Source,Target>::route(*this, source, target, source, target);
- return static_cast< Route<Source,Target> & >(
- addRoute(std::auto_ptr< RouteBase >(
- new Route<Source,Target>(*this, source, target))));
-}
-
-#else
-prefix_ senf::ppi::Route<connector::InputConnector, connector::OutputConnector> &
-senf::ppi::module::Module::route(connector::InputConnector & input,
- connector::OutputConnector & output)
-{}
-prefix_ senf::ppi::Route<connector::InputConnector, EventDescriptor> &
-senf::ppi::module::Module::route(connector::InputConnector & input, EventDescriptor & output)
-{}
-#endif
-
-#ifndef DOXYGEN
-
template <class Descriptor, class Target>
prefix_ void senf::ppi::module::Module::registerEvent(Descriptor & descriptor, Target target)
{
protected:
Module();
-#ifndef DOXYGEN
- template <class Source, class Target>
- Route<Source, Target> & route(Source & source, Target & target);
-#else
+#ifdef DOXYGEN
Route<connector::InputConnector, connector::OutputConnector> &
route(connector::InputConnector & input, connector::OutputConnector & output);
///< Define flow information
\param[in] output Data target, object which controls
outgoing data (connector or event)
\returns Route instance describing this route
- \see \ref ppi_throttling
- \note The real implementation is not provided by three
- overloads but by a single template member */
+ \see \ref ppi_throttling */
Route<connector::InputConnector, EventDescriptor> &
route(connector::InputConnector & input, EventDescriptor & output);
enable/disable the event on throttling notifications.
\see \ref route() */
+#else
+# define route_decl(Source, Target) \
+ Route<Source, Target> & \
+ route(Source & source, Target & target);
+
+ route_decl( connector::GenericPassiveInput, connector::GenericActiveOutput);
+ route_decl( connector::GenericPassiveInput, connector::GenericPassiveOutput);
+ route_decl( connector::GenericActiveInput, connector::GenericPassiveOutput);
+ route_decl( connector::GenericActiveInput, connector::GenericActiveOutput);
+ route_decl( connector::GenericPassiveInput, EventDescriptor);
+ route_decl( connector::GenericActiveInput, EventDescriptor);
+ route_decl( EventDescriptor, connector::GenericPassiveOutput);
+ route_decl( EventDescriptor, connector::GenericActiveOutput);
+
+#undef Route_decl
#endif
void noroute(connector::Connector & connector); ///< Define terminal connectors
public:
virtual ~RouteBase();
+ bool hasConnector(connector::Connector const & conn) const;
+ ///< \c true, if route has connector \a conn
+ bool hasEvent(EventDescriptor const & event) const;
+ ///< \c true, if route has event \a event
+
+ protected:
+ RouteBase(module::Module & module);
+
#ifdef DOXYGEN
Source & source() const; ///< Routing source
/**< \note The real implementation is in the \c
class is internal and not documented. */
#endif
- bool hasConnector(connector::Connector const & conn) const;
- ///< \c true, if route has connector \a conn
- bool hasEvent(EventDescriptor const & event) const;
- ///< \c true, if route has event \a event
-
- protected:
- RouteBase(module::Module & module);
-
private:
virtual bool v_hasConnector(connector::Connector const & conn) const = 0;
virtual bool v_hasEvent(EventDescriptor const & event) const = 0;
};
// The RoutingTraits give routing related information about the argument type:
- // - Wether the type is a notifySource or notifyTarget
- // - Wether the type is dataSource or dataTarget
+ // - Whether the type is a notifySource or notifyTarget
+ // - Whether the type is dataSource or dataTarget
// - Provide the generalized target type
//
// The real implementation is in RoutingTraitsImplementation which is appropriately specialized
class BaseRouteImplementation
: public Base
{
- public:
+ protected:
typedef Source source_type;
typedef Target target_type;
Source & source() const;
Target & target() const;
- protected:
BaseRouteImplementation(module::Module & module, Source & source, Target & target);
private:
// This helper class finds the base-class suitable for a specific route. Routes are classified
// into two groups:
// 1) A forwarding routes is a routed which forwards notifications from a notifySource to a
- // notifyTarget. Forwarding routes are implemneted using ForwardingRouteImplementation
+ // notifyTarget. Forwarding routes are implemented using ForwardingRouteImplementation
// 2) Non-forwarding routes don't forward notifications. They are implemented directly
// using BaseRouteImplementation
template <class Source, class Target>
//-/////////////////////////////////////////////////////////////////////////////////////////////////
// Offset table management
+senf::RadiotapPacketParser::OffsetMap senf::RadiotapPacketParser::offsetMap_;
+
prefix_ senf::RadiotapPacketParser::OffsetTable &
senf::RadiotapPacketParser::offsetTable(boost::uint32_t presentFlags)
{
- typedef std::map<boost::uint32_t, OffsetTable> OffsetMap;
- static OffsetMap offsetMap;
-
- OffsetMap::iterator i (offsetMap.find(presentFlags));
- if (i == offsetMap.end())
- i = offsetMap.insert(std::make_pair(presentFlags, OffsetTable())).first;
+ OffsetMap::iterator i (offsetMap_.find(presentFlags));
+ if (i == offsetMap_.end())
+ i = offsetMap_.insert(std::make_pair(presentFlags, OffsetTable())).first;
return i->second;
}
static const size_type fixed_bytes = 0; // hide this member, just in case
typedef boost::array<size_type,MAX_INDEX+2> OffsetTable;
+ typedef std::map<boost::uint32_t, OffsetTable> OffsetMap;
//-////////////////////////////////////////////////////////////////////////
// Offset table handling
void updatePresentFlags(boost::uint32_t flags);
void insertRemoveBytes(unsigned from, unsigned to, int bytes);
+ static OffsetMap offsetMap_;
OffsetTable const * currentTable_;
friend class RadiotapPacketType;
};
- struct MIHMessageRegistry_EntryBase {
+ struct MIHMessageRegistry_EntryBase
+ : private boost::noncopyable
+ {
virtual ~MIHMessageRegistry_EntryBase() {}
virtual void validate(senf::Packet message) const = 0;
};
realAux_ -= std::distance(i, e);
c.data().erase(i, e); //delete padding
e = i; //set end iterator
- } else{
+ } else {
++n_;
std::advance(i, elByte);
}
unsigned int padBytes = 0;
if (realAux_ == 0) //if list is empty, 6 padding bytes required!
padBytes = 6;
- else{
+ else {
padBytes = ( (realAux_+2) % 8);
if (padBytes != 0)
padBytes = 8 - padBytes;
struct FdSetTag;
typedef boost::intrusive::iset_base_hook<FdSetTag> FdSetBase;
struct FdSetCompare;
- struct FindFd;
class FdDispatcher;
class FileDispatcher;
}
int signaledEvents_;
friend class detail::FdSetCompare;
- friend class detail::FindFd;
friend class detail::FdDispatcher;
friend class detail::FileDispatcher;
};
{ return a.fd_ < b.fd_; }
};
- struct FindFd {
- bool operator()(FdEvent const & a, int b) const
- { return a.fd_ < b; }
- bool operator()(int a, FdEvent const & b) const
- { return a < b.fd_; }
- };
-
class FdDispatcher
: public senf::singleton<FdDispatcher>
{
{
// insert new entry or replace the timeout of an entry already indexed
typename EntrySetById_t::iterator i = entrySetById.find(id);
- if(i == entrySetById.end())
+ if (i == entrySetById.end())
entrySetByTimeout.insert( Entry(timeout, id, cb));
- else{
+ else {
Entry tmp = *i;
tmp.timeout = timeout;
entrySetById.replace(i,tmp);
\brief Node non-inline non-template implementation */
#include "Node.hh"
-#include "Node.ih"
// Custom includes
#include <senf/Utils/Range.hh>
}
//-/////////////////////////////////////////////////////////////////////////////////////////////////
-// senf::console::detail::NodeTraverser
-#ifndef DOXYGEN
-
-prefix_ void senf::console::detail::NodeTraverser::operator()(std::string const & name)
-{
- if (! init_) {
- init_ = true;
- if (name == std::string("")) {
- dir_ = root_.thisptr();
- return;
- }
- }
- if (! elt_.empty()) {
- if (elt_ == "..") {
- dir_ = dir_->parent();
- if (! dir_ || ! dir_->isChildOf(root_))
- dir_ = root_.thisptr();
- }
- else if (elt_ != "" && elt_ != ".") {
- if (! dir_->hasChild(elt_) && autocomplete_) {
- DirectoryNode::ChildrenRange completions (dir_->completions(elt_));
- if (has_one_elt(completions))
- elt_ = completions.begin()->first;
- }
- // Why does g++ give an error on this line ???? :
- // dir = dynamic_cast<DirectoryNode&>( dir->get(name) ).thisptr();
- DirectoryNode & d (dynamic_cast<DirectoryNode&>( dir_->get(elt_) ));
- dir_ = d.thisptr();
- }
- }
- elt_ = name;
-}
-
-prefix_ senf::console::GenericNode & senf::console::detail::NodeTraverser::node()
-{
- if (elt_ != "" && elt_ != ".") {
- if (! dir_->hasChild(elt_) && autocomplete_) {
- DirectoryNode::ChildrenRange completions (dir_->completions(elt_));
- if (has_one_elt(completions))
- elt_ = completions.begin()->first;
- }
- return dir_->get(elt_);
- }
- else
- return * dir_;
-}
-#endif
-
-//-/////////////////////////////////////////////////////////////////////////////////////////////////
// senf::console::SimpleCommandNode
prefix_ void senf::console::SimpleCommandNode::v_help(std::ostream & output)
/** \file
\brief Node inline non-template implementation */
-#include "Node.ih"
-
// Custom includes
#define prefix_ inline
}
//-/////////////////////////////////////////////////////////////////////////////////////////////////
-// senf::console::detail::NodeTraverser
-#ifndef DOXYGEN
-
-prefix_ senf::console::detail::NodeTraverser::NodeTraverser(DirectoryNode & root,
- DirectoryNode & dir,
- bool autocomplete)
- : root_ (root), dir_ (dir.thisptr()), autocomplete_ (autocomplete), init_ (false)
-{}
-
-#endif
-
-//-/////////////////////////////////////////////////////////////////////////////////////////////////
// senf::console::CommandNode
prefix_ senf::console::CommandNode::ptr senf::console::CommandNode::thisptr()
/** \file
\brief Node inline template implementation */
-#include "Node.ih"
-
// Custom includes
#define prefix_ inline
+++ /dev/null
-// $Id$
-//
-// Copyright (C) 2008
-// Fraunhofer Institute for Open Communication Systems (FOKUS)
-//
-// The contents of this file are subject to the Fraunhofer FOKUS Public License
-// Version 1.0 (the "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// http://senf.berlios.de/license.html
-//
-// The Fraunhofer FOKUS Public License Version 1.0 is based on,
-// but modifies the Mozilla Public License Version 1.1.
-// See the full license text for the amendments.
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the License.
-//
-// The Original Code is Fraunhofer FOKUS code.
-//
-// The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
-// (registered association), Hansastraße 27 c, 80686 Munich, Germany.
-// All Rights Reserved.
-//
-// Contributor(s):
-// Stefan Bund <g0dil@berlios.de>
-
-/** \file
- \brief Node internal header */
-
-#ifndef IH_SENF_Scheduler_Console_Node_
-#define IH_SENF_Scheduler_Console_Node_ 1
-
-// Custom includes
-
-//-/////////////////////////////////////////////////////////////////////////////////////////////////
-
-namespace senf {
-namespace console {
-namespace detail {
-
-#ifndef DOXYGEN
-
- class NodeTraverser
- {
- public:
- NodeTraverser(DirectoryNode & root, DirectoryNode & dir, bool autocomplete);
-
- void operator()(std::string const & name);
-
- GenericNode & node();
-
- private:
- DirectoryNode & root_;
- DirectoryNode::ptr dir_;
- bool autocomplete_;
- std::string elt_;
- bool init_;
- };
-
-#endif
-
-}}}
-
-//-/////////////////////////////////////////////////////////////////////////////////////////////////
-#endif
-
-\f
-// Local Variables:
-// mode: c++
-// fill-column: 100
-// comment-column: 40
-// c-file-style: "senf"
-// indent-tabs-mode: nil
-// ispell-local-dictionary: "american"
-// compile-command: "scons -u test"
-// End:
namespace {
senf::console::SysInfo::Proxy addSysInfo (
"SENF: The Simple and Extensible Network Framework\n"
- " © 2006-2011 Fraunhofer Institute for Open Communication Systems, Network Research\n"
+ " (c) 2006-2011 Fraunhofer Institute for Open Communication Systems (FOKUS)\n"
" Contact: senf-dev@lists.berlios.de\n"
" Version: " SENF_LIB_VERSION " Revision number: " SENF_REVISION "\n"
" Build-type: " BUILD_TYPE ", SenfLog compile time limit: " +
prefix_ void senf::console::detail::NoninteractiveClientReader::v_write(std::string const & data)
{
- if( sendQueue_.size() > streamBufferMaxSize_)
+ if (sendQueue_.size() > streamBufferMaxSize_)
return;
sendQueue_.insert( sendQueue_.end(), data.begin(), data.end());
writeHandler(scheduler::FdEvent::EV_WRITE);
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/format.hpp>
+#include <boost/bind.hpp>
#include <senf/Utils/Exception.hh>
#include <senf/Utils/membind.hh>
#include <senf/Utils/Backtrace.hh>
//-/////////////////////////////////////////////////////////////////////////////////////////////////
// senf::detail::DaemonWatcher::Forwarder
+prefix_ senf::detail::DaemonWatcher::Forwarder::Target::Target(Forwarder & fwd, int fd_)
+ : fd (fd_), offset (0),
+ writeevent ("senf::detail::DaemonWatcher::Forwarder::Target::writeevent",
+ boost::bind(&Forwarder::writeData, &fwd, _1, this),
+ fd, scheduler::FdEvent::EV_WRITE, false)
+{}
+
prefix_ senf::detail::DaemonWatcher::Forwarder::Forwarder(int src, Callback cb)
: src_(src), cb_(cb),
readevent_("senf::detail::DaemonWatcher::Forwarder::readevent", senf::membind(&Forwarder::readData, this),
+++ /dev/null
-// $Id$
-//
-// Copyright (C) 2008
-// Fraunhofer Institute for Open Communication Systems (FOKUS)
-//
-// The contents of this file are subject to the Fraunhofer FOKUS Public License
-// Version 1.0 (the "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-// http://senf.berlios.de/license.html
-//
-// The Fraunhofer FOKUS Public License Version 1.0 is based on,
-// but modifies the Mozilla Public License Version 1.1.
-// See the full license text for the amendments.
-//
-// Software distributed under the License is distributed on an "AS IS" basis,
-// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-// for the specific language governing rights and limitations under the License.
-//
-// The Original Code is Fraunhofer FOKUS code.
-//
-// The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
-// (registered association), Hansastraße 27 c, 80686 Munich, Germany.
-// All Rights Reserved.
-//
-// Contributor(s):
-// Stefan Bund <g0dil@berlios.de>
-
-/** \file
- \brief Daemon inline non-template implementation */
-
-#include "Daemon.ih"
-
-// Custom includes
-#include <boost/bind.hpp>
-
-#define prefix_ inline
-//-/////////////////////////////////////////////////////////////////////////////////////////////////
-
-prefix_ senf::detail::DaemonWatcher::Forwarder::Target::Target(Forwarder & fwd, int fd_)
- : fd (fd_), offset (0),
- writeevent ("senf::detail::DaemonWatcher::Forwarder::Target::writeevent",
- boost::bind(&Forwarder::writeData, &fwd, _1, this),
- fd, scheduler::FdEvent::EV_WRITE, false)
-{}
-
-//-/////////////////////////////////////////////////////////////////////////////////////////////////
-#undef prefix_
-
-\f
-// Local Variables:
-// mode: c++
-// fill-column: 100
-// comment-column: 40
-// c-file-style: "senf"
-// indent-tabs-mode: nil
-// ispell-local-dictionary: "american"
-// compile-command: "scons -u test"
-// End:
}
//-/////////////////////////////////////////////////////////////////////////////////////////////////
-#include "Daemon.cci"
+//#include "Daemon.cci"
//#include "Daemon.ct"
//#include "Daemon.cti"
#endif
// All Rights Reserved.
//
// Contributor(s):
-// Stefan Bund <g0dil@berlios.de>
+// Mathias Kretschmer <mtk@berlios.de>
+// Jens Moedeker <jmo@berlios.de>
#include "StatisticAccumulator.hh"
+// Custom includes
+
+#define prefix_
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+
std::ostream & senf::operator<<(std::ostream & os, senf::StatisticsData const & _data)
- {
- format::IndentHelper indent;
- os << indent << "StatisticData:" << std::endl;
- os << indent << "min: " << _data.min << std::endl;
- os << indent << "avg: " << _data.avg << std::endl;
- os << indent << "max: " << _data.max << std::endl;
- os << indent << "stddev: " << _data.stddev << std::endl;
- os << indent << "count: " << _data.count << std::endl;
- return os;
- };
+{
+ format::IndentHelper indent;
+ os << indent << "StatisticData:" << std::endl
+ << indent << "min: " << _data.min << std::endl
+ << indent << "avg: " << _data.avg << std::endl
+ << indent << "max: " << _data.max << std::endl
+ << indent << "stddev: " << _data.stddev << std::endl
+ << indent << "count: " << _data.count << std::endl;
+ return os;
+};
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+#undef prefix_
// All Rights Reserved.
//
// Contributor(s):
-// Thorsten Horstmann <tho@berlios.de>
+// Mathias Kretschmer <mtk@berlios.de>
+// Jens Moedeker <jmo@berlios.de>
+
/** \file
\brief StatisticAccumulator non-inline template implementation */
// senf::StatisticAccumulator<T>
template <class T>
-prefix_ senf::StatisticAccumulator<T>::StatisticAccumulator( )
- : sum_squared_(0),
- sum_(0),
- min_(0),
- max_(0),
- last_avg_(0),
- count_(0)
-{
-}
-
-//template <class T>
-//prefix_ senf::StatisticAccumulator<T>::~StatisticAccumulator()
-//{ }
+prefix_ senf::StatisticAccumulator<T>::StatisticAccumulator()
+ : sum_squared_(0), sum_(0), min_(0), max_(0), last_avg_(0), count_(0)
+{ }
template <class T>
prefix_ float senf::StatisticAccumulator<T>::stddev()
template <class T>
prefix_ void senf::StatisticAccumulator<T>::clear()
{
- if( count_ > 0){
- last_avg_ = avg();
- count_ = 0;
- sum_squared_ = 0;
- sum_ = min_ = max_ = 0;
+ if (count_ > 0) {
+ last_avg_ = avg();
+ count_ = 0;
+ sum_squared_ = 0;
+ sum_ = min_ = max_ = 0;
}
}
template <class T>
prefix_ void senf::StatisticAccumulator<T>::data( StatisticsData &data_) const
{
- if( count_ == 0){
- data_.min = data_.avg = data_.max = last_avg_;
- data_.stddev = 0.0;
- data_.count = 0;
+ if (count_ == 0) {
+ data_.min = data_.avg = data_.max = last_avg_;
+ data_.stddev = 0.0;
+ data_.count = 0;
+ } else {
+ data_.min = (float) min_;
+ data_.avg = avg();
+ data_.max = (float) max_;
+ data_.stddev = stddev();
+ data_.count = count_;
}
- else{
- data_.min = (float) min_;
- data_.avg = avg();
- data_.max = (float) max_;
- data_.stddev = stddev();
- data_.count = count_;
- }
}
// All Rights Reserved.
//
// Contributor(s):
-// Thorsten Horstmann <tho@berlios.de>
+// Mathias Kretschmer <mtk@berlios.de>
+// Jens Moedeker <jmo@berlios.de>
+
/** \file
\brief StatisticAccumulator inline template implementation */
return count_ == 0 ? NAN : (sum_ / float(count_));
}
-//template <class T>
-//prefix_ senf::Statistics & senf::StatisticAccumulator<T>::statistics()
-//{
-// return stats_;
-//}
-
template <class T>
prefix_ float senf::StatisticAccumulator<T>::last_avg()
const
// All Rights Reserved.
//
// Contributor(s):
-// Thorsten Horstmann <tho@berlios.de>
+// Mathias Kretschmer <mtk@berlios.de>
+// Jens Moedeker <jmo@berlios.de>
+
/** \file
\brief StatisticAccumulator public header */
{
public:
StatisticAccumulator();
-// virtual ~StatisticAccumulator();
-
- void clear();
- ///< Reset accumulated values.
- /**< This member reset all values. */
- void accumulate(T value);
- ///< Gather value to be accumulated.
- /**< This method accumulates a value.
- \param[in] value to be accumulated value*/
- void setLastAvg(T value);
- ///< If no real data was collected, this method specifies the min/avg/max value to be returned.
- /**< This method specifies the the min/avg/max value to be returned if no real data was colelcted
- \param[in] value to be returned*/
-
- public:
- T min() const;
- ///< Returns current minimal value.
- /**< This method returns the minimal value of the current accumulation.*/
- T max() const;
- ///< Returns current maximal value.
- /**< This method returns the maximal value of the current accumulation.*/
- float avg() const;
- ///< Returns average value.
- /**< This method returns the average value of the current accumulation.*/
- float last_avg() const;
- ///< Returns former average value.
- /**< This method returns the average value of the former accumulation period.*/
- float stddev() const;
- ///< Returns standard deviation value.
- /**< This method returns the standard deviation value of the current accumulation.*/
- boost::uint32_t count() const;
- ///< Returns count of accumulated values.
- /**< This method returns count of accumulated values of the current accumulation.*/
- void data( StatisticsData & data_) const;
- ///< Returns the accumulated data as a tuple
- /**< This method returns the accumulated information as a tuple.*/
+ void clear(); ///< Reset accumulated values.
+ /**< This member reset all values. */
+ void accumulate(T value); ///< Gather value to be accumulated.
+ /**< This method accumulates a value.
+ \param[in] value to be accumulated value */
+ void setLastAvg(T value); ///< If no real data was collected, this method specifies the min/avg/max value to be returned.
+ /**< This method specifies the the min/avg/max value to
+ be returned if no real data was collected
+ \param[in] value to be returned */
+
+ T min() const; ///< Returns current minimal value.
+ /**< This method returns the minimal value of the
+ current accumulation. */
+ T max() const; ///< Returns current maximal value.
+ /**< This method returns the maximal value of the
+ current accumulation.*/
+ float avg() const; ///< Returns average value.
+ /**< This method returns the average value of the
+ current accumulation.*/
+ float last_avg() const; ///< Returns former average value.
+ /**< This method returns the average value of the
+ former accumulation period.*/
+ float stddev() const; ///< Returns standard deviation value.
+ /**< This method returns the standard deviation
+ value of the current accumulation.*/
+ boost::uint32_t count() const; ///< Returns count of accumulated values.
+ /**< This method returns count of accumulated
+ values of the current accumulation.*/
+ void data(StatisticsData & data_) const;
+ ///< Returns the accumulated data as a tuple
+ /**< This method returns the accumulated information
+ as a tuple.*/
private:
T sum_squared_;
T sum_;
T max_;
float last_avg_;
boost::uint32_t count_;
-
-
};
-
- typedef StatisticAccumulator<int> StatisticAccumulatorInt;
- typedef StatisticAccumulator<float> StatisticAccumulatorFloat;
-
}
///////////////////////////////hh.e////////////////////////////////////////
//#include "StatisticAccumulator.cci"
// All Rights Reserved.
//
// Contributor(s):
-// Thorsten Horstmann <tho@berlios.de>
-/** \file
- \brief StatisticAccumulator non-inline template implementation */
+// Mathias Kretschmer <mtk@berlios.de>
+// Jens Moedeker <jmo@berlios.de>
// Custom includes
#include "auto_unit_test.hh"
#include <boost/test/test_tools.hpp>
#include <math.h>
-//#include <boost/math/special_functions/fpclassify.hpp>
#define prefix_
///////////////////////////////ct.p////////////////////////////////////////
{
senf::Statistics s;
- senf::StatisticAccumulatorInt sa;
+ senf::StatisticAccumulator<int> sa;
sa.accumulate( 5);
sa.accumulate( 3);
BOOST_CHECK_EQUAL( sa.last_avg(), 5.0);
BOOST_CHECK( ::isnan( sa.stddev()));
BOOST_CHECK_EQUAL( sa.count(), 0);
-
-
-
-
}
///////////////////////////////ct.e////////////////////////////////////////
#undef prefix_
# Set nice default options
env.Append(
CXXFLAGS = [ '-Wall', '-Woverloaded-virtual', "${profile and '-pg' or None}" ],
- CXXFLAGS_final = [ '-O3', '-fno-threadsafe-statics' ],
+ CXXFLAGS_final = [ '-O3', '-fno-threadsafe-statics', '-fno-stack-protector',
+ '-ffunction-sections' ],
CXXFLAGS_normal = [ '-O2', '-g' ],
CXXFLAGS_debug = [ '-O0', '-g' ],
LINKFLAGS = [ "${profile and '-pg' or None}" ],
+ LINKFLAGS_final = [ '-Wl,--gc-sections' ],
LINKFLAGS_normal = [ '-Wl,-S' ],
LINKFLAGS_debug = [ '-g' ],
)