CommandFrame.hpp
#if !defined(__COMMANDFRAME_HPP)
#define __COMMANDFRAME_HPP
/*
CoreLinux++
Copyright (C) 1999,2000 CoreLinux Consortium
The CoreLinux++ Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The CoreLinux++ Library Library is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#if !defined(__COMMON_HPP)
#include <Common.hpp>
#endif
#if !defined(__ABSTRACTCOMMAND_HPP)
#include <AbstractCommand.hpp>
#endif
#if !defined(__VECTOR_HPP)
#include <Vector.hpp>
#endif
#if !defined(__COMMANDFRAMEEXCEPTION_HPP)
#include <CommandFrameException.hpp>
#endif
namespace corelinux
{
CORELINUX_VECTOR( AbstractCommandPtr , Commands );
DECLARE_CLASS( CommandFrame );
enum WorkState
{
BUILDING = 0,
EXECUTING,
COMPLETED,
REVERSING,
REVERSED,
NEVERCOMPLETED
};
class CommandFrame : public Synchronized
{
public:
//
// Constructors and destructor
//
CommandFrame( bool autoReverse = false );
CommandFrame( CommandFrameCref )
throw( CommandFrameException );
virtual ~CommandFrame( void );
//
// Operator overloads
//
CommandFrameRef operator=( CommandFrameCref )
throw( CommandFrameException );
bool operator==( CommandFrameCref ) const;
//
// Accessors
//
WorkState getState( void ) const;
bool getReverseFlag( void ) const;
virtual void getCommands( CommandsRef ) const;
//
// Mutators
//
CommandFrameRef operator+=( AbstractCommandPtr )
throw( CommandFrameException );
CommandFrameRef operator+=( CommandFrameCref )
throw( CommandFrameException );
virtual void addCommand( AbstractCommandPtr )
throw( CommandFrameException );
void setAutoReverse( bool ) throw( CommandFrameException );
void execute( void ) throw( CommandFrameException );
void executeReverse( void ) throw( CommandFrameException );
protected:
virtual WorkState executeCommands( void );
virtual WorkState executeReverseCommands( void );
protected:
bool theAutoReverseFlag;
WorkState theWorkState;
Commands theCommands;
};
}
#endif // if !defined(__COMMANDFRAME_HPP)
/*
Common rcs information do not modify
$Author: prudhomm $
$Revision: 1.2 $
$Date: 2000/08/31 22:52:20 $
$Locker: $
*/
corelinux::CommandFrameException
CommandFrameException is the base exception type for CommandFrame.
Definition: CommandFrameException.hpp:39
corelinux::CommandFrame::setAutoReverse
void setAutoReverse(bool)
Sets the auto reverse flag.
Definition: CommandFrame.cpp:201
corelinux::CommandFrame::execute
void execute(void)
Run the frame which will iterate through the commands, calling execute for each on.
Definition: CommandFrame.cpp:217
corelinux::CommandFrame::theAutoReverseFlag
bool theAutoReverseFlag
The recovery flag.
Definition: CommandFrame.hpp:238
corelinux::CommandFrame::theWorkState
WorkState theWorkState
The state of execution.
Definition: CommandFrame.hpp:242
corelinux::CommandFrame::theCommands
Commands theCommands
The Commands that make up the frame.
Definition: CommandFrame.hpp:246
corelinux::CommandFrame::CommandFrame
CommandFrame(bool autoReverse=false)
Default Constructor.
Definition: CommandFrame.cpp:33
corelinux::CommandFrame::operator==
bool operator==(CommandFrameCref) const
Equality operator.
Definition: CommandFrame.cpp:110
corelinux::CommandFrame::addCommand
virtual void addCommand(AbstractCommandPtr)
Explicit call to add command.
Definition: CommandFrame.cpp:185
corelinux::CommandFrame::operator=
CommandFrameRef operator=(CommandFrameCref)
Operator assignment.
Definition: CommandFrame.cpp:78
corelinux::CommandFrame::getCommands
virtual void getCommands(CommandsRef) const
Retrieves the commands into a Command collection.
Definition: CommandFrame.cpp:130
corelinux::CommandFrame::executeCommands
virtual WorkState executeCommands(void)
Called from execute AFTER the state is set to EXECUTING and a synchronized monitor is created...
Definition: CommandFrame.cpp:291
corelinux::CommandFrame::getState
WorkState getState(void) const
Retrieves the state of the frame.
Definition: CommandFrame.cpp:117
corelinux
Forward reference the various common classes.
Definition: AbstractAllocator.hpp:32
corelinux::AbstractCommand
AbstractCommand captures the semantics of the capabilities of commands, which is basically to provide...
Definition: AbstractCommand.hpp:38
corelinux::CommandFrame
CommandFrame builds a unit of work around one or more Commands.
Definition: CommandFrame.hpp:69
corelinux::CommandFrame::executeReverseCommands
virtual WorkState executeReverseCommands(void)
Called from executeReverse AFTER the state is set to REVERSING and a synchronized monitor is created...
Definition: CommandFrame.cpp:358
corelinux::CommandFrame::executeReverse
void executeReverse(void)
Run the reverse commands.
Definition: CommandFrame.cpp:254
corelinux::CommandFrame::operator+=
CommandFrameRef operator+=(AbstractCommandPtr)
Operator overload for adding a command.
Definition: CommandFrame.cpp:145
corelinux::CommandFrame::~CommandFrame
virtual ~CommandFrame(void)
Virtual destructor.
Definition: CommandFrame.cpp:69
corelinux::WorkState
WorkState
State of execution.
Definition: CommandFrame.hpp:50
corelinux::Synchronized
Synchronized is a mixin which allows class objects to enable monitor functionality.
Definition: Synchronized.hpp:41
corelinux::CommandFrame::getReverseFlag
bool getReverseFlag(void) const
Retrieves the auto reverse flag.
Definition: CommandFrame.cpp:123
corelinux::BUILDING
The state is in building, no work has been performed.
Definition: CommandFrame.hpp:54

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