Afgeronde rechthoek: Top of book Afgeronde rechthoek: Managers track Afgeronde rechthoek: Technical track Afgeronde rechthoek: Previous page Afgeronde rechthoek: Home





C view

A specification in C of that same interface is given by:

struct tagIBKEGameControl;
typedef struct tagIBKEGameControl IBKEGameControl;
typedef struct tagIBKEGameControlvtbl
  HRESULT ( STDCALL * _QueryAccessPoint)(void *BKEGameControlInstancePointer, REFIID riid, LPVOID* ppvObjectPtr);
  HRESULT ( STDCALL * _ResetInstance)(void *BKEGameControlInstancePointer);
  HRESULT ( STDCALL * _CleanupInstance)(void *BKEGameControlInstancePointer);
  void ( STDCALL * StartGame)(void *BKEGameControlInstancePointer, int NrOfCycles);
  bool ( STDCALL * InterpretMove)(void *BKEGameControlInstancePointer, PositionType Position);
  void ( STDCALL * ControlGame)(void *BKEGameControlInstancePointer);
  void ( STDCALL * TriggerPlayer)(void *BKEGameControlInstancePointer, int* positionPtr);
} IBKEGameControlvtbl;

/* The (public) AbstactDataType instance. */

typedef struct tagIBKEGameControl
  IBKEGameControlvtbl *pIBKEGameControlvtbl; // interface
} IBKEGameControl;

The public part of a specification of an RCOM component in C runs:

  IBKEUserinterfacevtbl *pIBKEUserinterfacevtbl;
  LPVOID MCStore_11_3BlocKArray[3];
  int InstanceNr;
  int NotUsed;

This class has only one interface and no require interfaces. The interface is specified by:

typedef struct tagIBKEUserinterfacevtbl
  HRESULT ( STDCALL * _QueryAccessPoint)(void *BKEUserinterfaceInstancePointer, REFIID riid, LPVOID* ppvObjectPtr);
  HRESULT ( STDCALL * _ResetInstance)(void *BKEUserinterfaceInstancePointer);
  HRESULT ( STDCALL * _CleanupInstance)(void *BKEUserinterfaceInstancePointer);
  void ( STDCALL * DisplayPlayBoard)(void *BKEUserinterfaceInstancePointer, ArrayOf3Int playBoard[3], int strategy1, int strategy2, int firstPlayerNr);
  void ( STDCALL * DisplayWinner)(void *BKEUserinterfaceInstancePointer, int winnerId);
} IBKEUserinterfacevtbl;

The shown code is automatically generated by the tool CompoBuilder. As can be seen from these examples the IUnknown base interface is replaced by the IAccessor base interface. This base interface contains two methods: QueryAccessPoint and ResetInstance. The base interfaces form the main difference between the binary representations of COM and RCOM. However the infrastructure that uses the binary RCOM model uses reserved places for require interfaces and connection requests. Connection requests are not shown in the above examples.



Vtbl is the name for a table of pointers to implementations of routines. Implementations of COM and RCOM in C make use of Vtbl’s. Implementations in C++ do use them in a way that is hidden to the programmer. This may become clear by studying the above examples.



Afgeronde rechthoek: Top of page Afgeronde rechthoek: Next page