Hi, 2012/1/26 Marcel Offermans <[email protected]>
> > > In my opinion there are 2 alternative to this: > > 1) > > Register multiple services. But than means I am left with the > > challenge how to find the related service. > > In Java, you already have the option of registering an instance under > multiple service names. Would doing the same for C solve your issue? > This can only work if something like struct inheritance is being used. In the case of Java, one component can implement multiple services. In Celix, a service is a struct with service pointers. So there is always a one (name) to one (struct) relation. To be able to have one component with multiple services, and still be able to only retrieve one specific service something like struct inheritance is needed. Another possibility is to register service - component pairs. This way one service has a specific struct with function pointers and no struct inheritance is needed. It is up to the user to always use the correct service name to retrieve the needed struct. So when trying to follow the spec, struct inheritance makes more sense. But there are possibly more drawbacks, when using struct inheritance the first field has to be the parent struct (not a pointer), this implies that abstract data types can't be used, exposing the content of a struct to the user. As a note, in the Java case, is it acceptable to register service A and B with one component, and when retrieving service A cast it later to B? In other words, if a different service is needed, does a user need to do a getServiceReference/getService again? > Greetings, Marcel > > -- Met vriendelijke groet, Alexander Broekhuis
