00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Method_Request.h 00006 * 00007 * Method_Request.h,v 4.19 2005/11/26 03:13:13 ossama 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 "ace/Global_Macros.h" 00027 00028 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00029 00030 /** 00031 * @class ACE_Method_Request 00032 * 00033 * @brief Reifies a method into a request. Subclasses must provide 00034 * the necessary state and behavior. 00035 * 00036 * An ACE_Method_Request is inserted in an ACE_Activation_Queue, 00037 * where it is subsequently removed by a scheduler object (often 00038 * derived from ACE_Task), which invokes the @c call() method. 00039 * 00040 * This class is discussed in depth in the Active Object chapter 00041 * of POSA2. 00042 * 00043 * @sa ACE_Activation_Queue 00044 */ 00045 class ACE_Export ACE_Method_Request 00046 { 00047 public: 00048 // = Initialization and termination methods. 00049 /// Constructor. 00050 ACE_Method_Request (unsigned long priority = 0); 00051 00052 /// Destructor. 00053 virtual ~ACE_Method_Request (void); 00054 00055 // = Accessors. 00056 /// Get priority. 00057 unsigned long priority (void) const; 00058 00059 /// Set priority. 00060 /** 00061 * Priority values are user-defined. The default (set in the constructor) 00062 * is 0. The priority value is used in the ACE_Activation_Queue::enqueue() 00063 * method to order the method requests in the queue by priority. 00064 * 0 is the lowest priority. 00065 * 00066 * @param prio unsigned long, the new priority value for this object. 00067 * 00068 * @sa ACE_Activation_Queue::enqueue 00069 */ 00070 void priority (unsigned long prio); 00071 00072 // = Invocation method (must be overridden by subclasses). 00073 /// Invoked by the scheduler to execute the request. 00074 /** 00075 * This method must be implemented by the subclass to perform the 00076 * desired actions. 00077 * 00078 * @return int; not interpreted by ACE. The scheduler class must 00079 * decide the meaning of this return value and act on it 00080 * if needed. 00081 */ 00082 virtual int call (void) = 0; 00083 00084 private: 00085 00086 /// Disallow copying and assignment. 00087 ACE_Method_Request (const ACE_Method_Request &); 00088 void operator= (const ACE_Method_Request &); 00089 00090 protected: 00091 /// The priority of the request. 00092 unsigned long priority_; 00093 00094 }; 00095 00096 ACE_END_VERSIONED_NAMESPACE_DECL 00097 00098 00099 #include /**/ "ace/post.h" 00100 #endif /* ACE_METHOD_REQUEST_H */