Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Method_Request.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Method_Request.h
00006  *
00007  *  $Id: Method_Request.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Andres Kruse <Andres.Kruse@cern.ch>
00010  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00011  */
00012 //=============================================================================
00013 
00014 
00015 #ifndef ACE_METHOD_REQUEST_H
00016 #define ACE_METHOD_REQUEST_H
00017 
00018 #include "ace/pre.h"
00019 
00020 #include "ace/ACE_export.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 #include "Global_Macros.h"
00027 
00028 /**
00029  * @class ACE_Method_Request
00030  *
00031  * @brief Reifies a method into a request.  Subclasses must provide
00032  * the necessary state and behavior.
00033  *
00034  * An ACE_Method_Request is inserted in an ACE_Activation_Queue,
00035  * where it is subsequently removed by a scheduler object (often
00036  * derived from ACE_Task), which invokes the @c call() method.
00037  *
00038  * This class is discussed in depth in the Active Object chapter
00039  * of POSA2.
00040  *
00041  * @sa ACE_Activation_Queue
00042  */
00043 class ACE_Export ACE_Method_Request
00044 {
00045 public:
00046   // = Initialization and termination methods.
00047   /// Constructor.
00048   ACE_Method_Request (unsigned long priority = 0);
00049 
00050   /// Destructor.
00051   virtual ~ACE_Method_Request (void);
00052 
00053   // = Accessors.
00054   /// Get priority.
00055   unsigned long priority (void) const;
00056 
00057   /// Set priority.
00058   /**
00059    * Priority values are user-defined. The default (set in the constructor)
00060    * is 0. The priority value is used in the ACE_Activation_Queue::enqueue()
00061    * method to order the method requests in the queue by priority.
00062    * 0 is the lowest priority.
00063    *
00064    * @param prio   unsigned long, the new priority value for this object.
00065    *
00066    * @sa ACE_Activation_Queue::enqueue
00067    */
00068   void priority (unsigned long prio);
00069 
00070   // = Invocation method (must be overridden by subclasses).
00071   /// Invoked by the scheduler to execute the request.
00072   /**
00073    * This method must be implemented by the subclass to perform the
00074    * desired actions.
00075    *
00076    * @return int; not interpreted by ACE. The scheduler class must
00077    *         decide the meaning of this return value and act on it
00078    *         if needed.
00079    */
00080   virtual int call (void) = 0;
00081 
00082 protected:
00083   /// The priority of the request.
00084   unsigned long priority_;
00085 
00086 private:
00087   ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Method_Request &))
00088   ACE_UNIMPLEMENTED_FUNC (ACE_Method_Request (const ACE_Method_Request &))
00089 };
00090 
00091 
00092 #include "ace/post.h"
00093 #endif /* ACE_METHOD_REQUEST_H */

Generated on Mon Jun 16 11:20:26 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002