[viff-devel] Accessing functions in Protocol from outside

Håvard Vegge havardv at stud.ntnu.no
Wed May 13 04:46:37 PDT 2009


Hi!

I have a program with two classes (as outlined below). From the class 
MyFunctions I would like to call a function in the class Protocol, is 
this possible? Normally one would save the instance of a class p = 
Protocol() and then be able to call p.some_function()...

But I don't see how this is possible because the Protocol is started as 
a callback. Does anyone have some suggestions?

Best regards, Håvard


class MyFunctions:
    def initiate_computation(self, code):
       // want to call Protocol.some_function(code)

class Protocol:
    def __init__(self, runtime):
       ...

    def some_function(self, code):
       ...

    def results_ready(self, results):
       ...

pre_runtime = create_runtime(id, players, 1, options, Toft07Runtime)
pre_runtime.addCallback(Protocol)


More information about the viff-devel mailing list