1 /* 2 [auto_generated] 3 boost/numeric/odeint/integrate/observer_collection.hpp 4 5 [begin_description] 6 Collection of observers, which are all called during the evolution of the ODE. 7 [end_description] 8 9 Copyright 2009-2011 Karsten Ahnert 10 Copyright 2009-2011 Mario Mulansky 11 12 Distributed under the Boost Software License, Version 1.0. 13 (See accompanying file LICENSE_1_0.txt or 14 copy at http://www.boost.org/LICENSE_1_0.txt) 15 */ 16 17 18 #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED 19 #define BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED 20 21 #include <vector> 22 23 #include <boost/function.hpp> 24 25 namespace boost { 26 namespace numeric { 27 namespace odeint { 28 29 template< class State , class Time > 30 class observer_collection 31 { 32 public: 33 34 typedef boost::function< void( const State& , const Time& ) > observer_type; 35 typedef std::vector< observer_type > collection_type; 36 operator ()(const State & x,Time t)37 void operator()( const State& x , Time t ) 38 { 39 for( size_t i=0 ; i<m_observers.size() ; ++i ) 40 m_observers[i]( x , t ); 41 } 42 observers(void)43 collection_type& observers( void ) { return m_observers; } observers(void) const44 const collection_type& observers( void ) const { return m_observers; } 45 46 private: 47 48 collection_type m_observers; 49 }; 50 51 } // namespace odeint 52 } // namespace numeric 53 } // namespace boost 54 55 56 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_OBSERVER_COLLECTION_HPP_INCLUDED 57