/*
 * BARGRAPH.H
 *
 *  Header file for ArchiveLib 1.0
 *
 *  Copyright (c) 1994 Greenleaf Software, Inc.
 *  All Rights Reserved
 *
 * DESCRIPTION
 *
 *  The class definition for ALBarGraph is found here.
 * 
 * CLASS DEFINITIONS:
 *
 *  class ALBarGraph
 *
 * REVISION HISTORY
 *
 *  May 26, 1994  1.0A  : First release
 *
 */

#ifndef _BARGRAPH_H
#define _BARGRAPH_H

#include "arclib.h"

#if defined( __cplusplus )

/*
 * class ALBarGraph : public ALMonitor
 *
 * DESCRIPTION
 *
 *  This is a utility class.  The constructor opens a file for input,
 *  and keeps track of whether it was already open or not.  The destructor
 *  will automatically close the file if it was closed when the
 *  ctor was invoked.
 *
 * DATA MEMBERS
 *
 *  miCurrentOffset   : The current offset of the bargraph, in screen
 *                      units.  Usually the bar itself is 20 characters
 *                      long, in which case this value will be somewhere
 *                      between 0 and 19.
 *
 *  miBarLength       : The length of the bar, defined when the 
 *                      constructor is called.  This is a const member,
 *                      which means we can leave it public.
 *
 *  mrStream          : Reference to an output stream.  This is the
 *                      stream where the bargraph gets drawn.
 *                    
 * MEMBER FUNCTIONS
 *
 *  ALBarGraph()        : The constructor.
 *  ~ALBarGraph()       : Virtual destructor.
 *  Progress()          : The progress routine, where the bargraph
 *                        gets updated.
 *  ArchiveOperation()  : The routine that gets called when files
 *                        are opened, closed, etc.
 *
 * REVISION HISTORY
 *
 *  May 26, 1994  1.0A  : First release
 *
 */

class AL_CLASS_TYPE ALBarGraph : public ALMonitor {
/*
 * Constructors, destructors, and friend classes
 */
     public :
          AL_PROTO ALBarGraph( ALMonitorType monitor_type,
                               ostream& stream = cout,
                               int bar_length = 25 );
          virtual AL_PROTO ~ALBarGraph();
/*
 * The copy constructor and assignment operator do not exist.
 */
     protected :
          ALBarGraph( const ALBarGraph& );
          ALBarGraph& operator=( const ALBarGraph& );
/*
 * Member functions
 */
     protected :
          virtual void AL_PROTO Progress( long object_so_far,
                                          ALStorage& object );
          virtual void AL_PROTO
          ArchiveOperation( ALArchiveOperation operation,
                            ALArchiveBase *archive,
                            ALEntry *job );
/*
 * Data Members
 */
     protected :
          int miCurrentOffset;
          const int miBarLength;
          ostream& mrStream;
     public :
          AL_CLASS_TAG( _ALBarGraphTag );
};

#endif /* #if defined( __cplusplus ) */

#endif /* #ifdef _BARGRAP_H          */