summaryrefslogtreecommitdiff
path: root/py/demo/Ice/value/Printer.py
blob: 13f439c02c2754fa7ec485fb3faeb40d2b3d0d1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

import Demo, string, Ice

class PrinterI(Demo.Printer):
    def printBackwards(self, current=None):
        print(self.message[::-1])

class DerivedPrinterI(Demo.DerivedPrinter, PrinterI):
    def printUppercase(self, current=None):
        print(self.derivedMessage.upper())

class ClientPrinterI(Demo.ClientPrinter, PrinterI):
    pass

class ObjectFactory(Ice.ObjectFactory):
    def create(self, type):
        if type == Demo.Printer.ice_staticId():
            return PrinterI()

        if type == Demo.DerivedPrinter.ice_staticId():
            return DerivedPrinterI()

        if type == Demo.ClientPrinter.ice_staticId():
            return ClientPrinterI()

        assert(False)

    def destroy(self):
        # Nothing to do
        pass