home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Found / FWStream / Include / SLMemSin.xh < prev    next >
Encoding:
Text File  |  1996-08-16  |  3.8 KB  |  175 lines  |  [TEXT/MPS ]

  1.  
  2. /*
  3.  * This file was generated by the SOM Compiler.
  4.  * FileName: SLMemSin.xh.
  5.  * Generated using:
  6.  *     SOM Precompiler somipc: 2.18
  7.  *     SOM Emitter emitxh.dll: 2.33
  8.  */
  9.  
  10. /*
  11.  * 
  12.  *     File:        SLMemSin.idl
  13.  * 
  14.  *     Contains:    Interface for the memory sink class
  15.  * 
  16.  *     Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  17.  * 
  18.  */
  19.  
  20.  
  21. #ifndef SOM_FW_OMemorySink_xh
  22. #define SOM_FW_OMemorySink_xh
  23.  
  24. class FW_OMemorySink;
  25.  
  26. #define FW_OMemorySink_MajorVersion 1
  27. #define FW_OMemorySink_MinorVersion 0
  28.  
  29. /*
  30.  * Passthru lines: File: "C.xh", "before"
  31.  */
  32.  
  33.  
  34. /* C++ SOM defs */
  35. #include <somcls.xh>
  36. #include <somcm.xh>
  37.  
  38. /* C++ parent defs */
  39. #ifndef SOM_FW_ORandomAccessSink_xh
  40. #include <SLRanSin.xh>
  41. #endif
  42.  
  43. #ifndef FW_OMemorySink_API
  44. #define FW_OMemorySink_API
  45. /*
  46.  * -- The Class API
  47.  */
  48.  
  49. /*
  50.  * Start of user-defined types:
  51.  */
  52. class SOMClass;
  53. class SOMObject;
  54. class FW_OSink;
  55. class FW_ORandomAccessSink;
  56. class FW_OMemorySink;
  57.  
  58. /*
  59.  * End of user-defined types.
  60.  */
  61.  
  62. #ifdef OLDIBMSOMAPISUPPORT
  63. #define FW_OMemorySinkCClassData FW_OMemorySinkClassData
  64. #define FW_OMemorySinkNewClass(major,minor) somNewVersionedClassReference(FW_OMemorySink,major,minor)
  65. #endif
  66.  
  67. /* define xxxMetaClass macro to facilitate (cls ## MetaClass) */
  68. #define FW_OMemorySinkMetaClass SOMClass
  69.  
  70. #if PRAGMA_ALIGN_SUPPORTED
  71. #  pragma options align=power
  72. #endif
  73.  
  74. /* The API to the FW_OMemorySink class object, and the methods it introduces. */
  75. SOMEXTERN struct FW_OMemorySinkClassDataStructure {
  76. #ifdef OLDIBMSOMAPISUPPORT
  77.     SOMClass            *classObject;    /* always zero, use somNewClassReference instead */
  78. #else
  79.     long zero;
  80. #endif
  81.     somStaticClassInfo *sci;
  82.     somDToken        instanceDataToken;
  83.     long reserved [3];
  84.     somMToken InitFromBuffer;
  85. } SOMDLINK FW_OMemorySinkClassData;
  86.  
  87. #if PRAGMA_ALIGN_SUPPORTED
  88. #  pragma options align=reset
  89. #endif
  90.  
  91. #if !defined(FW_OMemorySink_Class_Source) && !defined(SOM_Module_slmemsin_Source)
  92. #if PRAGMA_IMPORT_SUPPORTED
  93. #pragma import list FW_OMemorySinkClassData
  94. #endif
  95. #endif
  96.  
  97.  
  98. /*
  99.  * -- Typedefs and inline method declarations for left path inherited methods
  100.  * -- are omitted because this compilation had -museinheritedmethods in effect
  101.  */
  102.  
  103.  
  104. /*
  105.  * -- Typedefs for FW_OMemorySink Method Procedures
  106.  */
  107. SOMEXTERN {
  108. typedef void   (* SOMLINK somTD_FW_OMemorySink_InitFromBuffer)(FW_OMemorySink *somSelf, Environment *ev,
  109.         void* buffer,
  110.         long capacity,
  111.         long length);
  112. }
  113.  
  114. #endif /* FW_OMemorySink_API */
  115.  
  116.  
  117. /*
  118.  * -- This emitter treats Method Tokens as Thunks by default.
  119.  * -- Use the sc modifier "nothunks" to change this default
  120.  */
  121. #undef somresolve_
  122. #define somresolve_(obj,mToken) ((somMethodProc*)((void)obj, mToken))
  123.  
  124. /*
  125.  * -- The C++ Wrapper Class for FW_OMemorySink
  126.  */
  127. class FW_OMemorySink : public FW_ORandomAccessSink
  128. {
  129. public:
  130.  
  131. // FW_OMemorySink::new registers use of the class object, and then uses somNew
  132. // to allocate memory and load the object method table pointer. 
  133. void *operator new(size_t size)
  134. {
  135.     SOM_IgnoreWarning(size);
  136.     // Allocate memory using the default allocator for FW_OMemorySink, and
  137.     // clear mem & set method table pointer, call basic initialization
  138. #ifdef SOMCHKNULL
  139.     void * __somResult = (void *)
  140.       somNewObject(FW_OMemorySink);
  141.     SOMCHKNULL(__somResult);
  142.     return __somResult;
  143. #else
  144.     return (void*) somNewObject(FW_OMemorySink);
  145. #endif
  146. }
  147.  
  148. // FW_OMemorySink::delete uses the default deallocator for the object's class.
  149. void operator delete(void * obj)
  150. {
  151.     if (obj) {
  152.         SOM_Resolve(obj,SOMObject,somFree)
  153.            ( (SOMObject*) obj );
  154.     }
  155. }
  156.  
  157. /* method: InitFromBuffer */
  158. void   InitFromBuffer(Environment *ev,
  159.         void* buffer,
  160.         long capacity,
  161.         long length)
  162. {
  163.    SOM_ResolveD(this,FW_OMemorySink,FW_OMemorySink,InitFromBuffer)
  164.     (this,ev,buffer,capacity,length);
  165. #ifdef SOMCHKEXCEPT
  166.       SOMCHKEXCEPT;
  167. #endif
  168. }
  169.  
  170. };   /* FW_OMemorySink */
  171.  
  172.  
  173.  
  174. #endif       /* SOM_FW_OMemorySink_xh */
  175.