CVSROOT: /sources/gnash Module name: gnash Changes by: Eric Hughes <eh9> 07/10/16 20:20:30
Modified files: cygnal/ACT : Change_Log.txt Handle.hpp Listen.hpp Makefile.am Scheduler.T.cpp Scheduler.hpp Scheduling_Queue.cpp Service.hpp cygnal/ACT/test_support: Action_Tracing.hpp Listening_Actions.cpp Listening_Actions.hpp Simple_Actions.hpp Supplied_Service.cpp Supplied_Service.hpp cygnal/ACT/unit_tests: Test_ACT.cpp Test_Scheduler.cpp Test_Scheduling_Queue.cpp Log message: -- Cygnal module ACT (all of its base, test support, and unit tests) now compiles under gcc without so much of a warning under cygwin. The unit test executable dumps core immediately (natch), but I don't think I've made any particularly substantive change since they were working under MSVC, so I'm declaring them done for the moment. -- cygnal/ACT/unit_tests/Makefile.am has a hard-coded name for the Boost Test library. macros/boost.m4 needs alteration to detect this library, etc., etc., etc., and then it needs to be hooked up to the cygnal build. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/Change_Log.txt?cvsroot=gnash&r1=1.5&r2=1.6 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/Handle.hpp?cvsroot=gnash&r1=1.7&r2=1.8 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/Listen.hpp?cvsroot=gnash&r1=1.2&r2=1.3 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/Makefile.am?cvsroot=gnash&r1=1.3&r2=1.4 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/Scheduler.T.cpp?cvsroot=gnash&r1=1.2&r2=1.3 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/Scheduler.hpp?cvsroot=gnash&r1=1.5&r2=1.6 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/Scheduling_Queue.cpp?cvsroot=gnash&r1=1.3&r2=1.4 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/Service.hpp?cvsroot=gnash&r1=1.5&r2=1.6 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/test_support/Action_Tracing.hpp?cvsroot=gnash&r1=1.4&r2=1.5 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/test_support/Listening_Actions.cpp?cvsroot=gnash&r1=1.4&r2=1.5 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/test_support/Listening_Actions.hpp?cvsroot=gnash&r1=1.4&r2=1.5 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/test_support/Simple_Actions.hpp?cvsroot=gnash&r1=1.4&r2=1.5 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/test_support/Supplied_Service.cpp?cvsroot=gnash&r1=1.2&r2=1.3 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/test_support/Supplied_Service.hpp?cvsroot=gnash&r1=1.2&r2=1.3 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/unit_tests/Test_ACT.cpp?cvsroot=gnash&r1=1.5&r2=1.6 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/unit_tests/Test_Scheduler.cpp?cvsroot=gnash&r1=1.5&r2=1.6 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ACT/unit_tests/Test_Scheduling_Queue.cpp?cvsroot=gnash&r1=1.5&r2=1.6 Patches: Index: Change_Log.txt =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/Change_Log.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- Change_Log.txt 1 Oct 2007 15:49:40 -0000 1.5 +++ Change_Log.txt 16 Oct 2007 20:20:29 -0000 1.6 @@ -1,7 +1,28 @@ Change Log for GNU Cygnal, Module ACT ===================================== -2007-01-10 Eric Hughes <[EMAIL PROTECTED]> +2007-10-16 Eric Hughes <[EMAIL PROTECTED]> + * Scheduler.hpp: Rearranged member declarations to eliminate gcc warning. + * Makefile.am: Changed name of boost test library to match my setup. Your mileage will certainly vary. + * unit_tests/Test_{ACT,Scheduler,Scheduling_Queue}.cpp: Changed BOOST_AUTO_UNIT_TEST to BOOST_AUTO_TEST_CASE (removal of deprecated syntax). + +2007-10-14 Eric Hughes <[EMAIL PROTECTED]> + * {.,test_support,unit_tests}/Makefile.am: Changed file names of libraries to use underscore separators. + * unit_tests/Makefile.am: Added library dependencies and build a unit test executable. + * Scheduler.T.cpp: Added logic_error for a Critical_Demon switch case because that task type isn't implemented. This eliminates a gcc warning. + * Scheduling_Queue.cpp: Removed an unused variable to remove a gcc warning. + * unit_tests/Test_Scheduler.cpp: Removed a 'using namespace' declaration, which may or may not have gotten rid of a possible defect involving template parameter instantiation. + * unit_tests/Test_Scheduling_Queue.cpp: Normalized syntax of template class declarations. + +2007-10-04 Eric Hughes <[EMAIL PROTECTED]> + * {Listen,Scheduler,Service}.hpp,test_support/{Action_Tracing,Listening_Actions,Simple_Actions,Supplied_Service}.hpp: + Added virtual destructors to eliminate gcc warning. Rearranged class data members to eliminate gcc warning about order of initialization. + * test_support/Supplied_Service.hpp: Added template arguments (by means of a typedef) to parent class initializer of Supplied_Service. + * test_support/{Listening_Actions,Supplied_Service}.cpp: Added class declarator to explicit template instantiation. + * Makefile.am: Cut out definitions not needed for Cygnal. + * {test_support,unit_tests}/Makefile.am: new file + +2007-10-01 Eric Hughes <[EMAIL PROTECTED]> * Cygnal_Instances.cpp: Added class keyword for explicit template instantiation. Replaced typedef in explicit instantiation with its referent. * Handle.hpp: Replaced typedefs in friend declarations with their referents. * Listen.hpp: Removed extraneous typename declaration. Index: Handle.hpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/Handle.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -b -r1.7 -r1.8 --- Handle.hpp 3 Oct 2007 15:29:16 -0000 1.7 +++ Handle.hpp 16 Oct 2007 20:20:29 -0000 1.8 @@ -312,11 +312,6 @@ /// and add a \c const accessor function returning a reference. aspect_type aspect ; - /// The aspect class is a friend. - /// The aspect is a template parameter, so we know nothing of aspect structure. - /// Hence we use a class friend here. - friend class Aspect< T, Handled > ; - public: /// Default constructor takes as parameter the \c this pointer of a derived object. Handled( T * that, aspect_type aspect = aspect_type() ) Index: Listen.hpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/Listen.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- Listen.hpp 1 Oct 2007 15:49:40 -0000 1.2 +++ Listen.hpp 16 Oct 2007 20:20:29 -0000 1.3 @@ -75,6 +75,9 @@ /// Add an item to the waiting list void add_waiting_listener_task( Listener *, wakeup_listener * ) ; + + /// Trivial virtual destructor + virtual ~Basic_Listen_Monitor() {} } ; //------------------------- Index: Makefile.am =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- Makefile.am 3 Oct 2007 18:11:59 -0000 1.3 +++ Makefile.am 16 Oct 2007 20:20:29 -0000 1.4 @@ -15,46 +15,28 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# $Id: Makefile.am,v 1.3 2007/10/03 18:11:59 strk Exp $ +# $Id: Makefile.am,v 1.4 2007/10/16 20:20:29 eh9 Exp $ #---------------------------------------- # Makefile.am for Cygnal/ACT #---------------------------------------- - -# provide subdirs with a Makefile.am to list here -SUBDIRS = - AM_CPPFLAGS = # -Wall ## WARNING: make sure GLIB_LIBS appears first ## See: http://lists.gnu.org/archive/html/gnash-dev/2006-07/msg00076.html AM_LDFLAGS = \ - ../../libbase/libgnashbase.la \ - ../../libamf/libgnashamf.la \ - $(LIBLTDL) \ $(GLIB_LIBS) \ - $(LIBXML_LIBS) \ - $(CURL_LIBS) \ - $(BOOST_LIBS) \ - $(PTHREAD_LIBS) + $(BOOST_LIBS) localedir = $(datadir)/locale INCLUDES = -I.. \ - -I$(top_srcdir) \ -I$(top_srcdir)/cygnal \ - -I$(top_srcdir)/libamf \ - -I$(top_srcdir)/libbase \ - -I$(top_srcdir)/server \ -DLOCALEDIR=\"$(localedir)\" \ - $(LIBXML_CFLAGS) \ - $(DMALLOC_CFLAGS) \ - $(CURL_CFLAGS) \ - $(BOOST_CFLAGS) \ - $(PTHREAD_CFLAGS) + $(BOOST_CFLAGS) -lib_LTLIBRARIES = libcygnalact.la -libcygnalact_la_SOURCES= \ +lib_LTLIBRARIES = libcygnal_act.la +libcygnal_act_la_SOURCES= \ ACT.cpp \ Cygnal_Instances.cpp \ Handle.cpp \ Index: Scheduler.T.cpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/Scheduler.T.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- Scheduler.T.cpp 1 Oct 2007 15:49:40 -0000 1.2 +++ Scheduler.T.cpp 16 Oct 2007 20:20:29 -0000 1.3 @@ -20,6 +20,7 @@ /// \file Scheduler.T.cpp +#include <stdexcept> #include "Scheduler.hpp" namespace ACT { @@ -143,6 +144,8 @@ item -> sequence_number = next_service_sequence_number ++ ; the_queue.reorder( item ) ; break ; + case Critical_Demon: + throw std::logic_error( "Scheduled item type 'Critical_Demon' found but not yet supported." ) ; } } else { the_queue.pop() ; Index: Scheduler.hpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/Scheduler.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- Scheduler.hpp 1 Oct 2007 15:49:40 -0000 1.5 +++ Scheduler.hpp 16 Oct 2007 20:20:29 -0000 1.6 @@ -54,6 +54,9 @@ Scheduler( Scheduler * that ) : Handled< Scheduler >( that ) {} ; + + /// Trivial destructor + virtual ~Scheduler() {} } ; /** \class wakeup_listener @@ -220,16 +223,16 @@ struct Basic_Scheduled_Item { /// - Action_Category action_type ; + act the_action ; /// - Basic_Priority priority_category ; + unsigned int sequence_number ; /// - unsigned int sequence_number ; + Action_Category action_type ; /// - act the_action ; + Basic_Priority priority_category ; /// Basic_Scheduled_Item( act x, unsigned int n, Action_Category action_type = Task ) ; Index: Scheduling_Queue.cpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/Scheduling_Queue.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- Scheduling_Queue.cpp 1 Jul 2007 10:53:51 -0000 1.3 +++ Scheduling_Queue.cpp 16 Oct 2007 20:20:29 -0000 1.4 @@ -59,7 +59,7 @@ permutation[ permutation_index ].the_auxiliary.reconstruct( auxiliary ) ; } ++ n_queue_items ; - size_t n = up_heap( n_queue_items - 1 ) ; + (void) up_heap( n_queue_items - 1 ) ; return pointer( permutation_index, this ) ; } Index: Service.hpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/Service.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- Service.hpp 19 Jul 2007 18:29:34 -0000 1.5 +++ Service.hpp 16 Oct 2007 20:20:29 -0000 1.6 @@ -93,7 +93,7 @@ * It only completes when it needs to shut down, either from an internal failure or by external command. * * WARNING: A service must not both schedule a new action and return \c Completed in the same activation. - * This restriction simplifies implementation of the scheduler, which then doesn't need to removed + * This restriction simplifies implementation of the scheduler, which then doesn't need to remove * a completed service action from within the middle of the scheduling queue. * When a service schedules no new actions, it remains at the top of the priority queue, * from where it can be removed like any other task. @@ -106,16 +106,22 @@ typedef Aspect< Service > aspect_type ; private: - /// Aspect instance. - aspect_type aspect ; + /// + Generator & the_generator ; + /// Scheduler & our_scheduler ; - Generator & the_generator ; + /// Aspect instance. + aspect_type aspect ; + public: /// Service( Generator & x, Scheduler & z, aspect_type aspect = aspect_type() ) ; + /// Trivial virtual destructor + virtual ~Service() {} + /// ACT_State run( wakeup_listener * ) ; Index: test_support/Action_Tracing.hpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/test_support/Action_Tracing.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- test_support/Action_Tracing.hpp 21 Jul 2007 17:51:21 -0000 1.4 +++ test_support/Action_Tracing.hpp 16 Oct 2007 20:20:29 -0000 1.5 @@ -73,18 +73,21 @@ class simple_tracker : public tracking_function { - /// Prefix for tracking item - const std::string prefix ; - /// Trace to which to added tracking event execution_trace & trace ; + /// Prefix for tracking item + const std::string prefix ; + public: /// simple_tracker( execution_trace & trace, const std::string prefix ) : trace( trace ), prefix( prefix ) {} + /// Trivial virtual destructor + virtual ~simple_tracker() {} + /// void operator()( const std::string x ) { Index: test_support/Listening_Actions.cpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/test_support/Listening_Actions.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- test_support/Listening_Actions.cpp 10 Jul 2007 14:09:09 -0000 1.4 +++ test_support/Listening_Actions.cpp 16 Oct 2007 20:20:29 -0000 1.5 @@ -88,5 +88,5 @@ // Instantiate an instance of Handle_Registry_Follower as needed for N_to_Completion #include "ACT/Handle.cpp" namespace ACT { - template Handle_Registry_Follower< shared_ptr< N_to_completion_Monitor >, Scheduler > ; + template class Handle_Registry_Follower< shared_ptr< N_to_completion_Monitor >, Scheduler > ; } \ No newline at end of file Index: test_support/Listening_Actions.hpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/test_support/Listening_Actions.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- test_support/Listening_Actions.hpp 10 Jul 2007 14:09:09 -0000 1.4 +++ test_support/Listening_Actions.hpp 16 Oct 2007 20:20:29 -0000 1.5 @@ -48,8 +48,11 @@ ACT_State run() ; public: - /// Default constructor. - N_to_completion_Monitor() {} ; + /// Trivial default constructor. + N_to_completion_Monitor() {} + + /// Trivial virtual destructor + ~N_to_completion_Monitor() {} /// Implementation of specific wake-up preparation void add_wakeup_item( N_to_completion *, wakeup_listener * ) ; @@ -62,14 +65,14 @@ class N_to_completion : public Basic_Listening_Task< N_to_completion, N_to_completion_Monitor > { - /// Tracking - std::auto_ptr< tracking_function > tracker ; + /// + unsigned int total_number_of_activations ; /// unsigned int number_of_activations_left ; - /// - unsigned int total_number_of_activations ; + /// Tracking + std::auto_ptr< tracking_function > tracker ; /// Action body, proxied by operator() ACT_State run( wakeup_listener * ) ; @@ -78,6 +81,9 @@ /// N_to_completion( unsigned int n, tracking_function * = 0 ) ; + /// Trivial virtual destructor + virtual ~N_to_completion() {} + void reset() ; } ; Index: test_support/Simple_Actions.hpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/test_support/Simple_Actions.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- test_support/Simple_Actions.hpp 21 Jul 2007 17:51:21 -0000 1.4 +++ test_support/Simple_Actions.hpp 16 Oct 2007 20:20:29 -0000 1.5 @@ -46,7 +46,10 @@ single_action( tracking_function * x = 0 ) : tracker( x ) {} - } ; + + /// Trivial virtual destructor + virtual ~single_action() {} +} ; //------------------------- /** \class no_action @@ -72,6 +75,9 @@ { set_completed() ; } + + /// Trivial virtual destructor + virtual ~no_action() {} } ; } // end namespace ACT Index: test_support/Supplied_Service.cpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/test_support/Supplied_Service.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- test_support/Supplied_Service.cpp 1 Oct 2007 15:49:40 -0000 1.2 +++ test_support/Supplied_Service.cpp 16 Oct 2007 20:20:29 -0000 1.3 @@ -54,5 +54,5 @@ #include "ACT/Service.cpp" namespace ACT { - template Service< Supplied_Service_Aspect > ; + template class Service< Supplied_Service_Aspect > ; } Index: test_support/Supplied_Service.hpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/test_support/Supplied_Service.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- test_support/Supplied_Service.hpp 21 Jul 2007 17:51:21 -0000 1.2 +++ test_support/Supplied_Service.hpp 16 Oct 2007 20:20:29 -0000 1.3 @@ -54,6 +54,9 @@ Supplied_Generator() : active( true ), complete( false ) {} + /// Trivial virtual destructor + virtual ~Supplied_Generator() {} + /// This \c shutdown routine pushes out all pending actions, accepting no new ones. void shutdown() { active = false ; } @@ -96,6 +99,8 @@ class Supplied_Service : public Service< Supplied_Service_Aspect > { + typedef Service< Supplied_Service_Aspect > Service_Base ; + /// Aspect type for \c Service base class typedef Supplied_Service_Aspect< Service< Supplied_Service_Aspect > > service_base_aspect_type ; @@ -105,9 +110,12 @@ public: /// Default constructor Supplied_Service( Scheduler & z, tracking_function * t = 0 ) - : Service( the_generator, z, service_base_aspect_type( t ) ) + : Service_Base( the_generator, z, service_base_aspect_type( t ) ) {} + /// Trivial virtual destructor + virtual ~Supplied_Service() {} + /// inline void shutdown() { the_generator.shutdown() ; } Index: unit_tests/Test_ACT.cpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/unit_tests/Test_ACT.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- unit_tests/Test_ACT.cpp 1 Oct 2007 15:49:40 -0000 1.5 +++ unit_tests/Test_ACT.cpp 16 Oct 2007 20:20:30 -0000 1.6 @@ -67,7 +67,7 @@ //-------------------------------------------------- -BOOST_AUTO_UNIT_TEST( act_twice_works ) +BOOST_AUTO_TEST_CASE( act_twice_works ) { act x( new act_twice() ) ; @@ -80,7 +80,7 @@ BOOST_CHECK_MESSAGE( x.completed(), "state after three calls should still be 'Completed'" ) ; } -BOOST_AUTO_UNIT_TEST( no_action_works ) +BOOST_AUTO_TEST_CASE( no_action_works ) { execution_trace trace ; act x( new no_action( new simple_tracker( trace, "N" ) ) ) ; @@ -91,7 +91,7 @@ BOOST_CHECK_MESSAGE( trace.result() == "", "Tracking should not have recorded an activation, since action was already completed" ) ; } -BOOST_AUTO_UNIT_TEST( act_n_equals_two_works ) +BOOST_AUTO_TEST_CASE( act_n_equals_two_works ) { execution_trace trace ; act x( new N_to_completion( 2, new simple_tracker( trace, "C" ) ) ) ; Index: unit_tests/Test_Scheduler.cpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/unit_tests/Test_Scheduler.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- unit_tests/Test_Scheduler.cpp 21 Jul 2007 17:51:21 -0000 1.5 +++ unit_tests/Test_Scheduler.cpp 16 Oct 2007 20:20:30 -0000 1.6 @@ -38,7 +38,6 @@ //-------------------------------------------------- // White box test of Handle using aspects. //-------------------------------------------------- - using namespace ACT ; //--------------- // This is the template definition of the base aspect class. @@ -52,15 +51,15 @@ //--------------- /// \brief Test aspect for Handle_Registry_Leader template< class T > - class test_aspect< T, Handle_Registry_Leader< T, test_aspect > > - : public aspect::Null_Aspect_1< T, Handle_Registry_Leader< T, aspect::Null_Aspect_1 > > + class test_aspect< T, ACT::Handle_Registry_Leader< T, test_aspect > > + : public aspect::Null_Aspect_1< T, ACT::Handle_Registry_Leader< T, aspect::Null_Aspect_1 > > { // We need the execution trace in this class because it's constructed statically. // If we had two static classes that required a common trace, we'd have to use a third class, a singleton, to put this in. - execution_trace tr ; + ACT::execution_trace tr ; public: - execution_trace & trace() { return tr ; } + ACT::execution_trace & trace() { return tr ; } std::string result() const { return tr.result() ; } void add_in_new_place() { tr.add( "N" ) ; } @@ -70,13 +69,13 @@ //--------------- /// \brief Test aspect for Handle_Registry_Follower. template< class T, class Leader > - class test_aspect_2< T, Leader, Handle_Registry_Follower< T, Leader, test_aspect_2 > > - : public aspect::Null_Aspect_2< T, Leader, Handle_Registry_Follower< T, Leader, aspect::Null_Aspect_2 > > + class test_aspect_2< T, Leader, ACT::Handle_Registry_Follower< T, Leader, test_aspect_2 > > + : public aspect::Null_Aspect_2< T, Leader, ACT::Handle_Registry_Follower< T, Leader, aspect::Null_Aspect_2 > > { // See reason above for why the execution trace is here - execution_trace tr ; + ACT::execution_trace tr ; public: - execution_trace & trace() { return tr ; } + ACT::execution_trace & trace() { return tr ; } std::string result() const { return tr.result() ; } void access_from_existing_slot() { tr.add( "A" ) ; } @@ -84,20 +83,19 @@ } ; //--------------- - // Forward - class test ; - //--------------- /// \brief Test aspect for Handled. + /// This is a specialization of the template< class T > - class test_aspect< T, Handled< T, test_aspect > > - : public Null_Aspect_Handled< T >, - public aspect::Aspect_Has_Access_To_Owner< Handled< T, test_aspect > > - { - /// The explicit namespace qualification distinguishes the generic declaration from this specialization. - typedef Handled< test, ACT_Test::test_aspect > owner_type ; + class test_aspect< T, ACT::Handled< T, ACT_Test::test_aspect > > + : public ACT::Null_Aspect_Handled< T >, + public aspect::Aspect_Has_Access_To_Owner< ACT::Handled< T, test_aspect > > + { + /// An explicit namespace qualification (ACT_Test::test_aspect instead of merely test_aspect) + /// discriminates between the template as such and the present class, which is a template specialization. + typedef ACT::Handled< T, ACT_Test::test_aspect > owner_type ; /// - typedef aspect::Aspect_Has_Access_To_Owner< Handled< T, ACT_Test::test_aspect > > access_base_type ; + typedef aspect::Aspect_Has_Access_To_Owner< ACT::Handled< T, ACT_Test::test_aspect > > access_base_type ; public: std::string result() const { @@ -106,19 +104,31 @@ } ; //--------------- + // Forward + class test ; +} +namespace ACT { + //template<> class Handled< ACT_Test::test, ACT_Test::test_aspect > ; +} +namespace ACT_Test { + //--------------- /// \brief A test class for \c Handled, deriving from it in order to exercise it. class test - : public Handled< test, test_aspect > + : public ACT::Handled< ACT_Test::test, ACT_Test::test_aspect > { - typedef Handled< test, test_aspect > Handled_Base ; + typedef ACT::Handled< test, test_aspect > Handled_Base ; public: test() : Handled_Base( this ) {} std::string result() const { return aspect.result() ; } } ; + //------------------------------ + using ACT::simple_tracker ; + //------------------------------ + //--------------- - BOOST_AUTO_UNIT_TEST( handle_one ) + BOOST_AUTO_TEST_CASE( handle_one ) { // We declare variables within blocks to invoke their destructors. { @@ -146,10 +156,10 @@ } //--------------- - BOOST_AUTO_UNIT_TEST( handle_two ) + BOOST_AUTO_TEST_CASE( handle_two ) { test x ; - Handle_Registry_Follower< int, test, test_aspect_2 > follower ; + ACT::Handle_Registry_Follower< int, test, test_aspect_2 > follower ; std::string found( follower.aspect.result() ) ; std::string expected( "" ) ; BOOST_CHECK( found == "" ) ; @@ -210,9 +220,9 @@ /// \brief test aspect for \c Basic_Scheduler template<> - class scheduler_aspect< Basic_Scheduler< scheduler_aspect > > - : public Basic_Scheduler_Null_Aspect, - public aspect::Aspect_Has_Access_To_Owner< Basic_Scheduler< scheduler_aspect > > + class scheduler_aspect< ACT::Basic_Scheduler< scheduler_aspect > > + : public ACT::Basic_Scheduler_Null_Aspect, + public aspect::Aspect_Has_Access_To_Owner< ACT::Basic_Scheduler< scheduler_aspect > > { scheduler_aspect_body * body ; @@ -235,15 +245,15 @@ } ; - typedef scheduler_aspect< Basic_Scheduler< scheduler_aspect > > Test_Scheduler_Aspect ; - typedef Basic_Scheduler< scheduler_aspect > Test_Scheduler ; + typedef scheduler_aspect< ACT::Basic_Scheduler< scheduler_aspect > > Test_Scheduler_Aspect ; + typedef ACT::Basic_Scheduler< scheduler_aspect > Test_Scheduler ; // Explicit instantiation of our Test_Scheduler - template Test_Scheduler ; + template class ACT::Basic_Scheduler< scheduler_aspect > ; //-------------------------------------------------- // This test checks that the execution guard functions correctly to limit the total number of execution passes. - BOOST_AUTO_UNIT_TEST( guard_functions ) + BOOST_AUTO_TEST_CASE( guard_functions ) { scheduler_aspect_body a ; Test_Scheduler b = Test_Scheduler( Test_Scheduler_Aspect( & a ) ) ; @@ -255,7 +265,7 @@ * We run them 4 at a time. * After the last one, the queue should be empty. */ - b.add_task( act( new N_to_completion( 6, 0 ) ) ) ; + b.add_task( ACT::act( new ACT::N_to_completion( 6, 0 ) ) ) ; a.set_execution_bound( 4 ) ; b() ; BOOST_CHECK( a.finished_within_bound() ) ; @@ -268,16 +278,16 @@ BOOST_CHECK( b.empty() ) ; } - BOOST_AUTO_UNIT_TEST( some_single_actions ) + BOOST_AUTO_TEST_CASE( some_single_actions ) { scheduler_aspect_body a ; Test_Scheduler b = Test_Scheduler( Test_Scheduler_Aspect( & a ) ) ; - execution_trace tr ; - b.add_task( act( new no_action( new simple_tracker( tr, "N" ) ) ) ) ; - b.add_task( act( new single_action( new simple_tracker( tr, "A" ) ) ) ) ; - b.add_task( act( new single_action( new simple_tracker( tr, "B" ) ) ) ) ; - b.add_task( act( new single_action( new simple_tracker( tr, "C" ) ) ) ) ; + ACT::execution_trace tr ; + b.add_task( ACT::act( new ACT::no_action( new simple_tracker( tr, "N" ) ) ) ) ; + b.add_task( ACT::act( new ACT::single_action( new simple_tracker( tr, "A" ) ) ) ) ; + b.add_task( ACT::act( new ACT::single_action( new simple_tracker( tr, "B" ) ) ) ) ; + b.add_task( ACT::act( new ACT::single_action( new simple_tracker( tr, "C" ) ) ) ) ; a.set_execution_bound( 100 ) ; b() ; @@ -288,15 +298,15 @@ BOOST_CHECK( b.empty() ) ; } - BOOST_AUTO_UNIT_TEST( act_n_interleaved ) + BOOST_AUTO_TEST_CASE( act_n_interleaved ) { scheduler_aspect_body a ; Test_Scheduler b = Test_Scheduler( Test_Scheduler_Aspect( & a ) ) ; - execution_trace tr ; - b.add_task( act( new N_to_completion( 2, new simple_tracker( tr, "A" ) ) ) ) ; - b.add_task( act( new N_to_completion( 3, new simple_tracker( tr, "B" ) ) ) ) ; - b.add_task( act( new N_to_completion( 5, new simple_tracker( tr, "C" ) ) ) ) ; + ACT::execution_trace tr ; + b.add_task( ACT::act( new ACT::N_to_completion( 2, new simple_tracker( tr, "A" ) ) ) ) ; + b.add_task( ACT::act( new ACT::N_to_completion( 3, new simple_tracker( tr, "B" ) ) ) ) ; + b.add_task( ACT::act( new ACT::N_to_completion( 5, new simple_tracker( tr, "C" ) ) ) ) ; a.set_execution_bound( 100 ) ; b() ; @@ -309,18 +319,18 @@ //-------------------------------------------------- // Same as act_n_interleaved, but using a Supplied_Service - BOOST_AUTO_UNIT_TEST( act_n_service ) + BOOST_AUTO_TEST_CASE( act_n_service ) { scheduler_aspect_body a ; Test_Scheduler b = Test_Scheduler( Test_Scheduler_Aspect( & a ) ) ; - execution_trace tr ; - Supplied_Service * ss = new Supplied_Service( b, new simple_tracker( tr, "S" ) ) ; - ss -> add_task( shared_ptr< basic_act >( new N_to_completion( 2, new simple_tracker( tr, "A" ) ) ) ) ; - ss -> add_task( shared_ptr< basic_act >( new N_to_completion( 3, new simple_tracker( tr, "B" ) ) ) ) ; - ss -> add_task( shared_ptr< basic_act >( new N_to_completion( 5, new simple_tracker( tr, "C" ) ) ) ) ; + ACT::execution_trace tr ; + ACT::Supplied_Service * ss = new ACT::Supplied_Service( b, new simple_tracker( tr, "S" ) ) ; + ss -> add_task( shared_ptr< ACT::basic_act >( new ACT::N_to_completion( 2, new simple_tracker( tr, "A" ) ) ) ) ; + ss -> add_task( shared_ptr< ACT::basic_act >( new ACT::N_to_completion( 3, new simple_tracker( tr, "B" ) ) ) ) ; + ss -> add_task( shared_ptr< ACT::basic_act >( new ACT::N_to_completion( 5, new simple_tracker( tr, "C" ) ) ) ) ; - b.add_service( act( ss ) ) ; + b.add_service( ACT::act( ss ) ) ; ss -> shutdown() ; a.set_execution_bound( 100 ) ; b() ; @@ -332,19 +342,19 @@ } //-------------------------------------------------- - BOOST_AUTO_UNIT_TEST( pause_action ) + BOOST_AUTO_TEST_CASE( pause_action ) { scheduler_aspect_body a ; Test_Scheduler b = Test_Scheduler( Test_Scheduler_Aspect( & a ) ) ; BOOST_REQUIRE( b.empty() ) ; - Pause_Demon * pause( new Pause_Demon( & b ) ) ; - b.add_task( act( new no_action( 0 ) ) ) ; + ACT::Pause_Demon * pause( new ACT::Pause_Demon( & b ) ) ; + b.add_task( ACT::act( new ACT::no_action( 0 ) ) ) ; // This pause action should immediately return, because there's a pending action in the scheduler. ( * pause )() ; a.set_execution_bound( 2 ) ; - b.add_service( act( pause ) ) ; + b.add_service( ACT::act( pause ) ) ; b() ; BOOST_CHECK( a.finished_at_bound() ) ; // Pause demon should execute once, no_action once. BOOST_CHECK( ! b.empty() ) ; // demon should still be in queue. Index: unit_tests/Test_Scheduling_Queue.cpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/ACT/unit_tests/Test_Scheduling_Queue.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- unit_tests/Test_Scheduling_Queue.cpp 21 Jul 2007 17:51:21 -0000 1.5 +++ unit_tests/Test_Scheduling_Queue.cpp 16 Oct 2007 20:20:30 -0000 1.6 @@ -45,8 +45,8 @@ // Explicit instantiation #include "ACT/Scheduling_Queue.cpp" #include "ACT/Scheduler.T.cpp" -template ACT::wakeup_listener_allocated< ACT::Basic_Scheduler<> > ; -template ACT::Scheduling_Queue< test_item, ACT::wakeup_listener_allocated< ACT::Basic_Scheduler<> > > ; +template class ACT::wakeup_listener_allocated< ACT::Basic_Scheduler<> > ; +template class ACT::Scheduling_Queue< test_item, ACT::wakeup_listener_allocated< ACT::Basic_Scheduler<> > > ; typedef ACT::Scheduling_Queue< test_item, ACT::wakeup_listener_allocated< ACT::Basic_Scheduler<> > > queue_type ; typedef queue_type::pointer pointer ; @@ -54,7 +54,7 @@ using namespace ACT ; //-------------------------------------------------- -BOOST_AUTO_UNIT_TEST( simple_queue_exercise ) +BOOST_AUTO_TEST_CASE( simple_queue_exercise ) { queue_type q ; @@ -114,7 +114,7 @@ //BOOST_AUTO_TEST_GENERATOR( ordering_random2_, random_permutation( add_then_test_order, 20000, 1 ) ) //-------------------------------------------------- -BOOST_AUTO_UNIT_TEST( another_simple_queue_exercise ) +BOOST_AUTO_TEST_CASE( another_simple_queue_exercise ) { queue_type q ; @@ -209,7 +209,7 @@ /* This test exercises the use pattern that an ACT at the top of the queue is executed then rescheduled * at lower priority, generally while waiting for I/O to complete. */ -BOOST_AUTO_UNIT_TEST( parametric_add_permuted_reorder_all ) +BOOST_AUTO_TEST_CASE( parametric_add_permuted_reorder_all ) { vector_type v ; const size_t upper = 100 ; @@ -242,7 +242,7 @@ while ( i != middle ) { pp.push_back( q.push( test_item( * i ++ ), 0 ) ) ; } - BOOST_REQUIRE( i - begin == number_of_elements ) ; + BOOST_REQUIRE( i == begin + number_of_elements ) ; const size_t number_of_wakeups = end - middle ; for ( j = number_of_elements ; j < number_of_wakeups + number_of_elements ; ++ j ) { @@ -256,7 +256,7 @@ /* This test exercises the use pattern that an ACT somewhere in the queue wakes up and becomes ready for execution. */ -BOOST_AUTO_UNIT_TEST( add_permuted_wakeup_all ) +BOOST_AUTO_TEST_CASE( add_permuted_wakeup_all ) { vector_type v ; const size_t n = 100 ; _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit