home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / ivbvclsp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  4.8 KB  |  108 lines

  1. /*******************************************************************************
  2. * FILE NAME: ivbvclsp.c                                                        *
  3. *                                                                              *
  4. * DESCRIPTION:                                                                 *
  5. *   Class implementation of the class(es):                                     *
  6. *    IVBVariableClassPointer - Variable template class for classes.            *
  7. *                                                                              *
  8. * COPYRIGHT:                                                                   *
  9. *   IBM(R) VisualAge(TM) for C++                                               *
  10. *   (C) Copyright International Business Machines Corporation 1991, 1996       *
  11. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  12. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  13. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  14. *******************************************************************************/
  15.  
  16. #ifndef _IVBVCLSP_
  17.   #include <ivbvclsp.h>
  18. #endif
  19.  
  20. #ifndef _INOTIFEV_
  21.   #include <inotifev.hpp>
  22. #endif
  23.  
  24. #include <ivbdefs.h>
  25.  
  26. /*------------------------------------------------------------------------------
  27. | IVBVariableClassPointer <Element>::IVBVariableClassPointer                   |
  28. |                                                                              |
  29. | Standard constructor.                                                        |
  30. ------------------------------------------------------------------------------*/
  31. template < class Element >
  32. IVBVariableClassPointer <Element>::IVBVariableClassPointer ()
  33.   : IVBVariableClassBase (), iTarget (0)
  34. {
  35. }
  36.  
  37. /*------------------------------------------------------------------------------
  38. | IVBVariableClassPointer <Element>::~IVBVariableClassPointer                  |
  39. |                                                                              |
  40. | Standard destructor.                                                         |
  41. ------------------------------------------------------------------------------*/
  42. template < class Element >
  43. IVBVariableClassPointer <Element>::~IVBVariableClassPointer ()
  44. {
  45.   if (iAutoDeleteTarget) {
  46.     delete iTarget;
  47.   } /* endif */
  48. }
  49.  
  50. /*------------------------------------------------------------------------------
  51. | IVBVariableClassPointer <Element>::target                                    |
  52. |                                                                              |
  53. | Returns the target attribute.                                                |
  54. ------------------------------------------------------------------------------*/
  55. template < class Element >
  56. Element IVBVariableClassPointer <Element>::target () const
  57. {
  58.   return iTarget;
  59. }
  60.  
  61. /*------------------------------------------------------------------------------
  62. | IVBVariableClassPointer <Element>::targetPtr                                 |
  63. |                                                                              |
  64. | Returns the target attribute.                                                |
  65. ------------------------------------------------------------------------------*/
  66. template < class Element >
  67. Element IVBVariableClassPointer <Element>::targetPtr () const
  68. {
  69.   return iTarget;
  70. }
  71.  
  72. /*------------------------------------------------------------------------------
  73. | IVBVariableClassPointer <Element>::setTarget                                 |
  74. |                                                                              |
  75. | Sets the target attribute.                                                   |
  76. ------------------------------------------------------------------------------*/
  77. template < class Element >
  78. IVBVariableClassPointer <Element>&
  79.   IVBVariableClassPointer <Element>::setTarget (Element newTarget)
  80. {
  81.   if (iTarget != newTarget)
  82.   {
  83.     if (iAutoDeleteTarget) {
  84.       delete iTarget;
  85.     } /* endif */
  86.     iTarget = newTarget;
  87.   } /* endif */
  88.   notifyObservers(INotificationEvent(VBINITIALIZEID, *this));
  89.   notifyObservers(INotificationEvent(targetId, *this));
  90.   return *this;
  91. }
  92.  
  93. /*------------------------------------------------------------------------------
  94. | IVBVariableClassPointer <Element>::deleteTarget                              |
  95. |                                                                              |
  96. | Delete the target attribute.                                                 |
  97. ------------------------------------------------------------------------------*/
  98. template < class Element >
  99. IVBVariableClassPointer <Element>&
  100.   IVBVariableClassPointer <Element>::deleteTarget ()
  101. {
  102.   if (iTarget) {
  103.     delete iTarget;
  104.     iTarget = 0;
  105.   } ; /* endif */
  106.   return *this;
  107. }
  108.