Ejemplo n.º 1
0
        void GenerateComponent(ComponentDefenition component)
        {
            /* Generate component Folder */
            String componentFolder = RteFunctionsGenerator.GetComponentsFolder() + "\\" + component.Name;
            String rteDir          = RteFunctionsGenerator.GetRteFolder() + "\\";
            String incDir          = componentFolder + "\\include\\";
            String srcDir          = componentFolder + "\\src\\";

            Directory.CreateDirectory(incDir);
            Directory.CreateDirectory(srcDir);

            /* Fill sections of code */


            /* Each component runnable shall be in its own file */
            foreach (PeriodicRunnableDefenition runnable in component.Runnables)
            {
                CreateRunnable(srcDir, runnable);
            }

            /* Each Server port functions shall be in its own file */
            foreach (PortDefenition port in component.Ports)
            {
                if (port.PortType == PortType.Server)
                {
                    CreateServerCalls(srcDir, component, port);
                }
            }

            /* Generate funcitons for Sender-Receiver ports and call operations from client ports */
            CreateRteIncludes(rteDir, component);

            CreateComponentIncludes(incDir, component);
        }
Ejemplo n.º 2
0
        public bool Generate()
        {
            /* Create base folders */
            Directory.CreateDirectory(RteFunctionsGenerator.GetComponentsFolder());
            Directory.CreateDirectory(RteFunctionsGenerator.GetRteFolder());
            GenerateDataTypesFile();
            GenerateComponentsFiles();
            GenerateConnections();
            GenerateScheduler();

            ReturnCodesGenerator returnCodesGenerator = new ReturnCodesGenerator();

            returnCodesGenerator.GenerateReturnCodesFile(RteFunctionsGenerator.GetRteFolder());

            /* Create system errors file */
            SystemErrorGenerator systemErrorGenerator = new SystemErrorGenerator();

            systemErrorGenerator.GenerateSystemErrorsFile(RteFunctionsGenerator.GetRteFolder());

            return(true);
        }