Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:19:36

0001 /* This software is distributed under the GNU Lesser General Public License */
0002 //==========================================================================
0003 //
0004 //   algorithm.h 
0005 //
0006 //==========================================================================
0007 // $Id: algorithm.h,v 1.14 2003/03/24 15:58:54 raitner Exp $
0008 
0009 #ifndef GTL_ALGORITHM_H
0010 #define GTL_ALGORITHM_H
0011 
0012 #include <GTL/GTL.h>
0013 #include <GTL/graph.h>
0014 
0015 __GTL_BEGIN_NAMESPACE
0016 
0017 /**
0018  * $Date: 2003/03/24 15:58:54 $
0019  * $Revision: 1.14 $
0020  *
0021  * @brief Abstract baseclass for all algoritm-classes.
0022  */
0023 class GTL_EXTERN algorithm {
0024 public:
0025     /** 
0026      * @var algorithm::GTL_OK 
0027      * Used as (positive) return value of algorithm::check and 
0028      * algorithm::run.
0029      */
0030 
0031     /** 
0032      * @var algorithm::GTL_ERROR 
0033      * Used as (negative) return value of algorithm::check and 
0034      * algorithm::run.
0035      */
0036 
0037     /**
0038      * @brief Return values for algorithm::check and algorithm::run
0039      */
0040     enum {
0041     GTL_OK = 1,
0042     GTL_ERROR = 0
0043     };
0044 
0045     /**
0046      * @brief Creates an algorithm object.
0047      */
0048     algorithm () { };
0049     
0050     /**
0051      * @brief Destroys the algorithm object.
0052      */
0053     virtual ~algorithm () { };    
0054 
0055     /**
0056      * @brief Applies %algorithm to %graph g. 
0057      * 
0058      * @param g %graph
0059      * @retval algorithm::GTL_OK on success
0060      * @retval algorithm::GTL_ERROR otherwise
0061      */
0062     virtual int run (graph& g) = 0;
0063     
0064     /**
0065      * @brief Checks whether all preconditions are satisfied.
0066      * 
0067      * @em Please @em note: It is
0068      * definitly required (and #run relies on it),
0069      * that this method was called in advance.
0070      * 
0071      * @param g %graph
0072      * @retval algorithm::GTL_OK if %algorithm can be applied
0073      * @retval algorithm::GTL_ERROR otherwise.
0074      */
0075     virtual int check (graph& g) = 0;
0076     
0077     /**
0078      * @brief Resets %algorithm 
0079      * 
0080      * Prepares the %algorithm to be applied to
0081      * another %graph. @em Please @em note: The options an
0082      * %algorithm may support do @em not get reset by
0083      * this. It is just to reset internally used datastructures.
0084      */
0085     virtual void reset () = 0;
0086 };
0087 
0088 __GTL_END_NAMESPACE
0089 
0090 #endif // GTL_ALGORITHM_H
0091 
0092 //--------------------------------------------------------------------------
0093 //   end of file
0094 //--------------------------------------------------------------------------