1## @file
2# This file is used to define a class object to describe a module
3#
4# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
5#
6# This program and the accompanying materials are licensed and made available
7# under the terms and conditions of the BSD License which accompanies this
8# distribution. The full text of the license may be found at
9# http://opensource.org/licenses/bsd-license.php
10#
11# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14'''
15ModuleObject
16'''
17
18##
19# Import Modules
20#
21from Object.POM.CommonObject import CommonPropertiesObject
22from Object.POM.CommonObject import IdentificationObject
23from Object.POM.CommonObject import CommonHeaderObject
24from Object.POM.CommonObject import BinaryHeaderObject
25from Object.POM.CommonObject import HelpTextListObject
26from Object.POM.CommonObject import GuidVersionObject
27
28
29##
30# BootModeObject
31#
32class BootModeObject(CommonPropertiesObject, HelpTextListObject):
33    def __init__(self):
34        self.SupportedBootModes = ''
35        CommonPropertiesObject.__init__(self)
36        HelpTextListObject.__init__(self)
37
38    def SetSupportedBootModes(self, SupportedBootModes):
39        self.SupportedBootModes = SupportedBootModes
40
41    def GetSupportedBootModes(self):
42        return self.SupportedBootModes
43
44##
45# EventObject
46#
47class EventObject(CommonPropertiesObject, HelpTextListObject):
48    def __init__(self):
49        self.EventType = ''
50        CommonPropertiesObject.__init__(self)
51        HelpTextListObject.__init__(self)
52
53    def SetEventType(self, EventType):
54        self.EventType = EventType
55
56    def GetEventType(self):
57        return self.EventType
58
59##
60# HobObject
61#
62class HobObject(CommonPropertiesObject, HelpTextListObject):
63    def __init__(self):
64        self.HobType = ''
65        CommonPropertiesObject.__init__(self)
66        HelpTextListObject.__init__(self)
67
68    def SetHobType(self, HobType):
69        self.HobType = HobType
70
71    def GetHobType(self):
72        return self.HobType
73
74##
75# SpecObject
76#
77class SpecObject(object):
78    def __init__(self):
79        self.Spec = ''
80        self.Version = ''
81
82    def SetSpec(self, Spec):
83        self.Spec = Spec
84
85    def GetSpec(self):
86        return self.Spec
87
88    def SetVersion(self, Version):
89        self.Version = Version
90
91    def GetVersion(self):
92        return self.Version
93
94## ModuleHeaderObject
95#
96# This class defined header items used in Module file
97#
98class ModuleHeaderObject(IdentificationObject, CommonHeaderObject, BinaryHeaderObject):
99    def __init__(self):
100        self.IsLibrary = False
101        self.IsLibraryModList = []
102        self.ModuleType = ''
103        self.BinaryModule = False
104        self.PcdIsDriver = ''
105        self.PiSpecificationVersion = ''
106        self.UefiSpecificationVersion = ''
107        self.UNIFlag = False
108        #
109        # SpecObject
110        #
111        self.SpecList = []
112        #
113        # BootModeObject
114        #
115        self.BootModeList = []
116        #
117        # EventObject
118        #
119        self.EventList = []
120        #
121        # HobObject
122        #
123        self.HobList = []
124        #
125        # LibraryClassObject
126        #
127        self.LibraryClassList = []
128        self.SupArchList = []
129        IdentificationObject.__init__(self)
130        CommonHeaderObject.__init__(self)
131        BinaryHeaderObject.__init__(self)
132
133    def SetIsLibrary(self, IsLibrary):
134        self.IsLibrary = IsLibrary
135
136    def GetIsLibrary(self):
137        return self.IsLibrary
138
139    def SetIsLibraryModList(self, IsLibraryModList):
140        self.IsLibraryModList = IsLibraryModList
141
142    def GetIsLibraryModList(self):
143        return self.IsLibraryModList
144
145    def SetModuleType(self, ModuleType):
146        self.ModuleType = ModuleType
147
148    def GetModuleType(self):
149        return self.ModuleType
150
151    def SetBinaryModule(self, BinaryModule):
152        self.BinaryModule = BinaryModule
153
154    def GetBinaryModule(self):
155        return self.BinaryModule
156
157    def SetPcdIsDriver(self, PcdIsDriver):
158        self.PcdIsDriver = PcdIsDriver
159
160    def GetPcdIsDriver(self):
161        return self.PcdIsDriver
162
163    def SetPiSpecificationVersion(self, PiSpecificationVersion):
164        self.PiSpecificationVersion = PiSpecificationVersion
165
166    def GetPiSpecificationVersion(self):
167        return self.PiSpecificationVersion
168
169    def SetUefiSpecificationVersion(self, UefiSpecificationVersion):
170        self.UefiSpecificationVersion = UefiSpecificationVersion
171
172    def GetUefiSpecificationVersion(self):
173        return self.UefiSpecificationVersion
174
175    def SetSpecList(self, SpecList):
176        self.SpecList = SpecList
177
178    def GetSpecList(self):
179        return self.SpecList
180
181    def SetBootModeList(self, BootModeList):
182        self.BootModeList = BootModeList
183
184    def GetBootModeList(self):
185        return self.BootModeList
186
187    def SetEventList(self, EventList):
188        self.EventList = EventList
189
190    def GetEventList(self):
191        return self.EventList
192
193    def SetHobList(self, HobList):
194        self.HobList = HobList
195
196    def GetHobList(self):
197        return self.HobList
198
199    def SetLibraryClassList(self, LibraryClassList):
200        self.LibraryClassList = LibraryClassList
201
202    def GetLibraryClassList(self):
203        return self.LibraryClassList
204
205    def SetSupArchList(self, SupArchList):
206        self.SupArchList = SupArchList
207
208    def GetSupArchList(self):
209        return self.SupArchList
210
211##
212# SourceFileObject
213#
214class SourceFileObject(CommonPropertiesObject):
215    def __init__(self):
216        CommonPropertiesObject.__init__(self)
217        self.SourceFile = ''
218        self.TagName = ''
219        self.ToolCode = ''
220        self.Family = ''
221        self.FileType = ''
222
223    def SetSourceFile(self, SourceFile):
224        self.SourceFile = SourceFile
225
226    def GetSourceFile(self):
227        return  self.SourceFile
228
229    def SetTagName(self, TagName):
230        self.TagName = TagName
231
232    def GetTagName(self):
233        return self.TagName
234
235    def SetToolCode(self, ToolCode):
236        self.ToolCode = ToolCode
237
238    def GetToolCode(self):
239        return self.ToolCode
240
241    def SetFamily(self, Family):
242        self.Family = Family
243
244    def GetFamily(self):
245        return self.Family
246
247    def SetFileType(self, FileType):
248        self.FileType = FileType
249
250    def GetFileType(self):
251        return self.FileType
252
253
254##
255# BinaryFileObject
256#
257class BinaryFileObject(CommonPropertiesObject):
258    def __init__(self):
259        self.FileNamList = []
260        self.AsBuiltList = []
261        CommonPropertiesObject.__init__(self)
262
263    def SetFileNameList(self, FileNamList):
264        self.FileNamList = FileNamList
265
266    def GetFileNameList(self):
267        return self.FileNamList
268
269    def SetAsBuiltList(self, AsBuiltList):
270        self.AsBuiltList = AsBuiltList
271
272    def GetAsBuiltList(self):
273        return self.AsBuiltList
274
275
276##
277# AsBuildLibraryClassObject
278#
279class AsBuildLibraryClassObject(object):
280    def __init__(self):
281        self.LibGuid = ''
282        self.LibVersion = ''
283        self.SupArchList = []
284
285    def SetLibGuid(self, LibGuid):
286        self.LibGuid = LibGuid
287    def GetLibGuid(self):
288        return self.LibGuid
289
290    def SetLibVersion(self, LibVersion):
291        self.LibVersion = LibVersion
292    def GetLibVersion(self):
293        return self.LibVersion
294
295    def SetSupArchList(self, SupArchList):
296        self.SupArchList = SupArchList
297    def GetSupArchList(self):
298        return self.SupArchList
299
300##
301# AsBuiltObject
302#
303class AsBuiltObject(object):
304    def __init__(self):
305        #
306        # list of PcdObject
307        #
308        self.PatchPcdList = []
309        #
310        # list of PcdObject
311        #
312        self.PcdExValueList = []
313        #
314        # list of GuidVersionObject
315        #
316        self.LibraryInstancesList = []
317        #
318        # List of BinaryBuildFlag object
319        #
320        self.BinaryBuildFlagList = []
321
322    def SetPatchPcdList(self, PatchPcdList):
323        self.PatchPcdList = PatchPcdList
324
325    def GetPatchPcdList(self):
326        return self.PatchPcdList
327
328    def SetPcdExList(self, PcdExValueList):
329        self.PcdExValueList = PcdExValueList
330
331    def GetPcdExList(self):
332        return self.PcdExValueList
333
334    def SetLibraryInstancesList(self, LibraryInstancesList):
335        self.LibraryInstancesList = LibraryInstancesList
336
337    def GetLibraryInstancesList(self):
338        return self.LibraryInstancesList
339
340    def SetBuildFlagsList(self, BinaryBuildFlagList):
341        self.BinaryBuildFlagList = BinaryBuildFlagList
342
343    def GetBuildFlagsList(self):
344        return self.BinaryBuildFlagList
345
346##
347# BinaryBuildFlag, this object will include those fields that are not
348# covered by the UPT Spec BinaryFile field
349#
350class BinaryBuildFlagObject(object):
351    def __init__(self):
352        self.Target = ''
353        self.TagName = ''
354        self.Family = ''
355        self.AsBuiltOptionFlags = ''
356
357    def SetTarget(self, Target):
358        self.Target = Target
359
360    def GetTarget(self):
361        return self.Target
362
363    def SetTagName(self, TagName):
364        self.TagName = TagName
365
366    def GetTagName(self):
367        return self.TagName
368
369    def SetFamily(self, Family):
370        self.Family = Family
371
372    def GetFamily(self):
373        return self.Family
374
375    def SetAsBuiltOptionFlags(self, AsBuiltOptionFlags):
376        self.AsBuiltOptionFlags = AsBuiltOptionFlags
377    def GetAsBuiltOptionFlags(self):
378        return self.AsBuiltOptionFlags
379
380##
381# ExternObject
382#
383class ExternObject(CommonPropertiesObject):
384    def __init__(self):
385        self.EntryPoint = ''
386        self.UnloadImage = ''
387        self.Constructor = ''
388        self.Destructor = ''
389        self.SupModList = []
390        CommonPropertiesObject.__init__(self)
391
392    def SetEntryPoint(self, EntryPoint):
393        self.EntryPoint = EntryPoint
394
395    def GetEntryPoint(self):
396        return self.EntryPoint
397
398    def SetUnloadImage(self, UnloadImage):
399        self.UnloadImage = UnloadImage
400
401    def GetUnloadImage(self):
402        return self.UnloadImage
403
404    def SetConstructor(self, Constructor):
405        self.Constructor = Constructor
406
407    def GetConstructor(self):
408        return self.Constructor
409
410    def SetDestructor(self, Destructor):
411        self.Destructor = Destructor
412
413    def GetDestructor(self):
414        return self.Destructor
415
416    def SetSupModList(self, SupModList):
417        self.SupModList = SupModList
418    def GetSupModList(self):
419        return self.SupModList
420
421##
422# DepexObject
423#
424class DepexObject(CommonPropertiesObject):
425    def __init__(self):
426        self.Depex = ''
427        self.ModuelType = ''
428        CommonPropertiesObject.__init__(self)
429
430    def SetDepex(self, Depex):
431        self.Depex = Depex
432
433    def GetDepex(self):
434        return self.Depex
435
436    def SetModuleType(self, ModuleType):
437        self.ModuelType = ModuleType
438
439    def GetModuleType(self):
440        return self.ModuelType
441
442##
443# PackageDependencyObject
444#
445class PackageDependencyObject(GuidVersionObject, CommonPropertiesObject):
446    def __init__(self):
447        self.Package = ''
448        self.PackageFilePath = ''
449        GuidVersionObject.__init__(self)
450        CommonPropertiesObject.__init__(self)
451
452    def SetPackageFilePath(self, PackageFilePath):
453        self.PackageFilePath = PackageFilePath
454
455    def GetPackageFilePath(self):
456        return self.PackageFilePath
457
458    def SetPackage(self, Package):
459        self.Package = Package
460
461    def GetPackage(self):
462        return self.Package
463
464##
465# BuildOptionObject
466#
467class BuildOptionObject(CommonPropertiesObject):
468    def __init__(self):
469        CommonPropertiesObject.__init__(self)
470        self.BuildOption = ''
471
472    def SetBuildOption(self, BuildOption):
473        self.BuildOption = BuildOption
474
475    def GetBuildOption(self):
476        return self.BuildOption
477
478##
479# ModuleObject
480#
481class ModuleObject(ModuleHeaderObject):
482    def __init__(self):
483        #
484        # {Arch : ModuleHeaderObject}
485        #
486        self.HeaderDict = {}
487        #
488        # LibraryClassObject
489        #
490        self.LibraryClassList = []
491        #
492        # SourceFileObject
493        #
494        self.SourceFileList = []
495        #
496        # BinaryFileObject
497        #
498        self.BinaryFileList = []
499        #
500        # PackageDependencyObject
501        #
502        self.PackageDependencyList = []
503        #
504        # DepexObject
505        #
506        self.PeiDepex = []
507        #
508        # DepexObject
509        #
510        self.DxeDepex = []
511        #
512        # DepexObject
513        #
514        self.SmmDepex = []
515        #
516        # ProtocolObject
517        #
518        self.ProtocolList = []
519        #
520        # PpiObject
521        #
522        self.PpiList = []
523        #
524        # GuidObject
525        #
526        self.GuidList = []
527        #
528        # PcdObject
529        #
530        self.PcdList = []
531        #
532        # ExternObject
533        #
534        self.ExternList = []
535        #
536        # BuildOptionObject
537        #
538        self.BuildOptionList = []
539        #
540        # UserExtensionObject
541        #
542        self.UserExtensionList = []
543        #
544        # MiscFileObject
545        #
546        self.MiscFileList = []
547        #
548        # ClonedFromObject
549        #
550        self.ClonedFrom = None
551
552        ModuleHeaderObject.__init__(self)
553
554    def SetHeaderDict(self, HeaderDict):
555        self.HeaderDict = HeaderDict
556
557    def GetHeaderDict(self):
558        return self.HeaderDict
559
560    def SetLibraryClassList(self, LibraryClassList):
561        self.LibraryClassList = LibraryClassList
562
563    def GetLibraryClassList(self):
564        return self.LibraryClassList
565
566    def SetSourceFileList(self, SourceFileList):
567        self.SourceFileList = SourceFileList
568
569    def GetSourceFileList(self):
570        return self.SourceFileList
571
572    def SetBinaryFileList(self, BinaryFileList):
573        self.BinaryFileList = BinaryFileList
574
575    def GetBinaryFileList(self):
576        return self.BinaryFileList
577
578    def SetPackageDependencyList(self, PackageDependencyList):
579        self.PackageDependencyList = PackageDependencyList
580
581    def GetPackageDependencyList(self):
582        return self.PackageDependencyList
583
584    def SetPeiDepex(self, PeiDepex):
585        self.PeiDepex = PeiDepex
586
587    def GetPeiDepex(self):
588        return self.PeiDepex
589
590    def SetDxeDepex(self, DxeDepex):
591        self.DxeDepex = DxeDepex
592
593    def GetDxeDepex(self):
594        return self.DxeDepex
595
596    def SetSmmDepex(self, SmmDepex):
597        self.SmmDepex = SmmDepex
598
599    def GetSmmDepex(self):
600        return self.SmmDepex
601
602    def SetPpiList(self, PpiList):
603        self.PpiList = PpiList
604
605    def GetPpiList(self):
606        return self.PpiList
607
608    def SetProtocolList(self, ProtocolList):
609        self.ProtocolList = ProtocolList
610
611    def GetProtocolList(self):
612        return self.ProtocolList
613
614    def SetPcdList(self, PcdList):
615        self.PcdList = PcdList
616
617    def GetPcdList(self):
618        return self.PcdList
619
620    def SetGuidList(self, GuidList):
621        self.GuidList = GuidList
622
623    def GetGuidList(self):
624        return self.GuidList
625
626    def SetExternList(self, ExternList):
627        self.ExternList = ExternList
628
629    def GetExternList(self):
630        return self.ExternList
631
632    def SetBuildOptionList(self, BuildOptionList):
633        self.BuildOptionList = BuildOptionList
634
635    def GetBuildOptionList(self):
636        return self.BuildOptionList
637
638    def SetUserExtensionList(self, UserExtensionList):
639        self.UserExtensionList = UserExtensionList
640
641    def GetUserExtensionList(self):
642        return self.UserExtensionList
643
644    def SetMiscFileList(self, MiscFileList):
645        self.MiscFileList = MiscFileList
646
647    def GetMiscFileList(self):
648        return self.MiscFileList
649
650    def SetClonedFrom(self, ClonedFrom):
651        self.ClonedFrom = ClonedFrom
652
653    def GetClonedFrom(self):
654        return self.ClonedFrom
655