home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / base / clntset.h < prev    next >
C/C++ Source or Header  |  1995-04-08  |  4KB  |  116 lines

  1.  
  2.  
  3. #ifndef _clntset_h_ /* Tue Mar  8 15:35:57 1994 */
  4. #define _clntset_h_
  5.  
  6.  
  7.  
  8.  
  9.  
  10. /*
  11.  *
  12.  *          Copyright (C) 1994, M. A. Sridhar
  13.  *  
  14.  *
  15.  *     This software is Copyright M. A. Sridhar, 1994. You are free
  16.  *     to copy, modify or distribute this software  as you see fit,
  17.  *     and to use  it  for  any  purpose, provided   this copyright
  18.  *     notice and the following   disclaimer are included  with all
  19.  *     copies.
  20.  *
  21.  *                        DISCLAIMER
  22.  *
  23.  *     The author makes no warranties, either expressed or implied,
  24.  *     with respect  to  this  software, its  quality, performance,
  25.  *     merchantability, or fitness for any particular purpose. This
  26.  *     software is distributed  AS IS.  The  user of this  software
  27.  *     assumes all risks  as to its quality  and performance. In no
  28.  *     event shall the author be liable for any direct, indirect or
  29.  *     consequential damages, even if the  author has been  advised
  30.  *     as to the possibility of such damages.
  31.  *
  32.  */
  33.  
  34.  
  35.  
  36.  
  37. // This is a set of bindings and corresponding parameters, used for maintaining
  38. // client sets for notification.
  39.  
  40. #ifdef __GNUC__
  41. #pragma interface
  42. #endif
  43.  
  44.  
  45. #include "base/objset.h"
  46. #include "base/binding.h"
  47.  
  48.     
  49. class CL_EXPORT CL_ClientSet: public CL_ObjectSet {
  50.  
  51. public:
  52.     ~CL_ClientSet ();
  53.  
  54.     bool Add    (const CL_AbstractBinding& binding, long parameter);
  55.     // Add the given binding-parameter pair to this set. Return FALSE if
  56.     // either memory allocation failed or the pair was already in the set,
  57.     // and TRUE otherwise.
  58.  
  59.     bool Remove   (const CL_AbstractBinding& binding);
  60.     // Remove the given binding, and its associated parameter, from the set.
  61.     // Return FALSE if there was no such binding in the set, and TRUE
  62.     // otherwise.
  63.  
  64.     bool Includes (const CL_AbstractBinding& binding) const;
  65.     // Return whether this set includes the given binding.
  66.  
  67.  
  68.     long& CodeFor (const CL_AbstractBinding& binding) const;
  69.     // Return a reference to the parameter value associated with the given
  70.     // binding. The caller of this method may modify the return value. If
  71.     // the set does not contain the given binding, a reference to an
  72.     // undefined long value is returned.
  73.     
  74.     void NotifyAll (CL_Object& source) const;
  75.     // Execute all the contained bindings, with the given object as first
  76.     // parameter, and the remembered second parameter. Ignore the return
  77.     // values of the executed bindings.
  78.     
  79.     bool Permits (CL_Object& source) const;
  80.     // Execute all the contained bindings, with the given object as first
  81.     // parameter, and the remembered second parameter; return TRUE if all
  82.     // of them return TRUE, and FALSE otherwise. The notification process
  83.     // stops as soon as one of the bindings returns FALSE, so that
  84.     // subsequent bindings in the set are not invoked. Here, each
  85.     // binding's return value is viewed as "permission" from the client to
  86.     // perform some operation, and this method's return value is TRUE only
  87.     // if all contained bindings permit it.
  88.  
  89.     // Disallow some inherited methods!
  90.     
  91.     bool Add    (const CL_ObjectPtr&)
  92.         {NotImplemented ("Add object"); return FALSE;};
  93.     // This method issues a "Not implemented" error message, and must not be
  94.     // called. It is declared here to override the inherited method with
  95.     // the same signature.
  96.     
  97.     CL_ObjectPtr Remove   (const CL_ObjectPtr&)
  98.         {NotImplemented ("Remove object"); return FALSE;};
  99.     // This method issues a "Not implemented" error message, and must not be
  100.     // called. It is declared here to override the inherited method with
  101.     // the same signature.
  102.     
  103.     bool Includes (const CL_ObjectPtr&) const
  104.         {NotImplemented ("Remove object"); return FALSE;};
  105.     // This method issues a "Not implemented" error message, and must not be
  106.     // called. It is declared here to override the inherited method with
  107.     // the same signature.
  108.     
  109.     const char* ClassName () const {return "CL_ClientSet";};
  110.     // Override method inherited from CL_Object.
  111.  
  112. };
  113.  
  114.  
  115. #endif /* _clntset_h_ */
  116.