Changeset 1589


Ignore:
Timestamp:
16/10/06 09:21:48 (13 years ago)
Author:
domlowe
Message:

simplified adding multiple operations to features

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/csml/API/__init__.py

    r1518 r1589  
    1818import csmlContainer 
    1919 
     20def addMethods(obj, meths): 
     21    for meth in meths: 
     22        setattr(obj, meth.__name__, meth) 
    2023 
    21  
    22  
    23  
    24  
    25  
    26  
    27 #Assign methods  .. hmmm perhaps a loop needed here!! 
    28  
     24#Assign methods to parser classes 
    2925#Dataset methods: 
    30 csml.parser.Dataset.parse=ops_Dataset.parse 
    31 csml.parser.Dataset.getSecurity=ops_Dataset.getSecurity 
    32 csml.parser.Dataset.getFeatureList=ops_Dataset.getFeatureList 
    33 csml.parser.Dataset.getFeature=ops_Dataset.getFeature 
    34 csml.parser.Dataset.getFileExtract=ops_Dataset.getFileExtract 
     26addMethods(csml.parser.Dataset, [ops_Dataset.parse, ops_Dataset.getSecurity, ops_Dataset.getFeatureList, ops_Dataset.getFeature, ops_Dataset.getFileExtract]) 
    3527 
    3628#AbstractFileExtract methods: 
    37 csml.parser.AbstractFileExtract.getData=ops_AbstractFileExtract.getData 
     29addMethods(csml.parser.AbstractFileExtract, [ops_AbstractFileExtract.getData]) 
    3830 
    3931#ArrayGenerator methods: 
    40 csml.parser.ArrayGenerator.getGeneratedValues=ops_ArrayGenerator.getGeneratedValues 
     32addMethods(csml.parser.ArrayGenerator, [ops_ArrayGenerator.getGeneratedValues]) 
    4133 
    4234#AbstractFeature methods: 
    43 csml.parser.AbstractFeature.testmethod=ops_AbstractFeature.testmethod 
    44 csml.parser.AbstractFeature.getAllowedSubsettings=ops_AbstractFeature.getAllowedSubsettings 
     35addMethods(csml.parser.AbstractFeature, [ops_AbstractFeature.testmethod, ops_AbstractFeature.getAllowedSubsettings]) 
    4536 
    4637#PointFeature methods: 
    47 csml.parser.PointFeature.testmethod=ops_PointFeature.testmethod 
    48 #csml.parser.PointFeature.getAllowedSubsettings=ops_PointFeature.getAllowedSubsettings 
     38addMethods(csml.parser.PointFeature,[ops_PointFeature.testmethod]) 
    4939 
    5040#PointSeriesFeature methods: 
    51 csml.parser.PointSeriesFeature.testmethod=ops_PointSeriesFeature.testmethod 
    52 csml.parser.PointSeriesFeature.getDomainReference=ops_PointSeriesFeature.getDomainReference 
    53 #csml.parser.GridSeriesFeature.getDomainComplement=ops_GridSeriesFeature.getDomainComplement 
    54 #csml.parser.GridSeriesFeature.getDomain=ops_GridSeriesFeature.getDomain 
    55 #csml.parser.GridSeriesFeature.subsetToGridSeries=ops_GridSeriesFeature.subsetToGridSeries 
    56 csml.parser.PointSeriesFeature.getAllowedSubsettings=ops_PointSeriesFeature.getAllowedSubsettings 
     41addMethods(csml.parser.PointSeriesFeature, [ops_PointSeriesFeature.testmethod,ops_PointSeriesFeature.getDomainReference, ops_PointSeriesFeature.getAllowedSubsettings]) 
    5742 
    5843#ProfileFeature methods: 
    59 csml.parser.ProfileFeature.testmethod=ops_ProfileFeature.testmethod 
    60 #ProfileFeature.getAllowedSubsettings=ops_ProfileFeature.getAllowedSubsettings 
     44addMethods(csml.parser.ProfileFeature,[ops_ProfileFeature.testmethod]) 
    6145 
    6246#ProfileSeriesFeature methods: 
    63 csml.parser.ProfileSeriesFeature.testmethod=ops_ProfileSeriesFeature.testmethod 
    64 #csml.parser.ProfileSeriesFeature.getAllowedSubsettings=ops_ProfileSeriesFeature.getAllowedSubsettings 
     47addMethods(csml.parser.ProfileSeriesFeature,[ops_ProfileSeriesFeature.testmethod]) 
    6548 
    6649#GridFeature methods: 
    67 csml.parser.GridFeature.testmethod=ops_GridFeature.testmethod 
    68 #csml.parser.GridFeature.getAllowedSubsettings=ops_GridFeature.getAllowedSubsettings 
     50addMethods(csml.parser.GridFeature,[ops_GridFeature.testmethod]) 
    6951 
    7052#GridSeriesFeature methods: 
    71 csml.parser.GridSeriesFeature.testmethod=ops_GridSeriesFeature.testmethod 
    72 csml.parser.GridSeriesFeature.getAllowedSubsettings=ops_GridSeriesFeature.getAllowedSubsettings 
    73 csml.parser.GridSeriesFeature.getDomainReference=ops_GridSeriesFeature.getDomainReference 
    74 csml.parser.GridSeriesFeature.getDomainComplement=ops_GridSeriesFeature.getDomainComplement 
    75 csml.parser.GridSeriesFeature.getDomain=ops_GridSeriesFeature.getDomain 
    76 csml.parser.GridSeriesFeature.subsetToGridSeries=ops_GridSeriesFeature.subsetToGridSeries 
     53addMethods(csml.parser.GridSeriesFeature,[ops_GridFeature.testmethod, ops_GridSeriesFeature.getAllowedSubsettings,ops_GridSeriesFeature.getDomainReference,ops_GridSeriesFeature.getDomainComplement,ops_GridSeriesFeature.getDomain,ops_GridSeriesFeature.subsetToGridSeries]) 
    7754 
    7855#TrajectoryFeature methods: 
    79 csml.parser.TrajectoryFeature.testmethod=ops_TrajectoryFeature.testmethod 
     56addMethods(csml.parser.TrajectoryFeature, [ops_TrajectoryFeature.testmethod]) 
Note: See TracChangeset for help on using the changeset viewer.