Essential COM

, DCE (Distributed Computing Environment ), . , (Interface Definition Language IDL). . IDL:

 HRESULT f([in] const short *ps); 

:

 short s = 10; HRESULT hr = p->f(&s); 

10 . , 10 ORPC- .

, , :

 HRESULT hr = p->f(0); // pass a null pointer //      

, . ? , , ? , , , ? , , , , , , . .

, . , , [ref]:

 HRESULT g([in, ref] short *ps); // ps cannot be a null ptr. // ps          

, [ref], (reference pointers). IDL- , , :

 HRESULT hr = p->g(0); // danger: passing null [ref] ptr. //  :           [ref] 

. p , , . , IDL- [unique]:

 HRESULT h([in, unique] short *ps); // ps can be a null ptr. // ps        

, [unique], (unique pointers). IDL- , , :

 HRESULT hr = p->h(0); // relax: passing null [unique] ptr. //  :           [unique] 

. , , . : , ORPC- . , , , . ORPC- . , 1, .

, [ref] [unique] . , . IDL:

 HRESULT j([in] short *ps1, [in] short *ps2); 

IDL- , :

 short x = 100; HRESULT hr = p->j(&x, & ); // note: same ptr. passed twice //  :            

: ? , 100 ORPC- : *ps1 *ps2. , , . , , 100, , ps1 ps2 , . , . - :

 STDMETHODIMP MyClass::j(short *ps1, short *ps2) {     if (ps1 == ps2)         return this->OneKindOfBehavior(ps1);     else         return this->AnotherKindOfBehavior(ps1, ps2); } 

(semantic contract) , .

[ref] [unique] , , , - . , , , IDL [ptr]:

 HRESULT k([in, ptr] short *ps1, [in, ptr] short *ps2); 

, [ptr], (full pointers), . IDL- , :

 short x = 100; HRESULT hr = p->k(&x, &x); // note: same ptr. passed twice //  :            

100 , [ptr] ps1 , [ptr]. ps2 [ptr], 2, . , , ps1 ps2, .

, . , , . , ORPC- , , . , , , .


1 MIDL [ref] . , . , MIDL, , , HRESULT .

2 (ps1 == ps2), (*ps1 == *ps2); .



Suschnost' tehnologii SOM
Essential COM
ISBN: 0201634465
EAN: 2147483647
Year: N/A
Pages: 103
Authors: Don Box

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net