10
10
import autosar .builder
11
11
import autosar .port
12
12
from abc import (ABC ,abstractmethod )
13
- from autosar .base import splitRef
13
+ import autosar .base
14
14
import autosar .bsw .com
15
15
import autosar .bsw .os
16
16
import autosar .util
@@ -25,7 +25,7 @@ def workspace(version=3.0, patch = 2, schema=None, attributes=None, useDefaultWr
25
25
return autosar .Workspace (version , patch , schema , attributes , useDefaultWriters )
26
26
27
27
28
-
28
+
29
29
30
30
def splitRef (ref ):
31
31
return autosar .base .splitRef (ref )
@@ -37,27 +37,29 @@ def ApplicationError(name, errorCode, parent=None, adminData=None):
37
37
return autosar .portinterface .ApplicationError (name , errorCode , parent , adminData )
38
38
39
39
def ModeGroup (name , typeRef , parent = None , adminData = None ):
40
- return autosar .portinterface .ModeGroup (name , typeRef , parent , adminData )
41
-
42
- def CompuMethodConst (name , elements , parent = None , adminData = None ):
43
- return autosar .datatype .CompuMethodConst (name , elements , parent , adminData )
40
+ return autosar .mode .ModeGroup (name , typeRef , parent , adminData )
44
41
45
42
def ParameterDataPrototype (name , typeRef , swAddressMethodRef = None , swCalibrationAccess = None , initValue = None , parent = None , adminData = None ):
46
43
return autosar .element .ParameterDataPrototype (name , typeRef , swAddressMethodRef , swCalibrationAccess , initValue , parent , adminData )
47
44
48
45
49
46
#template support
50
47
class Template (ABC ):
51
-
48
+
52
49
usageCount = 0 #number of times this template have been applied
53
-
50
+ static_ref = ''
51
+
52
+ @classmethod
53
+ def ref (cls , ws ):
54
+ return cls .static_ref
55
+
54
56
@classmethod
55
57
def get (cls , ws ):
56
58
ref = cls .ref (ws )
57
59
if ws .find (ref ) is None :
58
60
ws .apply (cls )
59
61
return ws .find (ref )
60
-
62
+
61
63
@classmethod
62
64
@abstractmethod
63
65
def apply (cls , ws , ** kwargs ):
0 commit comments