Exchanging data between analysis level and application level ============================================================ **Inside a given plugin**, data can be exchanged between code that run during analysis and code that run at the end of application through intermediate files. Each execution unit will trigger events from analysis level extension that will accumulate data into a intermediate files. During end_analysis those files can be read in order to perform a global operation. .. figure:: data_exchange.png :align: center During analysis by calling :func:`cast.analysers.AnalysisLevelExtension.get_intermediate_file`:: def MyExtension(cast.analysers.jee.Extension): def start_analysis(self, options): f = self.get_intermediate_file("file.txt") f.write('hello world') At the end of application by calling :func:`cast.application.ApplicationLevelExtension.get_intermediate_file`, .. automethod:: cast.application.ApplicationLevelExtension.get_intermediate_file that will act as an open 'fake file' corresponding to the contatenation of all intermediate files of the given name:: class ExtensionApplication(cast.application.ApplicationLevelExtension): def end_application(self, application): for line in self.get_intermediate_file("file.txt"): # should print hello world! to log logging.info(line) Or by calling :func:`cast.application.ApplicationLevelExtension.get_intermediate_files`, .. automethod:: cast.application.ApplicationLevelExtension.get_intermediate_files that will return each intermediate opened file one by one:: class ExtensionApplication(cast.application.ApplicationLevelExtension): def end_application(self, application): for f in self.get_intermediate_files("file.txt"): # should print hello world! to log logging.info(f.read()) The name of the file must be **unique per plugin**.