/[eiffelstudio]/trunk/Delivery/xmldoc/technologies/com/03_interfaces.xml
ViewVC logotype

Diff of /trunk/Delivery/xmldoc/technologies/com/03_interfaces.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 42298 by neilc, Tue Feb 24 01:36:31 2004 UTC revision 42299 by rogers, Wed Mar 24 00:00:17 2004 UTC
# Line 1  Line 1 
1  <document title="COM Interfaces" output="studio">  <document title="COM Interfaces" output="studio">
2          <meta_data/>          <meta_data/>
3          <paragraph>Interfaces are at the heart of any COM component. Interfaces are described in the definition file of a component. They consist of a group of semantically related functions that can be accessed by the clients of the component. Although they are a specification, they also have a physical representation. A client can request a pointer on an interface and access the component functions through that pointer. Interfaces are the only possible way to access functions from a component. They enforce information hiding by providing only the public functions to the client.          <paragraph><paragraph>Interfaces are at the heart of any COM component. Interfaces are described in the definition file of a component. They consist of a group of semantically related functions that can be accessed by the clients of the component. Although they are a specification, they also have a physical representation. A client can request a pointer on an interface and access the component functions through that pointer. Interfaces are the only possible way to access functions from a component. They enforce information hiding by providing only the public functions to the client.</paragraph>
4                  <paragraph>Interfaces also define the type of a component. Each interface corresponds to a specific view of the component. It can be compared to polymorphism in the Object Oriented world. Whenever an interface from a component is requested, only the functions defined on that interface are accessible as if the component was polymorphically cast into an object of the type of that interface. </paragraph>                  <paragraph>Interfaces also define the type of a component. Each interface corresponds to a specific view of the component. It can be compared to polymorphism in the Object Oriented world. Whenever an interface from a component is requested, only the functions defined on that interface are accessible as if the component was polymorphically cast into an object of the type of that interface. </paragraph>
5                  <paragraph>The COM specification requires that any interface provides access to all interfaces on the same component. All the interface should include a specific function called QueryInterface that will provide a pointer on any other interface of the component. Interfaces are identified with a globally unique identifier (GUID) guaranteed to be unique in time and space. Since this function has to be on every interface, it has been abstracted into a specific interface called IUnknown which all other interfaces must inherit from. </paragraph>                  <paragraph>The COM specification requires that any interface provides access to all interfaces on the same component. All interfaces should include a specific function called QueryInterface that will provide a pointer on any other interface of the component. Interfaces are identified with a globally unique identifier (GUID) guaranteed to be unique in time and space. Since this function has to be on every interface, it has been abstracted into a specific interface called IUnknown which all other interfaces must inherit from. </paragraph>
6                  <paragraph>The two other functions exposed by IUnknown are AddRef and Release. These functions should be called respectively when a client gets a reference on an interface or when it discards that reference. These two functions define the lifetime of the component: each interface keeps track of clients keeping a reference on them and when no clients have references anymore, the component can be unloaded from memory. You might start to worry thinking that this business of reference counting will imply lots of headaches, memory leaks, etc. and you would be right should you choose a low-level language to implement your components. Fortunately, you will never have to implement or use these functions in Eiffel: all the processing related to IUnknown is provided by the EiffelCOM runtime. Calls to QueryInterface are done "behind the scene" and only when needed. The lifetime of the component is also taken care of by the EiffelCOM runtime. </paragraph>                  <paragraph>The two other functions exposed by IUnknown are AddRef and Release. These functions should be called respectively when a client gets a reference on an interface or when it discards that reference. These two functions define the lifetime of the component: each interface keeps track of clients keeping a reference on them and when no clients have references anymore, the component can be unloaded from memory. You might start to worry thinking that this business of reference counting will imply lots of headaches, memory leaks, etc. and you would be right should you choose a low-level language to implement your components. Fortunately, you will never have to implement or use these functions in Eiffel: all the processing related to IUnknown is provided by the EiffelCOM runtime. Calls to QueryInterface are done "behind the scene" and only when needed. The lifetime of the component is also taken care of by the EiffelCOM runtime. </paragraph>
7                  <seealso>                  <seealso>
8                          <bold>See Also</bold>                          <bold>See Also</bold>
# Line 23  Line 23 
23                          </link>                          </link>
24                          <line_break/>                          <line_break/>
25                          <link>                          <link>
26                                  <url>03_interfaces.xml</url>                                  <url>02_generalities.xml</url>
27                                  <label> COM Interfaces</label>                                  <label>Generalities</label>
28                          </link>                          </link>
29                          <line_break/>                          <line_break/>
30                          <link>                          <link>
# Line 47  Line 47 
47                                  <label> Deeper into COM</label>                                  <label> Deeper into COM</label>
48                          </link>                          </link>
49                  </seealso>                  </seealso>
         </paragraph></document>  
50            </paragraph></document>

Legend:
Removed from v.42298  
changed lines
  Added in v.42299

  ViewVC Help
Powered by ViewVC 1.1.23