[Opensim-dev] Restructuring IClientAPI - thoughts wanted

Stefan Andersson stefan at tribalmedia.se
Mon Sep 15 11:06:05 UTC 2008


+1 on moving in this direction. Looks really promising! Best regards,Stefan AnderssonTribal Media AB Join the 3d web revolution : http://tribalnet.se/ 



> Date: Sun, 14 Sep 2008 04:10:14 +0100> From: melanie at t-data.com> To: opensim-dev at lists.berlios.de> Subject: Re: [Opensim-dev] Restructuring IClientAPI - thoughts wanted> > Is there even a need to enumerate?> > Basically, each class is either an event consumer or a message > sender. IN either case, they would know the interface they're > looking for. So, enumeration seems unnecessary.> If we do need to do it, it would be infrequent, so the performance > hit of reflection seems very much acceptable.> > if (client is IInstantMessageService)> ((IInstantMessageService)client).OnInstantMessage += OnInstantMessage;> > Looks like a winner!> > +1> > Melanie> > Frisby, Adam wrote:> > Slight correction suggestion, IClientAPI actually is redundant in that situation - there's no reason why we need to keep HasInterface as long as we can do "Client is <type/interface>". GetInterfaces() could be replaced with a quick search via reflection (GetTypes)> > > > Adam> > > > From: opensim-dev-bounces at lists.berlios.de [mailto:opensim-dev-bounces at lists.berlios.de] On Behalf Of Frisby, Adam> > Sent: Saturday, 13 September 2008 7:41 PM> > To: opensim-dev at lists.berlios.de> > Subject: [Opensim-dev] Restructuring IClientAPI - thoughts wanted> > > > I'm in the process of adding support for some alternate clients to OpenSim, and one of the things I'm noticing is that there is one one chunk of OpenSim in particular that is highly "LL-Specific" in how it treats things - it's also comparatively a very small chunk of OpenSim that might actually be fixable quite easily.> > > > That is to say, IClientAPI - I'm thinking of replacing IClientAPI with a very small interface:> > > > bool IClientAPI.HasInterface<T>();> > type[] IClientAPI.GetInterfaces();> > > > Then replacing the current web of .Xyz with smaller more discrete interfaces such as:> > > > > > IClientInstantMessage {> > > > SendMessage(...);> > > > event OnNewMessage;> > > > }> > > > We can do checks on them in our modules, where once we did:> > > > OnNewClient(IClientAPI client) {> > client.OnNewMessage += messageHandler;> > }> > > > We replace with> > > > > > OnNewClient(IClientAPI client) {> > > > If(client.HasInterface<IClientInstantMessage>()) {> > > > ((IClientInstantMessage)client).OnNewMessage += messageHandler;> > > > }> > > > }> > > > The resulting code is then more friendly for third party clients, and clients don't need to support the full set of functionality to register as valid Clients inside of OpenSim.> > > > What's everyone's thoughts here?> > > > Good idea / bad / anyone got any better?> > > > Adam> > > > > > > > ------------------------------------------------------------------------> > > > _______________________________________________> > Opensim-dev mailing list> > Opensim-dev at lists.berlios.de> > https://lists.berlios.de/mailman/listinfo/opensim-dev> _______________________________________________> Opensim-dev mailing list> Opensim-dev at lists.berlios.de> https://lists.berlios.de/mailman/listinfo/opensim-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20080915/5a364050/attachment-0001.html>


More information about the Opensim-dev mailing list