home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12otk1.exe / include / compmgr.idl < prev    next >
Text File  |  1997-04-02  |  14KB  |  363 lines

  1. //#====START_GENERATED_PROLOG======================================
  2. //#
  3. //#
  4. //#   COMPONENT_NAME: odscript
  5. //#
  6. //#   CLASSES: none
  7. //#
  8. //#   ORIGINS: 27
  9. //#
  10. //#
  11. //#   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  12. //#   All Rights Reserved
  13. //#   Licensed Materials - Property of IBM
  14. //#   US Government Users Restricted Rights - Use, duplication or
  15. //#   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  16. //#       
  17. //#   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18. //#   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  19. //#   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  20. //#   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  21. //#   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  22. //#   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  23. //#   OR PERFORMANCE OF THIS SOFTWARE.
  24. //#
  25. //#====END_GENERATED_PROLOG========================================
  26. //#
  27. // @(#) 1.3 com/src/odscript/idl/compmgr.idl, odscript, od96os2, odos29712d 10/31/96 12:44:07 [3/21/97 17:43:04]
  28. // ===========================================================================
  29. //
  30. // Component manager
  31. //
  32. // Component Manager (as opposed to Component Manager Server) will reside in
  33. // the users storage and will communicate with the Server.  It is possible
  34. // that the server will actually be 'remote' or at least in a separate process.
  35. // though that is not in fact implemented at this time.
  36. //
  37. // Provides interface for management of the Component Registry.
  38. //
  39. // Provides the services needed in the current process to actuall create
  40. // an instance of a Component based on information from the Server.
  41. //
  42. // Interfaces provided to search the registry, add entries, remove entries
  43. // get the information from an entry, create an instance of a Component, etc
  44. //
  45. // ===========================================================================
  46.  
  47. #ifndef _COMPONENT_
  48. #include <comp.idl>
  49. #endif
  50.  
  51. #ifndef _COMPONENTMANAGER_
  52. #define _COMPONENTMANAGER_
  53.  
  54. //==============================================================================
  55. // Classes defined in this interface
  56. //==============================================================================
  57.  
  58. interface ComponentManager;
  59. interface M_ComponentManager;
  60.  
  61. //==============================================================================
  62. // Classes used by this interface
  63. //==============================================================================
  64.  
  65. interface Component;
  66.  
  67. //==============================================================================
  68. // Implementation Types
  69. //==============================================================================
  70.  
  71. #if defined(__SOMIDL__) && defined(EMIT_COMPMGR_TYPES)
  72. #pragma somemittypes on
  73. #endif
  74.  
  75.  
  76. typedef unsigned long OSType;
  77.  
  78. struct ComponentDescription {
  79.         OSType  componentType;
  80.         OSType  componentSubType;
  81.         OSType  componentManufacturer;
  82.         ODULong componentVersion ;
  83.         ODULong componentFlags;
  84.         ODULong componentFlagsMask;
  85. };
  86.  
  87.  
  88. const   ODULong CMGR_MAX_STRING    = 256;
  89.  
  90. typedef char CMGRString[CMGR_MAX_STRING];
  91.  
  92. struct ComponentRegistryData {
  93.         OSType        componentType;
  94.         OSType        componentSubType;
  95.         OSType        componentManufacturer;
  96.         ODULong       componentFlags;
  97.         ODULong       componentVersion;
  98.         CMGRString    componentDLL;           // dll name string
  99.         CMGRString    componentClassName;     // som class name
  100.         CMGRString    componentName;          // name string
  101.         CMGRString    componentInfo;          // info string
  102. };
  103.  
  104.  
  105. #if defined(__SOMIDL__) && defined(COMPMGR_EMIT_TYPES)
  106. #pragma somemittypes off
  107. #endif
  108.  
  109. //==============================================================================
  110. // Class ComponentManager
  111. //==============================================================================
  112.  
  113. interface M_ComponentManager : SOMClass {
  114.  
  115.  
  116. #ifdef __SOMIDL__
  117.  
  118.  
  119. implementation {
  120.  
  121.         Environment    ev;
  122.  
  123.         majorversion = 1;
  124.         minorversion = 0;
  125.         functionprefix = M_CMGR_;
  126.         releaseorder : Reserved1;
  127.         somDefaultInit: override, init;
  128.         somDestruct: override;
  129.         dllname = "oddsscr.dll";
  130. };
  131.  
  132. #endif
  133.  
  134. };
  135.  
  136. interface ComponentManager : SOMObject {
  137.  
  138. //---------------------------------------------------------------------------
  139. //
  140. // Function - CountComponents
  141. //
  142. // Inputs - pointer to Component Description block that specifies the
  143. //          components to be counted.
  144. //
  145. // Outputs - Count of matching Components as returned by the server.
  146. //
  147. // Description - Invokes the corresponding server method to compute the count
  148. //
  149. //---------------------------------------------------------------------------
  150.  
  151. ODULong      CountComponents(in ComponentDescription *plooking);
  152.  
  153. //---------------------------------------------------------------------------
  154. //
  155. // Function - FindNextComponent
  156. //
  157. // Inputs - pointers to three Component Description blocks.  plastFound (if
  158. //          not null) indicates the Type and SubType of the last Component
  159. //          found and thus controls where the search continues.  plooking
  160. //          specifies the search criteria, and pfound will receive the Type
  161. //          SubType, Flags and Manufacturer values for a matching entry
  162. //
  163. // Outputs - Returns zero if successful or non-zero if an error or no matching
  164. //           entry was found.
  165. //
  166. // Description - The corresponding server function is used to do the search.
  167. //
  168. //---------------------------------------------------------------------------
  169.  
  170. OSErr        FindNextComponent(in ComponentDescription *plastFound,
  171.                                in ComponentDescription *plooking,
  172.                                out ComponentDescription pfound);
  173.  
  174. //---------------------------------------------------------------------------
  175. //
  176. // Function - GetComponentInfo
  177. //
  178. // Inputs - pointer to a ComponentDescription block that specifies the Type and
  179. //          SubType of the Component for which information is requested.
  180. //          Pointers to a CMGRString for each of the values being requested -
  181. //          ClassName, DLL name, Name and Info.  Any of these pointers may
  182. //          be null.
  183. //
  184. // Outputs - If the search is successful, the indicated CMGRString areas will
  185. //           be set to reflect the string value returned by the server.
  186. //
  187. // Description - The corresponding server routine is used to get the
  188. //              information. The storage allocated by the server is released
  189. //              after the information is copied to the target area.
  190. //
  191. //---------------------------------------------------------------------------
  192.  
  193. OSErr        GetComponentInfo(in ComponentDescription *ptheComponent,
  194.                               out char pcomponentClassName,
  195.                               out char pcomponentDLL,
  196.                               out char pcomponentName,
  197.                               out char pcomponentInfo);
  198.  
  199. //---------------------------------------------------------------------------
  200. //
  201. // Function - GetComponentRefcon
  202. //
  203. // Inputs - ComponentDescription block that specifies the Type and SubType
  204. //              of the Component for which the Refcon is to be accessed.
  205. //
  206. // Outputs - Returns the Refcon value returned by the server
  207. //
  208. // Description - The server will access the Refcon from shared storage based
  209. //              on the Type/SubType passed in.  Note Only OS/2 is currently
  210. //              fully implemented.
  211. //
  212. //---------------------------------------------------------------------------
  213.  
  214. ODSLong      GetComponentRefcon(in ComponentDescription *ptheComponent);
  215.  
  216. //---------------------------------------------------------------------------
  217. //
  218. // Function - SetComponentRefcon
  219. //
  220. // Inputs - ComponentDescription block that specifies the Type and Subtype
  221. //          of the component.
  222. //          long integer that specifies the Refcon value.
  223. //
  224. // Outputs - none
  225. //
  226. // Description - The specified value will be set into shared storage based
  227. //              on the Type/SubType specified.  Note: Only OS/2 is fully
  228. //              implemented at this time.
  229. //
  230. //---------------------------------------------------------------------------
  231.  
  232. void         SetComponentRefcon(in ComponentDescription *ptheComponent,
  233.                                 in ODSLong Refcon);
  234.  
  235. //---------------------------------------------------------------------------
  236. //
  237. // Function - OpenComponent
  238. //
  239. // Inputs - Component Description block that specifies the Component requested.
  240. //
  241. // Outputs - Returns a pointer to an instance of the component described or
  242. //           NULL if no matching component was found.
  243. //
  244. // Description - Will use the Server to get the ClassName and DLL name of the
  245. //              component class described.  That information is used to create
  246. //              an instance of that class that is returned to the caller
  247. //
  248. //---------------------------------------------------------------------------
  249.  
  250. Component    OpenComponent(in ComponentDescription *ptheComponent);
  251.  
  252. //---------------------------------------------------------------------------
  253. //
  254. // Function - OpenDefaultComponent (a misnomer)
  255. //
  256. // Inputs - Type and SubType codes that specify the desired component
  257. //
  258. // Outputs - returns a pointer to an instance of the component that supports
  259. //           the Type/SubType specified, or NULL if no such component could be
  260. //           located.
  261. //
  262. // Description - Invokes the corresponding Server method to get the class name
  263. //              and DLL name for the class that supports the specified Component
  264. //              That information is used to create an instance of the
  265. //              class which is returned to the caller.
  266. //
  267. //---------------------------------------------------------------------------
  268.  
  269. Component    OpenDefaultComponent(in OSType componentType,
  270.                                   in OSType componentSubType);
  271.  
  272. //---------------------------------------------------------------------------
  273. //
  274. // Function - CloseComponent
  275. //
  276. // Inputs - pointer to an instance of the Component class.
  277. //
  278. // Outputs - returns zero if the reference was valid and non zero if the
  279. //           reference was null.
  280. //
  281. // Description - Will release the component indicated by the reference.
  282. //
  283. //---------------------------------------------------------------------------
  284.  
  285. OSErr        CloseComponent(in Component theComponentInstance);
  286.  
  287. //---------------------------------------------------------------------------
  288. //
  289. // Function - InstallComponent
  290. //
  291. // Inputs - ComponentRegistryData block describing the Component to be
  292. //              added to the Registry
  293. //
  294. // Outputs - Returns zero if successful or non-zero if an error occurs
  295. //
  296. // Description - Invokes the corresponding Server method.
  297. //
  298. //---------------------------------------------------------------------------
  299.  
  300. OSErr        InstallComponent(in ComponentRegistryData *ptheData);
  301.  
  302. //---------------------------------------------------------------------------
  303. //
  304. // Function - UninstallComponent
  305. //
  306. // Inputs - Type and SubType specifying the Registry entry to be removed.
  307. //
  308. // Outputs - returns zero if successful or non-zero if an error.
  309. //
  310. // Description - Invokes the corresponding Server method
  311. //
  312. //---------------------------------------------------------------------------
  313.  
  314. OSErr        UninstallComponent(in OSType componentType,
  315.                                 in OSType componentSubType);
  316.  
  317. #ifdef __SOMIDL__
  318.  
  319. implementation
  320. {
  321.  
  322.         majorversion = 1;
  323.         minorversion = 0;
  324.         dllname = "oddsscr.dll";
  325.         metaclass = M_ComponentManager;
  326.         functionprefix = CMGR_;
  327.         releaseorder :  CountComponents,
  328.                         FindNextComponent,
  329.                         GetComponentInfo,
  330.                         GetComponentRefcon,
  331.                         SetComponentRefcon,
  332.                         OpenComponent,
  333.                         OpenDefaultComponent,
  334.                         CloseComponent,
  335.                         InstallComponent,
  336.                         UninstallComponent;
  337.         somDefaultInit: override, init;
  338.         somDestruct: override;
  339.  
  340.         passthru C_xh  = "// macro UlongToStr(L,S) - use to convert the unsigned long "
  341.                          "//    value L to a string in the array S.  S must be at least"
  342.                          "//    five characters wide"
  343.                          "#define UlongToStr(L,S)  S[0] = (char) ((L >> 24) & 0xff) ; \ "
  344.                          "                         S[1] = (char) ((L >> 16) & 0xff) ; \ "
  345.                          "                         S[2] = (char) ((L >>  8) & 0xff) ; \ "
  346.                          "                         S[3] = (char) ((L >>  0) & 0xff) ; \ "
  347.                          "                         S[4] = '\0'  "
  348.                          "// macro StrToUlong(S,L) - use to convert the string at S into"
  349.                          "//    an unsigned long (32 bit) value.  S must be at least"
  350.                          "//    four characters wide"
  351.                          "#define StrToUlong(S,L) L = ( (unsigned int) S[0] << 24 ) | \ "
  352.                          "                            ( (unsigned int) S[1] << 16 ) | \ "
  353.                          "                            ( (unsigned int) S[2] <<  8 ) | \ "
  354.                          "                            ( (unsigned int) S[3] <<  0 ) " ;
  355.  
  356.  
  357. };
  358.  
  359. #endif
  360.  
  361. };
  362. #endif
  363.