CppGenerator.xtend 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. package be.uantwerpen.ansymo.semanticadaptation.cg.cpp.generation
  2. import be.uantwerpen.ansymo.semanticadaptation.generator.SemanticAdaptationGenerator
  3. import org.eclipse.xtext.generator.IFileSystemAccess2
  4. import org.eclipse.xtext.generator.IGeneratorContext
  5. import be.uantwerpen.ansymo.semanticadaptation.semanticAdaptation.SemanticAdaptation
  6. import org.eclipse.emf.ecore.resource.Resource
  7. import be.uantwerpen.ansymo.semanticadaptation.semanticAdaptation.Adaptation
  8. import java.util.ArrayList
  9. import java.util.LinkedHashMap
  10. import be.uantwerpen.ansymo.semanticadaptation.cg.cpp.data.MappedScalarVariable
  11. import be.uantwerpen.ansymo.semanticadaptation.semanticAdaptation.InnerFMU
  12. import be.uantwerpen.ansymo.semanticadaptation.cg.cpp.exceptions.IncorrectAmountOfElementsException
  13. import java.io.File
  14. import be.uantwerpen.ansymo.semanticadaptation.cg.cpp.data.SAScalarVariable
  15. import be.uantwerpen.ansymo.semanticadaptation.cg.cpp.data.InputOutputType
  16. import org.eclipse.emf.common.util.EList
  17. import be.uantwerpen.ansymo.semanticadaptation.semanticAdaptation.Port
  18. import be.uantwerpen.ansymo.semanticadaptation.cg.cpp.data.SVCausality
  19. import java.util.Collection
  20. import be.uantwerpen.ansymo.semanticadaptation.semanticAdaptation.InOutRules
  21. import be.uantwerpen.ansymo.semanticadaptation.semanticAdaptation.InRulesBlock
  22. import be.uantwerpen.ansymo.semanticadaptation.cg.cpp.data.InOutRulesBlockResult
  23. import be.uantwerpen.ansymo.semanticadaptation.semanticAdaptation.OutRulesBlock
  24. import be.uantwerpen.ansymo.semanticadaptation.cg.cpp.data.GlobalInOutVariable
  25. import be.uantwerpen.ansymo.semanticadaptation.semanticAdaptation.ControlRuleBlock
  26. import be.uantwerpen.ansymo.semanticadaptation.cg.cpp.data.RulesBlockResult
  27. import be.uantwerpen.ansymo.semanticadaptation.cg.cpp.data.ScalarVariable
  28. import java.util.List
  29. import be.uantwerpen.ansymo.semanticadaptation.cg.cpp.data.SVType
  30. import be.uantwerpen.ansymo.semanticadaptation.semanticAdaptation.ParamDeclarations
  31. class CppGenerator extends SemanticAdaptationGenerator {
  32. private var IFileSystemAccess2 fsa;
  33. override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
  34. this.fsa = fsa;
  35. for (SemanticAdaptation type : resource.allContents.toIterable.filter(SemanticAdaptation)) {
  36. type.compile;
  37. }
  38. }
  39. // TODO: Verify adaptation.name is not a C++ keyword
  40. def void compile(SemanticAdaptation adaptation) {
  41. for (Adaptation type : adaptation.elements.filter(Adaptation)) {
  42. // Value used for scoping variables in the .sa file
  43. val adapInteralRefName = type.name;
  44. // The CPP class name
  45. val adapClassName = type.name.toFirstUpper;
  46. // This is the external name used in the model description file for the semantic adaptation FMU.
  47. val adapExternalName = type.type.name;
  48. // List of FMUs with a pairing between its name and its type.name.
  49. var ArrayList<Pair<String, String>> fmus = newArrayList();
  50. // TODO: Currently only 1 inner fmu is supported
  51. val innerFmus = type.inner.eAllContents.toList.filter(InnerFMU);
  52. if (innerFmus.size > 1) {
  53. throw new IncorrectAmountOfElementsException("Only one InnerFmu is supported.")
  54. }
  55. if (innerFmus.isEmpty) {
  56. throw new IncorrectAmountOfElementsException("The adaptation does not contain any InnerFMUs.")
  57. }
  58. /*
  59. * This map will contain scalar variables from the FMUs defined in InnerFMU.
  60. * The structure is fmuName -> (SVName -> mappedSV) where SVName = mappedSV.name for easy lookup.
  61. * The mappedSV contains the original scalar variable and extra data such as define name.
  62. */
  63. var LinkedHashMap<String, LinkedHashMap<String, MappedScalarVariable>> mappedScalarVariables = newLinkedHashMap();
  64. /*
  65. * Loading the FMU defined in InnerFMU, the related model description file and its scalar variables.
  66. */
  67. // TODO: Add support for multiple inner fmus
  68. var ModelDescription md;
  69. for (fmu : type.inner.eAllContents.toList.filter(InnerFMU)) {
  70. md = new ModelDescription(fmu.name, fmu.type.name, new File(fmu.path.replace('\"', '')));
  71. fmus.add(fmu.name -> fmu.type.name);
  72. val LinkedHashMap<String, MappedScalarVariable> mSV = newLinkedHashMap();
  73. for (sv : md.sv.values) {
  74. var mappedSv = new MappedScalarVariable(sv);
  75. mappedSv.define = (mappedSv.mappedSv.owner + mappedSv.mappedSv.name).toUpperCase;
  76. mSV.put(mappedSv.mappedSv.name, mappedSv);
  77. }
  78. mappedScalarVariables.put(fmu.name, mSV);
  79. }
  80. // C++ Defines for accessing FMU scalar variables.
  81. val String fmusDefines = calcDefines(mappedScalarVariables);
  82. // Compile Params
  83. var LinkedHashMap<String, GlobalInOutVariable> params = newLinkedHashMap;
  84. val String paramsConstructorSource = compileParams(params, type.params);
  85. /*
  86. * This map contains all the ScalarVariables for the semantic adaptation.
  87. * The are not populated yet, but they will be during the compilation of the in and out rule blocks.
  88. */
  89. var LinkedHashMap<String, SAScalarVariable> SASVs = calcSASVsFromInportsOutports(adapInteralRefName,
  90. type.inports, type.outports)
  91. // C++ defines for accessing semantic adaptation scalar variables
  92. val String SADefines = calcSADefines(SASVs.values);
  93. // Compile the in rules
  94. val inRuleResult = compileInOutRuleBlocks(InputOutputType.Input, adaptation.eAllContents.toIterable.filter(
  95. InRulesBlock).map[x|x as InOutRules], adapClassName, adapInteralRefName, mappedScalarVariables, SASVs,
  96. params);
  97. // Compile the out rules
  98. val outRuleResult = compileInOutRuleBlocks(InputOutputType.Output, adaptation.eAllContents.toIterable.
  99. filter(OutRulesBlock).map[x|x as InOutRules], adapClassName, adapInteralRefName, mappedScalarVariables,
  100. SASVs, params);
  101. // Compile the Control Rules
  102. val crtlRuleResult = compileControlRuleBlock(adaptation.eAllContents.toIterable.filter(ControlRuleBlock),
  103. adapClassName, adapInteralRefName, SASVs);
  104. /*
  105. * Compile the constructor, destructor and initialize functions
  106. */
  107. val String deAndConstructorAndInitializeSource = compileDeAndConstructorAndInitialize(
  108. adapClassName,
  109. fmus.head.key,
  110. fmus.head.value,
  111. md.guid,
  112. paramsConstructorSource,
  113. inRuleResult.constructorInitialization,
  114. outRuleResult.constructorInitialization
  115. );
  116. /*
  117. * Compile getRuleThis function
  118. */
  119. val String getRuleThisSource = compileGetRuleThis(adapClassName);
  120. /*
  121. * The in and out rules have populated the semantic adaptation scalar variables we can generate the getFmiValue* and setFmiValue functions.
  122. */
  123. val String getFuncsSource = compileGetFmiValueFunctions(adapClassName, SASVs);
  124. val String setFuncsSource = compileSetFmiValueFunctions(adapClassName, SASVs);
  125. // Compile the source file
  126. val String sourceInclude = '''#include "«adapClassName».h"''';
  127. val sourceFile = compileSource(
  128. sourceInclude,
  129. deAndConstructorAndInitializeSource,
  130. getRuleThisSource,
  131. getFuncsSource,
  132. setFuncsSource,
  133. inRuleResult.generatedCpp,
  134. outRuleResult.generatedCpp,
  135. crtlRuleResult.generatedCpp
  136. );
  137. fsa.generateFile(adapClassName + ".cpp", sourceFile);
  138. // Merge the global variables for use in compiling the header file.
  139. // TODO: Check for duplicates
  140. var LinkedHashMap<String, GlobalInOutVariable> allGVars = newLinkedHashMap();
  141. allGVars.putAll(params);
  142. allGVars.putAll(outRuleResult.gVars);
  143. allGVars.putAll(inRuleResult.gVars);
  144. // Compile the header file
  145. val headerFile = compileHeader(
  146. adapClassName,
  147. fmusDefines,
  148. SADefines,
  149. inRuleResult.functionSignatures,
  150. outRuleResult.functionSignatures,
  151. crtlRuleResult.functionSignatures,
  152. allGVars,
  153. fmus,
  154. SASVs.values.map[CalcSVar()].toList
  155. );
  156. fsa.generateFile(adapClassName + ".h", headerFile);
  157. // Compile the model description file
  158. val modelDescCreator = new ModelDescriptionCreator(adapExternalName);
  159. val modelDescription = modelDescCreator.generateModelDescription(SASVs.values);
  160. fsa.generateFile("modelDescription.xml", modelDescription);
  161. // Compile the fmu.cpp file
  162. val fmuCppFile = StaticGenerators.GenFmuCppFile(adapClassName);
  163. fsa.generateFile("Fmu.cpp", fmuCppFile);
  164. }
  165. }
  166. def String compileParams(LinkedHashMap<String, GlobalInOutVariable> gVars, EList<ParamDeclarations> params) {
  167. val paramsConditionSwitch = new ParamConditionSwitch(gVars);
  168. var String paramsConstructorSource = "";
  169. for (paramDecl : params) {
  170. val doSwitchRes = paramsConditionSwitch.doSwitch(paramDecl);
  171. paramsConstructorSource += doSwitchRes.code;
  172. }
  173. return paramsConstructorSource;
  174. }
  175. def calcSADefines(Collection<SAScalarVariable> variables) {
  176. var ArrayList<String> defines = newArrayList();
  177. for (SASV : variables) {
  178. defines.add("#define " + SASV.defineName + " " + SASV.valueReference);
  179. }
  180. return defines.join("\n");
  181. }
  182. def calcDefines(LinkedHashMap<String, LinkedHashMap<String, MappedScalarVariable>> map) {
  183. var ArrayList<String> defines = newArrayList();
  184. for (fmuEntries : map.entrySet) {
  185. for (MappedScalarVariable mSV : fmuEntries.value.values) {
  186. defines.add("#define " + mSV.define + " " + mSV.valueReference);
  187. }
  188. }
  189. return defines.join("\n");
  190. }
  191. // Compiles the final source file
  192. def String compileSource(String include, String constructor, String getRuleThis, String getFunctions,
  193. String setFunctions, String inFunctions, String outFunctions, String controlFunction) {
  194. return '''
  195. «include»
  196. namespace adaptation
  197. {
  198. «constructor»
  199. «getRuleThis»
  200. «getFunctions»
  201. «setFunctions»
  202. «inFunctions»
  203. «controlFunction»
  204. «outFunctions»
  205. }
  206. '''
  207. }
  208. /*
  209. * Compiles the header file split into two: The first part contains the includes and using namespace definitions and start the ,
  210. * the second part contains the class
  211. */
  212. def String compileHeader(String adapClassName, String fmusDefines, String SADefines, List<String> inRulesFuncSig,
  213. List<String> outRulesFuncSig, List<String> crtlRulesFuncSig,
  214. LinkedHashMap<String, GlobalInOutVariable> globalVariables, ArrayList<Pair<String, String>> fmus,
  215. Collection<ScalarVariable> sVars) {
  216. return '''
  217. #ifndef SRC_«adapClassName.toUpperCase»_H
  218. #define SRC_«adapClassName.toUpperCase»_H
  219. #include "SemanticAdaptation.h"
  220. #include <memory>
  221. #include "Fmu.h"
  222. using namespace std;
  223. using namespace fmi2;
  224. namespace adaptation
  225. {
  226. «fmusDefines»
  227. «SADefines»
  228. class «adapClassName» : public SemanticAdaptation<«adapClassName»>, public enable_shared_from_this<«adapClassName»>
  229. {
  230. public:
  231. «adapClassName»(shared_ptr<string> resourceLocation, const fmi2CallbackFunctions* functions);
  232. void initialize();
  233. virtual ~«adapClassName»();
  234. void setFmiValue(fmi2ValueReference id, int value);
  235. void setFmiValue(fmi2ValueReference id, bool value);
  236. void setFmiValue(fmi2ValueReference id, double value);
  237. void setFmiValue(fmi2ValueReference id, string value);
  238. int getFmiValueInteger(fmi2ValueReference id);
  239. bool getFmiValueBoolean(fmi2ValueReference id);
  240. double getFmiValueReal(fmi2ValueReference id);
  241. string getFmiValueString(fmi2ValueReference id);
  242. private:
  243. «adapClassName»* getRuleThis();
  244. /*in rules*/
  245. «inRulesFuncSig.map[x | x+";"].join("\n")»
  246. /*out rules*/
  247. «outRulesFuncSig.map[x | x+";"].join("\n")»
  248. «crtlRulesFuncSig.map[x | x+";"].join("\n")»
  249. «FOR fmu : fmus»
  250. shared_ptr<FmuComponent> «fmu.key»;
  251. «ENDFOR»
  252. «FOR sv : sVars»
  253. «Conversions.fmiTypeToCppType(sv.type)» «sv.name»;
  254. «IF sv.causality == SVCausality.input»
  255. bool isSet«sv.name»;
  256. «ENDIF»
  257. «ENDFOR»
  258. «FOR v : globalVariables.entrySet»
  259. «Conversions.fmiTypeToCppType(v.value.type)» «v.key»;
  260. «ENDFOR»
  261. };
  262. }
  263. #endif
  264. ''';
  265. }
  266. /*
  267. * Compiles the source file constructor, destructor and the initialize function
  268. */
  269. def String compileDeAndConstructorAndInitialize(String adapClassName, String fmuName, String fmuTypeName,
  270. String guid, String paramsCons, String inCons, String outCons) {
  271. return '''
  272. «adapClassName»::«adapClassName»(shared_ptr<string> resourceLocation, const fmi2CallbackFunctions* functions) :
  273. SemanticAdaptation(resourceLocation, createInputRules(),createOutputRules(), functions)
  274. {
  275. «paramsCons»
  276. «inCons»
  277. «outCons»
  278. }
  279. void «adapClassName»::initialize()
  280. {
  281. auto path = Fmu::combinePath(resourceLocation, make_shared<string>("«fmuTypeName».fmu"));
  282. auto «fmuName»Fmu = make_shared<fmi2::Fmu>(*path);
  283. «fmuName»Fmu->initialize();
  284. this->«fmuName» = «fmuName»Fmu->instantiate("«fmuName»",fmi2CoSimulation, "«guid»", true, true, shared_from_this());
  285. if(this->«fmuName»->component == NULL)
  286. this->lastErrorState = fmi2Fatal;
  287. this->instances->push_back(this->«fmuName»);
  288. }
  289. «adapClassName»::~«adapClassName»()
  290. {
  291. }
  292. ''';
  293. }
  294. /*
  295. * Compiles the source file function getRuleThis
  296. */
  297. def String compileGetRuleThis(String adaptationName) {
  298. return '''
  299. «adaptationName»* «adaptationName»::getRuleThis()
  300. {
  301. return this;
  302. }
  303. '''
  304. }
  305. /*
  306. * Compiles the source file functions getFmiValue<double, int, string, bool>
  307. */
  308. def String compileGetFmiValueFunctions(String adaptationName, LinkedHashMap<String, SAScalarVariable> variables) {
  309. var ArrayList<String> cpp = newArrayList();
  310. var List<ScalarVariable> convertedSASVs = variables.values.map[CalcSVar()].toList;
  311. var convertedSASVsOrdered = convertedSASVs.filter[causality === SVCausality.output].groupBy[type];
  312. for (SVType type : SVType.values) {
  313. val functionSignature = '''«Conversions.fmiTypeToCppType(type)» «adaptationName»::getFmiValue«type.toString»(fmi2ValueReference id)''';
  314. val functionReturn = '''return «Conversions.fmiTypeToCppDefaultValue(type)»''';
  315. if (convertedSASVsOrdered.containsKey(type)) {
  316. cpp.add(
  317. '''
  318. «functionSignature»
  319. {
  320. switch (id)
  321. {
  322. «FOR svInner : convertedSASVsOrdered.get(type)»
  323. case «variables.get(svInner.name).defineName»:
  324. {
  325. return this->«svInner.name»;
  326. }
  327. «ENDFOR»
  328. default:
  329. {
  330. «functionReturn»;
  331. }
  332. }
  333. }
  334. '''
  335. );
  336. } else {
  337. cpp.add(
  338. '''
  339. «functionSignature»
  340. {
  341. «functionReturn»;
  342. }
  343. '''
  344. );
  345. }
  346. }
  347. return cpp.join("\n");
  348. }
  349. /*
  350. * Compiles the source file functions setFmiValue<double, int, string, bool>*
  351. */
  352. def String compileSetFmiValueFunctions(String adapClassName, LinkedHashMap<String, SAScalarVariable> variables) {
  353. var ArrayList<String> cpp = newArrayList();
  354. var List<ScalarVariable> convertedSASVs = variables.values.map[CalcSVar()].filter [
  355. causality === SVCausality.input
  356. ].toList;
  357. var convertedSASVsOrdered = convertedSASVs.groupBy[type];
  358. for (SVType type : SVType.values) {
  359. cpp.add(
  360. '''
  361. void «adapClassName»::setFmiValue(fmi2ValueReference id, «Conversions.fmiTypeToCppType(type)» value)
  362. {
  363. «IF convertedSASVsOrdered.containsKey(type)»
  364. switch (id)
  365. {
  366. «FOR svInner : convertedSASVsOrdered.get(type)»
  367. case «variables.get(svInner.name).defineName»:
  368. {
  369. this->«svInner.name» = value;
  370. this->isSet«svInner.name» = true;
  371. break;
  372. }
  373. «ENDFOR»
  374. default:
  375. {
  376. }
  377. }
  378. «ENDIF»
  379. }
  380. '''
  381. );
  382. }
  383. return cpp.join("\n");
  384. }
  385. /*
  386. * Compiles the source file function executeInternalControlFlow.
  387. * Calculates necessary information on function signatures necessary for generation of the header file.
  388. */
  389. def RulesBlockResult compileControlRuleBlock(Iterable<ControlRuleBlock> crtlRuleBlocks, String adaptationClassName,
  390. String adaptationName, LinkedHashMap<String, SAScalarVariable> SASVs) {
  391. var cpp = "";
  392. val visitor = new ControlConditionSwitch(adaptationClassName, adaptationName, SASVs);
  393. for (crtlRule : crtlRuleBlocks) {
  394. cpp += visitor.doSwitch(crtlRule).code;
  395. }
  396. return new RulesBlockResult(cpp, visitor.functionSignatures);
  397. }
  398. def String SplitAtSpaceAndRemoveFirst(String content) {
  399. content.substring(content.indexOf(" ") + 1, content.length);
  400. }
  401. def String removeEmptyArgumentParenthesis(String content) {
  402. return content.substring(0, content.length - 2);
  403. }
  404. /*
  405. * Compiles the source file functions <in/out>_rule_<condition, body, flush>.
  406. * Calculates necessary information on global in/out variables necessary for generation of the header file.
  407. * Calculates necessary information on function signatures necessary for generation of the header file.
  408. */
  409. def InOutRulesBlockResult compileInOutRuleBlocks(InputOutputType ioType, Iterable<InOutRules> rulesBlocks,
  410. String adaptationClassName, String adaptationName,
  411. LinkedHashMap<String, LinkedHashMap<String, MappedScalarVariable>> mSVars,
  412. LinkedHashMap<String, SAScalarVariable> SASVs, LinkedHashMap<String, GlobalInOutVariable> params) {
  413. val visitor = if (ioType == InputOutputType.Input)
  414. new InRulesConditionSwitch(adaptationClassName, adaptationName, mSVars, SASVs, params)
  415. else
  416. new OutRulesConditionSwitch(adaptationClassName, adaptationName, mSVars, SASVs, params);
  417. val functionName = "create" + ioType + "Rules()";
  418. var String cpp = "";
  419. val ruleBlock = rulesBlocks.head;
  420. if (ruleBlock !== null) {
  421. cpp += visitor.doSwitch(ruleBlock).code;
  422. if (!visitor.functionSignatures.empty) {
  423. var ArrayList<String> createRulesFunction = newArrayList();
  424. for (var int i = 0; i < (visitor.functionSignatures.length); i += 3) {
  425. createRulesFunction.add(
  426. '''
  427. list->push_back(
  428. (Rule<«adaptationClassName»>){
  429. &«adaptationClassName»::«visitor.functionSignatures.get(i).SplitAtSpaceAndRemoveFirst.removeEmptyArgumentParenthesis»,
  430. &«adaptationClassName»::«visitor.functionSignatures.get(i+1).SplitAtSpaceAndRemoveFirst.removeEmptyArgumentParenthesis»,
  431. &«adaptationClassName»::«visitor.functionSignatures.get(i+2).SplitAtSpaceAndRemoveFirst.removeEmptyArgumentParenthesis»
  432. });
  433. ''');
  434. }
  435. val functionPrefix = '''shared_ptr<list<Rule<«adaptationClassName»>>>''';
  436. visitor.functionSignatures.add(functionPrefix + " " + functionName)
  437. cpp += '''
  438. «functionPrefix» «adaptationClassName»::«functionName»
  439. {
  440. auto list = make_shared<std::list<Rule<«adaptationClassName»>>>();
  441. «createRulesFunction.join("\n")»
  442. return list;
  443. }
  444. '''
  445. }
  446. }
  447. return new InOutRulesBlockResult(cpp, visitor.functionSignatures, visitor.getGlobalVars,
  448. visitor.constructorInitialization);
  449. }
  450. /*
  451. * Calculates the semantic adaptation scalar variables via input ports and output ports.
  452. * Note: These a not fully populated yet as the in rules and out rules must be compiled first.
  453. */
  454. def LinkedHashMap<String, SAScalarVariable> calcSASVsFromInportsOutports(String definePrefix, EList<Port> inports,
  455. EList<Port> outports) {
  456. var LinkedHashMap<String, SAScalarVariable> saSVs = newLinkedHashMap();
  457. var int valueReference = 0;
  458. for (inport : inports) {
  459. var saSV = new SAScalarVariable();
  460. saSV.SetPartOfMD(true);
  461. saSV.valueReference = valueReference++;
  462. saSV.name = inport.name;
  463. saSV.defineName = (definePrefix + inport.name).toUpperCase
  464. saSV.causality = SVCausality.input;
  465. saSVs.put(saSV.name, saSV);
  466. }
  467. for (outport : outports) {
  468. var saSV = new SAScalarVariable();
  469. saSV.SetPartOfMD(true);
  470. saSV.valueReference = valueReference++;
  471. saSV.defineName = (definePrefix + outport.name).toUpperCase
  472. saSV.name = outport.name;
  473. saSV.causality = SVCausality.output;
  474. saSVs.put(saSV.name, saSV);
  475. }
  476. return saSVs;
  477. }
  478. }