Ticket #24 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

Modification to interfaces, wrappers and adapters section

Reported by: michelpons Owned by: jasper
Priority: minor Milestone: Phase II
Component: COBIA SDK Reference Version: 1.0
Keywords: Cc:

Description

In the section on interfaces, wrappers and adapters of the main page of COBIA Reference, there is the sentence "Implementing an interface directly is also not necessarily C++ friendly. For this purpose, and interface adapter is provided for interfaces. An interface wrapper is a base class that implements the raw C interface. " Appears that interface adapter is provided to resolve the issue described in the first sentence. But then the paragraph goes on speaking only of interface wrappers. The possible relationship between adapters and wrappers is not told. Could this be made more consistent?

Change History

comment:1 Changed 4 years ago by jasper

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in r113:

Implementing an interface directly is also not necessarily C++ friendly. For this purpose, and interface adapter is provided for interfaces. An interface adapter is a base class that implements the raw C interface. You can use this class as a base class for your own class. Of course, in your own class you still need to implement each of the functions, but in a more C++ friendly manner. For example, an adapter calls class members of your class, so that interface functions are no longer static, and hides the object pointer. An adapter converts all interface arguments into the corresponding interface wrapper for ease of access. An adapter will convert return values into output arguments. An adapter will catch std::exception, and COBIA::cape_open_error exceptions in particular, and convert these into CAPE-OPEN error handling. An object that derives from an adapter class, also automatically derives from the raw C interface. As a template argument to the adapter class, a base object is provided that ensures that the interface is available via COBIA::ICapeInterface::vTable::queryInterface. This base class also takes care of reference counting. Although you can provide your own base class, COBIA::CapeOpenObject? is conveniently supplied.

Note: See TracTickets for help on using tickets.