Download Athlete DSS and data analysis

Transcript
3.2 – Embedding R in applications on MS Windows
Finally, it is important to state that clients and servers can communicate only using
COM/DCOM objects. COM/DCOM object is the media that allows communications and
data exchanges. It is composed by two parts:
• COM interface, which contains methods (functions and operations) and properties
(variables) visible by clients. It also contains its internal state, that is invisible by
clients. This interface represents the unique entry point to the object; an important
characteristic is that it must not be changed at all, even new methods cannot be
implemented. Given that it is an interface, it has an abstract definition and it is
identified by its IID (Interface IDentifier), a 128 bit numeric value.
• The second element is called Coclass, which is the implementation of COM interface. As many programming languages allow, even in this case, multiple Coclasses
can implement the same interface. Unlike the COM interface, the Coclass is identified by its CLSID (CLass IDentifier), a 128 bit numeric value or, more simply, by
its name. Coclass is referred to a COM client, who is programmed against interface,
and this reference is established at run-time.
3.2.1
Interface IStatConnector
IStatConnector interface is a COM interface that allows users to connect to R and exchange information with it. In fact IStatInterface defines the methods used to access to R.
Its structure is very simple, as the following example code shows. They are divided into
three thematic blocks:
35