Archived

This forum has been archived. Please start a new discussion on GitHub.

Class/Interface Confusion with IcePack

I'm digging around with IcePack since I have some free time on my hands and I have a question.

My original SLICE implementation for my code is like this:
#ifndef JSOCKETS_ICE
#define JSOCKETS_ICE

sequence<byte> ByteSeq;
interface jSockets
{
	ByteSeq execute(ByteSeq command);
};

#endif

My server and client actually works. But now I'm thinking of implementing it as a Windows service. The ICE documentation points to IcePack, unfortunately I'm getting overwhelmed (confused) with the official documentation so I went and look at the demo\IcePack\simple source codes.

What surprised me is that the SLICE definition actually goes like this:
#ifndef HELLO_ICE
#define HELLO_ICE

class Hello
{
    nonmutating void sayHello();
    idempotent void shutdown();
};

#endif

Earlier samples, particularly the first one, uses the interface keyword but this one is different. I tried re-reading the SLICE documentation but I'm still at a loss on how to convert my exisiting interface definition to class definition.

I will of course continue with playing around with my code. I just hope someone can point me in the right direction before I waste a huge amount of time.

Thanks for any help.

r/Alex

edit: fixed spelling errors

Comments

  • marc
    marc Florida
    You don't really need to convert your interfaces to classes. In this particular case, where there are no data members, an interface is much more appropriate anyway.

    Have a look at chatper 4.9.8 "Architectural Implications of Classes" for more information on classes.

    In any case, whether you are using classes or interfaces doesn't matter for IcePack.
  • Thanks for the link to the chapter 4.9.8 ... it actually help me understand SLICE more.

    Still, I think I'm asking the wrong question. I'll just post another thread.

    Thanks again.

    r/Alex