def makeOneEnumAds( enumXML ):
        """
        given an EnumeratedType class from parameters_model, return a string modelling an ada enumerated type, and possibly some
        ranges for it, if the enumXML contains some Subset elements, and the headers for To_String and From_Value functions
        """
        template = Template( file=WORKING_PATHS.templatesPath+"enumerated_type.ads.tmpl" )
        enumName = adafyName( enumXML.name )
        template.etype = enumName 
        template.ranges = []
        e_members = []
        for v in enumXML.getValues():
                e_members.append( v.name )
        template.e_members = ', '.join( e_members )
        for s in enumXML.subsets.values():
                ran = "subtype "+adafyName( s.id ) + " is " +  enumName + " range " + s.start + " .. " + s.stop
                template.ranges.append( ran )
        return str(template)
def makeOneEnumAdb( enumXML ):
        """
        given an EnumeratedType class from parameters_model, return a string with bodies to map from the enum to a String, and to and from
        numbers to the enum
        """
        template = Template( file=WORKING_PATHS.templatesPath+"enumerated_type.adb.tmpl" )
        template.etype = adafyName( enumXML.name )
        template.enum_assignments = []
        template.string_assignments = []
        template.int_assignments = []
        p  = 0
        for v in enumXML.getValues():
                template.string_assignments.append( 'when %(enum)s => return "%(string)s"' % { 'enum': v.name, 'string': v.text()} )
                template.int_assignments.append( "when %(enum)s => return %(val)d" % { 'enum': v.name, 'val': v.value })
                if( p > 0 ):
                        template.enum_assignments.append( "when %(val)s => return %(enum)s" % { 'enum': v.name, 'val': v.value })
                else:
                        template.default_assignment = "return %(enum)s" % { 'enum': v.name };
                p += 1
        return str(template)