From Nokia Developer Wiki
Created:(22 Mar 2007)
Last edited:(26 Jul 2012)
R classes are proxies for objects owned elsewhere. There are two main motivations for this:
- The real object is owned by a server in a different thread or address space, or
- the real object’s implementation must be hidden from the client.
The following are key characteristics of R objects:
- They contain a handle that is used to pass on requests to other objects
- They are opened using an "open" function particular to the R class, and closed using a "close" function particular to the class. An R object must be closed once if it has been opened. Generally, the resource associated with an R object is closed automatically if the thread which opened the object terminates.
- They have no explicit constructor, destructor, copy constructor or assignment operator.
It's also worth noting that
- There is no common base class for all R classes
- The initialisation function has a variety of names: also possible are Open(), Create(), Allocate(), etc.
- The termination function has a variety of names: also possible are Close(), Destroy(), Free(), etc.
- Since R classes own external resources, there is a requirement for cleanup: this is handled in various ways depending on the class.