Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

CommandFrame.hpp

00001 #if   !defined(__COMMANDFRAME_HPP)
00002 #define  __COMMANDFRAME_HPP
00003 
00004 /*
00005   CoreLinux++ 
00006   Copyright (C) 1999,2000 CoreLinux Consortium
00007   
00008    The CoreLinux++ Library is free software; you can redistribute it and/or
00009    modify it under the terms of the GNU Library General Public License as
00010    published by the Free Software Foundation; either version 2 of the
00011    License, or (at your option) any later version.
00012 
00013    The CoreLinux++ Library Library is distributed in the hope that it will 
00014    be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016    Library General Public License for more details.
00017 
00018    You should have received a copy of the GNU Library General Public
00019    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00020    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00021    Boston, MA 02111-1307, USA.  
00022 */   
00023 
00024 #if   !defined(__COMMON_HPP)
00025 #include <Common.hpp>
00026 #endif
00027 
00028 #if   !defined(__ABSTRACTCOMMAND_HPP)
00029 #include <AbstractCommand.hpp>
00030 #endif
00031 
00032 #if   !defined(__VECTOR_HPP)
00033 #include <Vector.hpp>
00034 #endif
00035 
00036 #if   !defined(__COMMANDFRAMEEXCEPTION_HPP)
00037 #include <CommandFrameException.hpp>
00038 #endif
00039 
00040 namespace corelinux
00041 {
00042    CORELINUX_VECTOR(  AbstractCommandPtr ,  Commands );
00043 
00044    DECLARE_CLASS( CommandFrame );
00045 
00050    enum  WorkState
00051    {
00053 
00054       BUILDING = 0,
00055       EXECUTING,
00056       COMPLETED,
00057       REVERSING,
00058       REVERSED,
00059       NEVERCOMPLETED
00060    };
00061 
00069    class CommandFrame : public Synchronized
00070    {
00071 
00072    public:
00073 
00074       //
00075       // Constructors and destructor
00076       //
00078 
00079                         CommandFrame( bool autoReverse = false );
00080 
00090                         CommandFrame( CommandFrameCref )
00091                            throw( CommandFrameException );
00092 
00099       virtual           ~CommandFrame( void );      
00100 
00101       //
00102       // Operator overloads
00103       //
00104 
00114                CommandFrameRef   operator=( CommandFrameCref )
00115                   throw( CommandFrameException );
00116 
00118 
00119                bool  operator==( CommandFrameCref ) const;
00120 
00121       //
00122       // Accessors
00123       //
00124 
00130                WorkState   getState( void ) const;
00131 
00137                bool  getReverseFlag( void ) const;
00138 
00145       virtual  void  getCommands( CommandsRef ) const;
00146 
00147       //
00148       // Mutators
00149       //
00150 
00159                CommandFrameRef   operator+=( AbstractCommandPtr )
00160                   throw( CommandFrameException );
00161 
00170                CommandFrameRef   operator+=( CommandFrameCref )
00171                   throw( CommandFrameException );
00172 
00180       virtual  void  addCommand( AbstractCommandPtr )
00181                   throw( CommandFrameException );
00182 
00183 
00190                void  setAutoReverse( bool ) throw( CommandFrameException );
00191 
00202                void  execute( void ) throw( CommandFrameException );
00203 
00212                void  executeReverse( void ) throw( CommandFrameException );
00213 
00214    protected:
00215 
00223       virtual  WorkState   executeCommands( void );
00224 
00232       virtual  WorkState   executeReverseCommands( void );
00233 
00234    protected:
00235 
00237 
00238                bool        theAutoReverseFlag;
00239 
00241 
00242                WorkState   theWorkState;
00243 
00245          
00246                Commands   theCommands;
00247    };
00248 }
00249 
00250 #endif // if !defined(__COMMANDFRAME_HPP)
00251 
00252 /*
00253    Common rcs information do not modify
00254    $Author: prudhomm $
00255    $Revision: 1.2 $
00256    $Date: 2000/08/31 22:52:20 $
00257    $Locker:  $
00258 */
00259 
00260 
00261 

This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium