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

  1. #ifndef _IPERSIST_
  2.   #define _IPERSIST_
  3.  
  4. /*******************************************************************************
  5. * FILE NAME: ipersist.hpp                                                      *
  6. *                                                                              *
  7. * DESCRIPTION:                                                                 *
  8. *   Declaration of the class(es):                                              *
  9. *    IPersistentObject - Persistent Object Abstract Base Class                 *
  10. *    IPOManager        - Persistent Object Result Set Abstract Base Class      *
  11. *                                                                              *
  12. *******************************************************************************/
  13.  
  14. /***********************************************
  15.  
  16.     Licensed Materials - Property of IBM
  17.  
  18.     5622-880   5801-AAR
  19.  
  20.     (c) Copyright IBM Corp 1991, 1996.
  21.  
  22. ************************************************/
  23.  
  24. #ifndef __TOS_WIN__
  25.  #ifndef DAX_IMPORTEXPORT
  26.    #define DAX_IMPORTEXPORT _Export
  27.  #endif
  28. #else
  29.  #ifndef DAX_IMPORTEXPORT
  30.    #define DAX_IMPORTEXPORT _Import
  31.  #endif
  32. #endif
  33.  
  34. #ifndef _ISTRING_
  35.   #include <istring.hpp>
  36. #endif
  37.  
  38. #ifndef _IDSEXC_HPP
  39.   #include <idsexc.hpp>
  40. #endif
  41.  
  42. #ifndef _ISTDNTFY_
  43.   #include <istdntfy.hpp>
  44. #endif
  45.  
  46. #ifndef __TOS_WIN__
  47.  #ifndef __NO_DEFAULT_LIBS__
  48.    #ifdef __IMPORTLIB__
  49.       #pragma library("CPPOAS3I.LIB")
  50.    #else
  51.       #pragma library("CPPOAS3.LIB")
  52.    #endif
  53.  #endif
  54. #else
  55.  #ifndef __NO_DEFAULT_LIBS__
  56.    #ifdef __IMPORTLIB__
  57.       #pragma library("CPPWAS3I.LIB")
  58.    #else
  59.       #pragma library("CPPWAS3.LIB")
  60.    #endif
  61.  #endif
  62. #endif
  63.  
  64. class IDatastoreBase;
  65.  
  66. /*----------------------------------------------------------------------------*/
  67. /* Align classes on four byte boundary.                                       */
  68. /*----------------------------------------------------------------------------*/
  69. #pragma pack(4)
  70.  
  71. /******************************************************************************/
  72. /* Class: IPersistentObject (Abstract)                                        */
  73. /* Description: This abstract class defines the standard interface for a data */
  74. /*              access class. This class provides data acess to a row of      */
  75. /*              a table.                                                      */
  76. /******************************************************************************/
  77. class DAX_IMPORTEXPORT IPersistentObject : virtual public IBase
  78. {
  79.  
  80. private:
  81. /*----------------------------------------------------------------------------*/
  82. /* data members                                                               */
  83. /*----------------------------------------------------------------------------*/
  84.   Boolean currentlyRetrievable;      // true if the object is retrievable
  85.   const Boolean defaultReadOnly;     // true if the object is read-only by default.
  86.   Boolean currentlyReadOnly;         // true if the set to read-only.
  87.  
  88. protected:
  89.  
  90. /*----------------------------------------------------------------------------*/
  91. /* Constructors                                                               */
  92. /*----------------------------------------------------------------------------*/
  93.   IPersistentObject( const Boolean defReadonly = True );
  94.   IPersistentObject(const IPersistentObject& partCopy);
  95.  
  96. /*----------------------------------------------------------------------------*/
  97. /* Operator functions                                                         */
  98. /*----------------------------------------------------------------------------*/
  99.   IPersistentObject& operator= (const IPersistentObject& aIPersistentObject);
  100.   Boolean operator== (const IPersistentObject& aIPersistentObject) const;
  101.  
  102. public:
  103.  
  104. /*----------------------------------------------------------------------------*/
  105. /* Destructor                                                                 */
  106. /*----------------------------------------------------------------------------*/
  107.   virtual ~IPersistentObject();
  108.  
  109. /*----------------------------------------------------------------------------*/
  110. /* Data Access functions: add, update, del, and retrieve.                     */
  111. /* Add:      This function adds a row to a table.                             */
  112. /* update:   This function updates a row.                                     */
  113. /* del:      This function deletes a row.                                     */
  114. /* retrieve: This function retrieves a row.                                   */
  115. /*----------------------------------------------------------------------------*/
  116.   virtual IPersistentObject& add();
  117.   virtual IPersistentObject& update();
  118.   virtual IPersistentObject& del();
  119.   virtual IPersistentObject& retrieve();
  120.  
  121. /*----------------------------------------------------------------------------*/
  122. /* Functions for object access support:                                       */
  123. /* isRetrievable():     returns true if the object is retrievable.            */
  124. /* isReadOnly():        returns true if the object is set to read only.       */
  125. /* isDefaultReadOnly(): returns true if the object by default is read only.   */
  126. /* setReadOnly(Boolean flag=true): if flag is true, the object is read only.  */
  127. /*                       If flag is false, the object is read write.          */
  128. /* setRetrievable(Boolean flag): set the retrievable attribute.               */
  129. /*----------------------------------------------------------------------------*/
  130.   Boolean isRetrievable() const;
  131.   Boolean isReadOnly() const;
  132.   Boolean isDefaultReadOnly() const;
  133.   IPersistentObject& setReadOnly(Boolean flag = true);
  134.   IPersistentObject& setRetrievable(Boolean flag = true);
  135.  
  136. /*----------------------------------------------------------------------------*/
  137. /* Functions for object display:                                              */
  138. /* asString     returns the object representation as an IString.              */
  139. /* forDisplay   returns a tailored representation of the object as an IString.*/
  140. /* The separator is used between the asString representation of each          */
  141. /* attribute.                                                                 */
  142. /*----------------------------------------------------------------------------*/
  143.  
  144.   virtual IString asString(const char* separator = ".") const = 0;
  145.   virtual IString forDisplay( const char* separator = " " ) const = 0;
  146.  
  147. };
  148.  
  149. /*----------------------------------------------------------------------------*/
  150. /* Class: IPOManager (Abstract)                                               */
  151. /* Description: This abstract class defines the standard interface for a data */
  152. /*              access class. This class provides data acess to a collection  */
  153. /*              of rows from a table.                                         */
  154. /*----------------------------------------------------------------------------*/
  155. class DAX_IMPORTEXPORT IPOManager
  156. {
  157. protected:
  158.  
  159. /*----------------------------------------------------------------------------*/
  160. /* Constructor                                                                */
  161. /*----------------------------------------------------------------------------*/
  162.   IPOManager();
  163.   IPOManager(const IPOManager& partCopy);
  164.  
  165. /*----------------------------------------------------------------------------*/
  166. /* Operator functions                                                         */
  167. /*----------------------------------------------------------------------------*/
  168.   IPOManager& operator= (const IPOManager& aIPOManager);
  169.  
  170. public:
  171.  
  172. /*----------------------------------------------------------------------------*/
  173. /* Destructor                                                                 */
  174. /*----------------------------------------------------------------------------*/
  175.   virtual ~IPOManager();
  176.  
  177. /*----------------------------------------------------------------------------*/
  178. /* Data Access functions: refresh and select.                                 */
  179. /* refresh:  This function retrieves all the rows from a table.               */
  180. /* select:   This function retrieves selected rows from a table based on      */
  181. /*           the conditions described in the clause string.                   */
  182. /*----------------------------------------------------------------------------*/
  183.   virtual IPOManager& refresh () = 0;
  184.   virtual IPOManager& select (const char* clause) = 0;
  185.  
  186. };
  187.  
  188. /*----------------------------------------------------------------------------*/
  189. /* Resume compiler default packing.                                           */
  190. /*----------------------------------------------------------------------------*/
  191. #pragma pack()
  192.  
  193. #endif
  194.  
  195.