home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / som / include / po.idl < prev    next >
Text File  |  1999-02-22  |  8KB  |  247 lines

  1. //
  2. //   COMPONENT_NAME: somp
  3. //
  4. //   ORIGINS: 27
  5. //
  6. //
  7. //    25H7912  (C)  COPYRIGHT International Business Machines Corp. 1992,1994,1996 
  8. //   All Rights Reserved
  9. //   Licensed Materials - Property of IBM
  10. //   US Government Users Restricted Rights - Use, duplication or
  11. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12. //
  13. //#  @(#) 2.11 src/somp/po.idl, somp, som2.1 12/26/95 16:59:15 [7/30/96 14:46:57]
  14.  
  15.  
  16.  
  17. #ifndef po_idl
  18. #define po_idl
  19.  
  20. #include <somobj.idl>
  21. #include <somcls.idl>
  22. #include <somp.idl>
  23. #include <somperrd.idl>
  24.  
  25.  
  26. interface SOMPIdAssigner;
  27. interface SOMPEncoderDecoderAbstract;
  28. interface SOMPIOGroup;
  29. interface SOMPPersistentId;
  30. interface M_SOMPPersistentObject;
  31.  
  32. interface SOMPPersistentObject : SOMObject
  33. {
  34.    const unsigned short SOMP_STATE_UNDEFINED   = 0x8000;
  35.    const unsigned short SOMP_STATE_UNSTABLE    = 0x4000;
  36.    const unsigned short SOMP_STATE_STABLE      = 0x1000;
  37.    const unsigned short SOMP_STATE_DIRTY       = 0x0800;
  38.    const unsigned short SOMP_STATE_COMPACT     = 0x0400;
  39.  
  40.    void sompInitNextAvail(in SOMPIdAssigner thisAssigner) raises(SOMPError::sompException);
  41.    void sompInitNearObject(in SOMPPersistentObject nearObject) raises(SOMPError::sompException);
  42.    void sompInitGivenId(in SOMPPersistentId thisId) raises(SOMPError::sompException);
  43.    SOMPPersistentId sompGetPersistentId();
  44.  
  45.    string sompGetPersistentIdString(in string outBuff);
  46. // Get persistent ID. Returns string representation of persistent ID.
  47. // Puts the fully-qualified persistent object ID in the caller-supplied
  48. // buffer.  (The caller must allocate the memory for the buffer, and
  49. // is also responsible for freeing it when appropriate.)
  50.  
  51.    void sompSetEncoderDecoderName(in string myName);
  52. // Set the class name of the EncoderDecoder.
  53. // If this method is not called, the encoder/decoder class name is the
  54. // one returned by the class object.
  55.  
  56.    string sompGetEncoderDecoderName();
  57. // Get the class name of the EncoderDecoder
  58.  
  59.    boolean sompEquals(in SOMPPersistentId otherId);
  60. // Checks to see if this object's ID is equivalent to the given ID.
  61. // Returns TRUE if the ID's are equivalent, FALSE otherwise.
  62.  
  63.    void sompPassivate();
  64. // This method is called by the persistence framework just prior
  65. // to saving a persistent object.  It provides a means for a
  66. // client to tidy up any data necessary in the persistent object
  67. // (or its embedded objects) before the save operation is
  68. // completed.  This method does nothing if not overridden by the
  69. // client.
  70.  
  71.    void sompActivated();
  72. // This method is called by the persistence framework after a
  73. // persistent object is restored.  It provides a means for a client
  74. // to perform any initializations prior to the use of the persistent
  75. // object. That is, make the object useable. If not overridden, this
  76. // method sets the state of the object to POSTATE_STABLE.
  77.  
  78.  
  79.    string sompGetRelativeIdString (in SOMObject ifNearThisObject,
  80.                    in string relativeIdString);
  81. // if the persistent object is in the same IOGroup as <ifNearThisObject>,
  82. // places an Id string of the form:
  83. //
  84. //            <IOGroupMgrClassName>:$RELATIVE:<offset>
  85. //
  86. // in relativeIdString, else places a fully-qualified Id of the form:
  87. //
  88. //            <IOGroupMgrClassName>:<path/filename>:<offset>
  89. //
  90. // in relativeIdString.  Returns pointer to relativeIdString through the
  91. // operation name.  Note: the caller must allocate relativeIdString prior
  92. // to invoking the operation.
  93.  
  94.    SOMPIOGroup sompInitIOGroup(in SOMObject nearPersistentObj);
  95. // Initialize the IO group for this object. (Used at InitPersistentID time)
  96. // Each persistent object is a member of an I/O Group. An I/O Group
  97. // can consist of one or more persistent objects.
  98. //
  99. // The I/O Group in which this persistent object is a member is
  100. // determined by the "nearPersistentObj" argument.
  101. // If given nearPersistentObj is NULL, a new IOGroup may be instantiated.
  102. // Otherwise, nearPersistentObj is expected to be a persistent object with
  103. // an existing IOGroup. This object is made a member of the
  104. // nearPersistentObj I/O Group.
  105. //
  106. // An I/O Group offset is assigned by this method. This offset may
  107. // be returned via sompGetPersistentOffset on the ID of this object.
  108.  
  109.    void sompSetDirty();
  110. // Sets the state of an object to dirty.  Front method for SetState.
  111.  
  112.    boolean sompIsDirty();
  113. // This is used for optimization.  The default always returns TRUE.  Optimized
  114. // persistent objects can override this to return sompGetDirty(), and then
  115. // be sure to invoke sompSetDirty() whenever the object is updated.
  116.  
  117.    boolean sompGetDirty();
  118. // This returns TRUE if the dirty bit is set, FALSE otherwise.
  119.  
  120.    void sompMarkForCompaction();
  121. // Note to the Persistence Framework that the next time this object is
  122. // saved, the entire IO Group should be compacted, if possible.
  123.  
  124.    void sompSetState(in unsigned short state);
  125. // Sets specified state.
  126. // See po.csc for a description of the possible states.
  127.  
  128.    boolean sompCheckState(in unsigned short state);
  129. // Returns TRUE if given state is true for this object.
  130. // See po.csc for a description of the possible states.
  131.  
  132.    void sompClearState(in unsigned short state);
  133. // Clears specified state.
  134.  
  135.    SOMPEncoderDecoderAbstract sompGetEncoderDecoder();
  136. // If an Encoder/Decoder has not already been instantiated, one
  137. // is instantiated. A pointer to the encoder/decoder is
  138. // returned. NULL is returned if this object's encoder/decoder
  139. // cannot be instantiated.  This method should only be used by the IO Group
  140. // Mgr class.
  141.  
  142.    void sompFreeEncoderDecoder();
  143. // Free this object's encoder/decoder. This method should only be used
  144. // by the IO Group Manager class.
  145.  
  146.    SOMPIOGroup sompGetIOGroup();
  147. // Get a pointer to the IOGroup collection object for this object.
  148. // Within the returned collection are this object and any objects
  149. // initialized near it (with sompInitNearObject). This method is intended
  150. // to be use by IO Group Mgr implementors.
  151.  
  152.  
  153. #ifdef __SOMIDL__
  154.  
  155. implementation
  156. {
  157.   callstyle=idl;
  158.   dllname="somp.dll";
  159.  
  160.   releaseorder: sompInitNextAvail, sompInitNearObject,
  161.         sompInitGivenId, sompGetPersistentId,
  162.         sompGetPersistentIdString, sompSetEncoderDecoderName,
  163.         sompGetEncoderDecoderName, sompRegisterPersistentPointer,
  164.         sompUnRegisterPersistentPointer, sompPersistentPointerCount,
  165.         sompGetNthPersistentPointer, sompEquals,
  166.         sompPassivate, sompActivated,
  167.         sompGetRelativeIdString, sompUnInitIOGroup,
  168.         sompSetDirty, sompMarkForCompaction,
  169.         sompSetState, sompCheckState,
  170.         sompClearState, sompInitIOGroup,
  171.         sompGetEncoderDecoder, sompFreeEncoderDecoder,
  172.         sompGetIOGroup, sompSetIOGroup,
  173.         sompGetStoredLength, sompSetStoredLength,
  174.         sompGetMIOffset, sompSetMIOffset,
  175.         sompIsDirty, sompGetDirty;
  176.  
  177. //# Class Modifiers
  178.    majorversion = 2;
  179.    minorversion = 1;
  180.    filestem = po;
  181.    metaclass = M_SOMPPersistentObject;
  182.  
  183.  
  184. // Method Modifiers
  185.    somDumpSelfInt: override;
  186.    somInit: override;
  187.    somUninit: override;
  188.  
  189. };
  190.  
  191. #endif /* __SOMIDL__ */
  192. };
  193.  
  194. // ************************************************************************
  195. // *                    PERSISTENT OBJECT METACLASS                       *
  196. // ************************************************************************
  197.  
  198. interface M_SOMPPersistentObject : SOMClass
  199. {
  200.    #ifdef _WIN16
  201.    #endif /* _WIN16 */
  202.  
  203.    void sompSetClassLevelEncoderDecoderName(in string myName);
  204. // Set Encoder/Decoder name at the class level
  205.  
  206.    string sompGetClassLevelEncoderDecoderName();
  207. // Get class level Encoder/Decoder name.
  208.  
  209. #ifdef __SOMIDL__
  210.  
  211. implementation
  212. {
  213.   callstyle=idl;
  214.   dllname="somp.dll";
  215.   #ifdef _WIN16
  216.     releaseorder: reserved1, reserved2, reserved3, reserved4,
  217.           sompSetClassLevelEncoderDecoderName,
  218.           sompGetClassLevelEncoderDecoderName;
  219.   #else
  220.     releaseorder: sompRegisterEDPair, sompGetTotalEDPairs,
  221.           sompGetNthEDPair, sompGetNthEDPairObj,
  222.           sompSetClassLevelEncoderDecoderName,
  223.           sompGetClassLevelEncoderDecoderName;
  224.   #endif /* _WIN16 */
  225.  
  226.  
  227. // Class Modifiers
  228.    majorversion = 2;
  229.    minorversion = 1;
  230.    functionprefix = SOMPPersistentMeta_; filestem = po;
  231.  
  232. // Internal Instance Variables
  233.  
  234.  
  235. // Method Modifiers
  236.    somInit: override;
  237.    #ifdef _WIN16
  238.      somUninit: override;
  239.    #endif
  240.  
  241. };
  242. #endif /* __SOMIDL__ */
  243.  
  244. };
  245.  
  246. #endif  /* po_idl */
  247.