示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBoxT.TextLength > 0)
            {
                button1.Visible = false;
                MegaMatriz            megaMatriz            = new MegaMatriz();
                F8                    codigof8              = new F8();
                AF8                   codigoaf8             = new AF8();
                Ordenar_Contorno      ordenar_Contorno      = new Ordenar_Contorno();
                Contorno              contorno              = new Contorno();
                BuscarCoordenadas     buscar_coordenadas    = new BuscarCoordenadas();
                Calcular_Error        calcular_Error        = new Calcular_Error();
                Seleccion_Segmentos   seleccion_Segmentos   = new Seleccion_Segmentos();
                Procesar_PQR          procesar_PQR          = new Procesar_PQR();
                Quitar_BPs            quitar_BPs            = new Quitar_BPs();
                ReOrdenamientoBPS     reOrdenamientoBPS     = new ReOrdenamientoBPS();
                Puntos_Dominantes2    puntos_Dominantes2    = new Puntos_Dominantes2();
                Obtener_subcadenasAF8 obtener_SubcadenasAF8 = new Obtener_subcadenasAF8();

                List <string>         PDs_alfa_siguiente  = new List <string>();
                List <Int32>          PDs_alpha_original  = new List <Int32>();
                List <int>            PDs_mantener_actual = new List <int>();
                List <Int32>          PDs_alpha_actual    = new List <Int32>();
                List <string>         PDs_objeto          = new List <string>();
                List <double>         ISES           = new List <double>();
                List <List <string> > Subcadenas_AF8 = new List <List <string> >();
                List <int>            PDs_ordenados  = new List <int>();
                List <int>            coordenadas_PDs_alfa_actual = new List <int>();
                List <int>            coordenadas_BP_reordenadas  = new List <int>();
                List <int>            PDs_ordenados_ant           = new List <int>();

                List <int> posiciones             = new List <int>();
                List <int> posiciones_almacenadas = new List <int>();
                List <int> posiciones_ant_act     = new List <int>();

                Convertir_a_Imagen Pintar_PDs = new Convertir_a_Imagen();

                string subcadena;



                double[,] distancias_ises = new double[5, 5];
                int[]    coor_pixel_inicial     = new int[3];
                int[]    coor_pixel_inicial_sig = new int[3];
                int[]    dimensiones            = new int[3];
                int[]    pqr        = new int[3];
                string[] vectorBase = new string[2];
                string[] rectas_discretas_actuales = new string[4];
                int      n, p_temporal, q_temporal, r_temporal, contador_BPs = 0;
                double   ISE, CR, WE, FOM, WE2, n_1, nDP;
                int      num_vecinos = 5;
                bool     continuar = false, repetir_penultimo = false;
                string   rectas_discretas2;

                double T;
                T = Convert.ToDouble(textBoxT.Text);
                textBoxT.Enabled = false;
                bool cambiar_resolucion = false, primer_alfa = true;

                dimensiones[0] = Moriginal.GetLength(0);
                dimensiones[1] = Moriginal.GetLength(1);
                dimensiones[2] = 1;

                n = 1;

                string subcadenas = Path.Combine(filepath, "Substrings of " + nombre + ".txt");
                File.Delete(subcadenas);

                do
                {
                    if (primer_alfa)
                    {
                        coor_pixel_inicial = buscar_coordenadas.Buscar_Primerpixel(Moriginal, n);
                        if (!It_is_file)
                        {
                            //Traverse the boundary of the 2D shape to obtain its coordinates.
                            coordenadas_contorno_ordenadas_original = ordenar_Contorno.Ordenar(Moriginal, coor_pixel_inicial)[0];
                        }
                        //Obtain the CC to f8 for the boundary of the original shape to know the maximum of p, q and r.
                        Restablecer(Moriginal);
                        cadenaAF8 = codigoaf8.CC_AF8(Moriginal, n, PDs_alfa_siguiente, It_is_file, coordenadas_contorno_ordenadas_original);
                        Restablecer(Moriginal);

                        //Function to obtain maximum p, q, r.
                        while (PDs_alfa_siguiente.Count != 0)
                        {
                            PDs_alfa_siguiente.RemoveAt(0);
                        }
                        pqr = procesar_PQR.Calcular_PQR(cadenaAF8);
                        p   = pqr[0];
                        q   = pqr[1];
                        r   = pqr[2];

                        label3.Visible   = true;
                        textBox2.Visible = true;
                        label6.Visible   = true;
                        textBox3.Visible = true;
                        label5.Visible   = true;
                        label4.Visible   = true;
                        textBox4.Visible = true;

                        textBox2.Text = p.ToString();
                        textBox3.Text = q.ToString();
                        textBox4.Text = r.ToString();
                    }
                    cadenaAF8 = codigoaf8.CC_AF8(Moriginal, n, PDs_alfa_siguiente, It_is_file, coordenadas_contorno_ordenadas_original);

                    if (coordenadas_contorno_ordenadas_original[coordenadas_contorno_ordenadas_original.Count - 1] < 0)
                    {
                        repetir_penultimo = true;
                    }
                    if (!It_is_file)
                    {
                        coordenadas_contorno_ordenadas_original.RemoveAt(coordenadas_contorno_ordenadas_original.Count - 1);
                    }
                    char[]   delimiter = { '0', '1', '2', '3', '4', '6', '7', '8', '9' };
                    string[] aAF8      = cadenaAF8.Split(delimiter, StringSplitOptions.RemoveEmptyEntries);
                    p_temporal = p;
                    q_temporal = q;
                    r_temporal = r;
                    do
                    {
                        //Store the BPs from the previous iteration to know which are the BPs detected after each change of r.
                        while (posiciones_ant_act.Count > 0)
                        {
                            posiciones_ant_act.RemoveAt(0);
                        }
                        for (int i = 0; i < posiciones_almacenadas.Count; i++)
                        {
                            posiciones_ant_act.Add(posiciones_almacenadas[i]);
                        }
                        while (posiciones.Count > 0)
                        {
                            posiciones.RemoveAt(0);
                        }
                        //Application of the language for detection of BPs.
                        rectas_discretas2 = puntos_Dominantes2.Coordenates_BPs(cadenaAF8, p_temporal, q_temporal, r_temporal, coordenadas_contorno_ordenadas_original, PDs_alfa_siguiente, primer_alfa);
                        label14.Visible   = true;

                        //Divide the chain into substrings according to the position where PDs are.
                        PDs_alpha_actual = Obtener_subcadenasAF8.Almacenar_PD_Lista(rectas_discretas2, primer_alfa);

                        //1000000000 This value allows to separate the DPs of different Segments of Discrete Straight Lines
                        Restablecer(Moriginal);
                        PDs_alpha_original = seleccion_Segmentos.Obtener_Coordenadas_PDs_reales(PDs_alpha_actual, Moriginal, alfa, true);
                        //-------------------------------------Error ISE -------------------------------------------------------------------------
                        PDs_alpha_actual = contorno.LimpiarDPs2(PDs_alpha_original, coor_pixel_inicial, posiciones);

                        for (int i = 0; i < posiciones.Count; i++)
                        {
                            posiciones_ant_act.Add(posiciones[i]);
                        }
                        //Create and store the images of the sets of BPs detected by L
                        Pintar_PDs.getDP(PDs_alpha_actual, new Bitmap(PDResultante.Image)).Save(filepath + "\\Detection" + list_ISE.Count + ".jpeg");
                        //------------------------------------------------------------------------------

                        //Calculation of the error made between each pair of BPs.
                        ISES = calcular_Error.Obtener_Error(PDs_alpha_actual, coordenadas_contorno_ordenadas_original, 0, repetir_penultimo);

                        //Store the different substrings in a file.
                        using (StreamWriter mylogs = File.AppendText(subcadenas))
                        {
                            List <int> sortedPosiciones = posiciones_ant_act.OrderBy(number => number).ToList();
                            int        index            = 0;
                            while (index < sortedPosiciones.Count - 1)
                            {
                                if (sortedPosiciones[index] == sortedPosiciones[index + 1])
                                {
                                    sortedPosiciones.RemoveAt(index);
                                }
                                else
                                {
                                    index++;
                                }
                            }

                            if (list_ISE.Count > 0)
                            {
                                List <int>    PD_temp  = new List <int>();
                                List <double> ISE_temp = new List <double>();
                                for (int k = 0; k < sortedPosiciones.Count; k++)
                                {
                                    PD_temp.Add(coordenadas_contorno_ordenadas_original[(sortedPosiciones[k] * 2)]);
                                    PD_temp.Add(coordenadas_contorno_ordenadas_original[(sortedPosiciones[k] * 2) + 1]);
                                    PD_temp.Add(sortedPosiciones[k]);
                                }
                                ISE_temp = calcular_Error.Obtener_Error(PD_temp, coordenadas_contorno_ordenadas_original, 0, true);
                                list_ISE.Add(ISE_temp[ISE_temp.Count - 1]);
                            }
                            else
                            {
                                list_ISE.Add(ISES[ISES.Count - 1]);
                            }

                            list_n_DPs.Add(sortedPosiciones.Count);

                            mylogs.WriteLine("-------------------------------------------------------------------------------");
                            mylogs.WriteLine("                                     r = " + r_temporal);
                            mylogs.WriteLine("-------------------------------------------------------------------------------");
                            contador_BPs = 0;
                            subcadena    = System.String.Empty;
                            string[] Substring = cadenaAF8.Split(' ');
                            for (int i = 0; i < Substring[Substring.Length - 2].Length; i++)
                            {
                                if (contador_BPs < sortedPosiciones.Count)
                                {
                                    if (sortedPosiciones[contador_BPs] != 0)
                                    {
                                        if (i == (sortedPosiciones[contador_BPs]))
                                        {
                                            mylogs.WriteLine(sortedPosiciones[contador_BPs - 1] + "," + subcadena);
                                            contador_BPs++;
                                            subcadena  = System.String.Empty;
                                            subcadena += Substring[Substring.Length - 2].Substring(i, 1);
                                        }
                                        else
                                        {
                                            subcadena += Substring[Substring.Length - 2].Substring(i, 1);
                                        }
                                    }
                                    else
                                    {
                                        contador_BPs++;
                                        subcadena += Substring[Substring.Length - 2].Substring(i, 1);
                                    }
                                }
                                else
                                {
                                    subcadena += Substring[Substring.Length - 2].Substring(i, 1);
                                }
                            }

                            mylogs.WriteLine((sortedPosiciones[sortedPosiciones.Count - 1]) + "," + subcadena);
                        }

                        //------------------------------------------------------------------------------


                        //----------- Obtain segments with errors greater than those allowed (T / sd). --------------
                        if (alfa >= 1)
                        {
                            cambiar_resolucion  = false;
                            PDs_mantener_actual = seleccion_Segmentos.Obtener_Segmentos(ISES, PDs_alpha_original, T, PDs_objeto, coordenadas_contorno_ordenadas_original, r_temporal, nombre, list_ISE);

                            if (PDs_mantener_actual.Count > 0)
                            {
                                int i_anterior = 0;
                                //Remove 1000000000 from the list of BPs
                                //-----------------------------------------------------------------------------------------------------------
                                for (int i = 0; i < PDs_alpha_original.Count; i++)
                                {
                                    if (PDs_alpha_original[i] == 1000000000)
                                    {
                                        PDs_alpha_original.RemoveAt(i);
                                        if (i == i_anterior + 3)
                                        {
                                            PDs_alpha_original.Insert(i, 0);
                                            PDs_alpha_original.Insert(i, 0);
                                        }
                                        i_anterior = i;
                                        i--;
                                    }
                                }
                                //-----------------------------------------------------------------------------------------------------------

                                for (int i = 0; i < PDs_mantener_actual.Count; i++)
                                {
                                    for (int j = 0; j < 6; j++)
                                    {
                                        if (j == 0 || j == 3)
                                        {
                                            if (!megaMatriz.Es_PD(PDs_objeto, PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6], PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6 + 1], PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6 + 2]))
                                            {
                                                //Store the coordinates of the BPs that generate an allowed error.
                                                //------------------------------------------------------------------------------------
                                                PDs_objeto.Add(PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6].ToString());
                                                PDs_objeto.Add(PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6 + 1].ToString());
                                                PDs_objeto.Add(PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6 + 2].ToString());
                                                posiciones_almacenadas.Add(PDs_alpha_original[(PDs_mantener_actual[i] * 6) - i * 6 + 2]);
                                                //------------------------------------------------------------------------------------
                                            }
                                        }
                                        PDs_alpha_original.RemoveAt((PDs_mantener_actual[i] * 6) - i * 6);
                                    }
                                    if (PDs_alpha_original.Count == 0)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                        else
                        {
                            while (PDs_alpha_original.Count > 0)
                            {
                                if (PDs_alpha_original[0] != 1000000000)
                                {
                                    PDs_objeto.Add(PDs_alpha_original[0].ToString());
                                }
                                PDs_alpha_original.RemoveAt(0);
                            }
                        }
                        //Decrease r, while p and q maintain their initial values.

                        while (PDs_alfa_siguiente.Count > 0)
                        {
                            PDs_alfa_siguiente.RemoveAt(0);
                        }
                        if (r_temporal > 0)
                        {
                            if (PDs_alpha_original.Count > 0)
                            {
                                repetir_penultimo = false;
                            }
                            for (int i = 0; i < PDs_alpha_original.Count; i++)
                            {
                                if (PDs_alpha_original[i] != 1000000000)
                                {
                                    if (i % 6 == 0 && i + 3 < PDs_alpha_original.Count)
                                    {
                                        //The coordinates of the BPs that do not meet the condition allow finding new BPs contained between them in those contour segments.
                                        if (PDs_alpha_original[i] != PDs_alpha_original[i + 3] || PDs_alpha_original[i + 1] != PDs_alpha_original[i + 4])
                                        {
                                            PDs_alfa_siguiente.Add(PDs_alpha_original[i].ToString());
                                        }
                                        else
                                        {
                                            i += 3;
                                        }
                                    }
                                    else
                                    {
                                        if ((i + 1) % 3 != 0)
                                        {
                                            PDs_alfa_siguiente.Add(PDs_alpha_original[i].ToString());
                                        }
                                    }
                                }
                            }
                        }
                        if (r_temporal > 1)
                        {
                            r_temporal = Convert.ToInt32(Math.Round(Convert.ToDouble(r_temporal) / 2, 1));
                        }
                        else if (r_temporal == 1)
                        {
                            r_temporal = 0;
                        }
                        else
                        {
                            r_temporal = -1;
                            while (PDs_alfa_siguiente.Count > 0)
                            {
                                if (PDs_alfa_siguiente[0] != "1000000000")
                                {
                                    PDs_objeto.Add(PDs_alfa_siguiente[0].ToString());
                                }
                                PDs_alfa_siguiente.RemoveAt(0);
                            }
                        }
                        primer_alfa = false;
                    } while (r_temporal != -1 && PDs_alfa_siguiente.Count != 0);
                } while (cambiar_resolucion && PDs_alfa_siguiente.Count > 0 && alfa > 1);
                //Eliminate repeated BPs to know the total number of them.
                PDs_objeto    = contorno.LimpiarDPs(PDs_objeto);
                PDs_ordenados = contorno.Ordenar_PDs_2(PDs_objeto, coordenadas_contorno_ordenadas_original);

                megaMatriz = null;
                posiciones_almacenadas.Clear();
                posiciones_ant_act.Clear();
                repetir_penultimo = true;
                int contador_eliminados = 0;

                do
                {
                    ISES = calcular_Error.Obtener_Error(PDs_ordenados, coordenadas_contorno_ordenadas_original, 0, repetir_penultimo);
                    if (list_ISE_Elimination.Count == 0)
                    {
                        list_ISE_Elimination.Add(ISES[ISES.Count - 1]);
                        list_n_DPs_Elimination.Add(PDs_ordenados.Count / 3);
                    }
                    list_ISE_Rearrangement.Add(ISES[ISES.Count - 1]);
                    list_n_DPs_Rearrangement.Add(PDs_ordenados.Count / 3);

                    Pintar_PDs.getDP(PDs_ordenados, new Bitmap(PDResultante.Image)).Save(filepath + "\\Elimination" + list_ISE_Elimination.Count + ".jpeg");
                    //Use of our novel method for the elimination of BPs.
                    PDs_ordenados = quitar_BPs.Eliminar_BPs_version2(PDs_ordenados, coordenadas_contorno_ordenadas_original, ISES, T);

                    ISES = calcular_Error.Obtener_Error(PDs_ordenados, coordenadas_contorno_ordenadas_original, 0, repetir_penultimo);

                    list_ISE_Elimination.Add(ISES[ISES.Count - 1]);
                    list_n_DPs_Elimination.Add(PDs_ordenados.Count / 3);

                    while (PDs_ordenados_ant.Count > 0)
                    {
                        PDs_ordenados_ant.RemoveAt(0);
                    }
                    for (int ii = 0; ii < PDs_ordenados.Count; ii++)
                    {
                        PDs_ordenados_ant.Add(PDs_ordenados[ii]);
                    }
                    //Create 5 graphs to use the Dijkstra algorithm.
                    distancias_ises = quitar_BPs.Mejor_acomodo_BPS(PDs_ordenados, coordenadas_contorno_ordenadas_original, T, num_vecinos);

                    //Use of Dijkstra to get the best fit of current BPs.
                    PDs_ordenados = reOrdenamientoBPS.NuevosBPs(distancias_ises, PDs_ordenados, coordenadas_contorno_ordenadas_original, num_vecinos);


                    //Storage of the rearrangement information.
                    Pintar_PDs.getDP(PDs_ordenados, new Bitmap(PDResultante.Image)).Save(filepath + "\\Rearrangement" + list_ISE_Rearrangement.Count + ".jpeg");

                    //Comparison of Sets of BPs of the previous and current iteration to know if there was any change, if not, end the loop.
                    continuar = Comparar_Listas_DPs(PDs_ordenados, PDs_ordenados_ant);
                    contador_eliminados++;
                } while (continuar);

                //Updating of errors made between each pair of BPs.
                ISES = calcular_Error.Obtener_Error(PDs_ordenados, coordenadas_contorno_ordenadas_original, 0, true);

                //----------------------------------------ISE ----------------------------------------------------------------------------

                ISE           = Math.Round(ISES[ISES.Count - 1], 4);
                textBox5.Text = ISE.ToString();

                //----------------------------------------n ----------------------------------------------------------------------------

                n_1 = coordenadas_contorno_ordenadas_original.Count / 2;
                nDP = ((PDs_ordenados.Count) / 3);
                //----------------------------------------CR ----------------------------------------------------------------------------

                CR = Math.Round(n_1 / nDP, 4);

                textBox6.Text = n_1.ToString();

                //----------------------------------------FOM ---------------------------------------------------------------------------
                FOM           = Math.Round(n_1 / (ISE * nDP), 4);
                textBox8.Text = FOM.ToString();

                //----------------------------------------WE ---------------------------------------------------------------------------
                WE            = Math.Round(ISE / CR, 4);
                textBox7.Text = WE.ToString();

                //----------------------------------------WE2 ---------------------------------------------------------------------------
                WE2           = Math.Round(ISE / Math.Pow(CR, 2), 4);
                textBox9.Text = WE2.ToString();

                textBox1.Text = nDP.ToString();


                label7.Visible   = true;
                label8.Visible   = true;
                label9.Visible   = true;
                label10.Visible  = true;
                label11.Visible  = true;
                label12.Visible  = true;
                labelT.Visible   = true;
                label13.Visible  = true;
                textBox1.Visible = true;
                textBox5.Visible = true;
                textBox6.Visible = true;
                textBox7.Visible = true;
                textBox8.Visible = true;
                textBox9.Visible = true;

                Clean.Visible   = true;
                Restart.Visible = true;
                label2.Text     = "Result";
                It_is_file      = false;

                //----------------------------------------------------------------------------------------------------------------------------



                PDResultante.Image = Pintar_PDs.Pintar_lineas(PDResultante, PDs_ordenados);
                PDResultante.Image = Pintar_PDs.getDP(PDs_ordenados, new Bitmap(PDResultante.Image));

                button2.Visible = true;
                //Storage of the generated polygon, its BPs and the original boundary on the hard disk.
                PDResultante.Image.Save(filepath + "\\Resultante_PDs" + nombre + ".jpeg");

                //Show the method information on the screen.
                this.Hide();
                Form_BPs_Detection bPs_Detection = new Form_BPs_Detection();
                bPs_Detection.Show(this);
                bPs_Detection.Mostrar_informacion(filepath, list_ISE, list_n_DPs, r, list_ISE_Elimination, list_n_DPs_Elimination, list_ISE_Rearrangement, list_n_DPs_Rearrangement);
            }
            else
            {
                string            message = "Assign a value to T to continue";
                string            caption = "Error Detected in Input";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;

                // Displays the MessageBox.
                result = MessageBox.Show(message, caption, buttons);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    // Closes the parent form.
                    this.Close();
                }
            }
        }
 public void TestInitialize()
 {
     objectUnderTest = new FOM(new MarketDataMock(), new RefDataMock());
 }
 public void TestCleanup()
 {
     objectUnderTest = null;
 }
示例#4
0
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write("\r\n// Code automatically generated by FOMCodeGen version ");

            #line 7 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(FOM.GeneratorVersion));

            #line default
            #line hidden
            this.Write(" from ");

            #line 7 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(System.IO.Path.GetFileName(FOM.Filename)));

            #line default
            #line hidden
            this.Write(", do not edit\r\n\r\n");

            #line 9 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            if (FOM.ModelIdentification.Name != null)
            {
            #line default
            #line hidden

            #line 10 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(FOMParser.FormatAsComment(FOM.ModelIdentification.Name, "Name: ")));

            #line default
            #line hidden
                this.Write("\r\n");

            #line 11 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            }

            #line default
            #line hidden

            #line 12 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            if (FOM.ModelIdentification.Copyright != null)
            {
            #line default
            #line hidden

            #line 13 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(FOMParser.FormatAsComment(FOM.ModelIdentification.Copyright, "Copyright: ")));

            #line default
            #line hidden
                this.Write("\r\n");

            #line 14 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            }

            #line default
            #line hidden

            #line 15 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            if (FOM.ModelIdentification.Version != null)
            {
            #line default
            #line hidden

            #line 16 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(FOMParser.FormatAsComment(FOM.ModelIdentification.Version, "Version: ")));

            #line default
            #line hidden
                this.Write("\r\n");

            #line 17 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            }

            #line default
            #line hidden

            #line 18 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            if (FOM.ModelIdentification.Description != null)
            {
            #line default
            #line hidden

            #line 19 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(FOMParser.FormatAsComment(FOM.ModelIdentification.Description, "Description: ")));

            #line default
            #line hidden
                this.Write("\r\n");

            #line 20 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            }

            #line default
            #line hidden

            #line 21 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            if (FOM.ModelIdentification.Purpose != null)
            {
            #line default
            #line hidden

            #line 22 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(FOMParser.FormatAsComment(FOM.ModelIdentification.Purpose, "Purpose: ")));

            #line default
            #line hidden
                this.Write("\r\n");

            #line 23 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            }

            #line default
            #line hidden
            this.Write("\r\n#pragma once\r\n\r\n#include <vector>\r\n#include <ostream>\r\n#include <cassert>\r\n#inc" +
                       "lude <new>\r\n#include <utility>\r\n#include <type_traits>\r\n\r\n");

            #line 34 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(FOM.GetPredefinedTypeIncludes(FOMParser.FileContext.kDataTypes)));

            #line default
            #line hidden
            this.Write("\r\n\r\n");

            #line 36 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"

            foreach (var namespacePart in FOM.Namespace)
            {
            #line default
            #line hidden
                this.Write("namespace ");

            #line 40 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(namespacePart));

            #line default
            #line hidden
                this.Write(" {\r\n");

            #line 41 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            }

            #line default
            #line hidden
            this.Write("\r\n// define placement_new in case some other header has redefined operator new to" +
                       " sth. different (e.g. MS crtdbg)\r\n#ifndef _PLACEMENT_NEW_DEFINED\r\n#pragma push_m" +
                       "acro(\"new\")\r\n#undef new\r\ntemplate <class X, typename ... Types>\r\ninline X* place" +
                       "ment_new(void* addr, Types&& ... args)\r\n{\r\n  return new (addr) X(std::forward<Ty" +
                       "pes>(args)...);\r\n}\r\n#pragma pop_macro(\"new\")\r\n#define _PLACEMENT_NEW_DEFINED\r\n#e" +
                       "ndif\r\n\r\n// define our own simplified \'optional\' types, similar to but independen" +
                       "t of std::optional (since C++17) or boost::optional\r\n\r\nstruct nullopt_t\n{\n  enum" +
                       " class _Construct { _Token };\n  explicit constexpr nullopt_t(_Construct) { }\n};\n" +
                       "\n/// Tag to disengage optional objects.\nconstexpr nullopt_t nullopt { nullopt_t:" +
                       ":_Construct::_Token };\n\r\nclass bad_optional_access : public std::exception\r\n{\r\np" +
                       "ublic:\r\n  virtual const char* what() const noexcept override { return (\"Bad opti" +
                       "onal access\"); }\r\n};\r\n\r\n// (empty) base template\r\ntemplate<typename T, bool=std:" +
                       ":is_class<T>::value > struct optional {};\r\n\r\n// Specialization for classes and s" +
                       "tructs used by-value, w. in-place copy-construction.\r\n// This implementation is " +
                       "limited to copy-constructible and default-destructible classes!\r\ntemplate<typena" +
                       "me T> struct optional<T, true>\r\n{\r\n  static_assert(!std::is_reference< T >::valu" +
                       "e, \"reference is not supported as optional value\");\r\n  // constructors\r\n  option" +
                       "al() noexcept : _valid(false) {}\r\n  constexpr optional(nullopt_t) noexcept : _va" +
                       "lid(false) {}\r\n  optional(const optional& rhs): _valid(rhs._valid) { create(rhs)" +
                       "; }\r\n  optional(const T& w): _valid(true) { create(w); }\r\n  template<typename Ot" +
                       "her>\r\n  optional(const Other& w): _valid(true) { create(w); }\r\n  template<typena" +
                       "me Other>\r\n  optional(const optional<Other>& rhs): _valid(rhs.has_value()) { if " +
                       "(rhs.has_value()) create(rhs.value()); }\r\n\r\n  // destructor\r\n  ~optional() { if(" +
                       "_valid) destroy(); }\r\n\r\n  // check for value presence\r\n  bool has_value() const " +
                       "{ return _valid; }\r\n  explicit operator bool() const { return _valid; }\r\n  bool " +
                       "operator ! () const { return !_valid; }\r\n\r\n  // assign\r\n  optional& operator = (" +
                       "optional const& rhs) { return assign(rhs); }\r\n  optional& operator = (T const& w" +
                       ") { return assign(w); }\r\n\r\n  // unchecked access to value\r\n  const T& operator *" +
                       " () const & { return *get(); }\r\n  T& operator * () & { return *get(); }\r\n  T con" +
                       "st* operator -> () const { return get(); }\r\n  T* operator -> () { return get(); " +
                       "}\r\n  // checked access to value\r\n  const T& value() const & {\r\n    if (!_valid) " +
                       "{\r\n      throw bad_optional_access{};\r\n    }\r\n    return *get();\r\n  }\r\n  T& valu" +
                       "e() & {\r\n    if (!_valid) {\r\n      throw bad_optional_access{};\r\n    }\r\n    retu" +
                       "rn *get();\r\n  }\r\nprivate:\r\n  template<typename Other>\r\n  void create(const Other" +
                       "& w) { placement_new<T>(&_value, w); }\r\n  void create(const optional& rhs) { if(" +
                       "_valid) create(*rhs.get()); }\r\n  void destroy() { get()->~T(); }\r\n  T const* get" +
                       "() const { assert(_valid && \"no optional value\"); return reinterpret_cast< const" +
                       " T* >(&_value); }\r\n  T* get() { assert(_valid && \"no optional value\"); return re" +
                       "interpret_cast< T* >(&_value); }\r\n  void cleanup() { destroy(); _valid = false; " +
                       "}\r\n  optional& assign(const T& w) {\r\n    if(_valid) *get() = w;\r\n    else create" +
                       "(w), _valid = true;\r\n    return *this;\r\n  }\r\n  optional& assign(const optional& " +
                       "rhs) {\r\n    if(rhs._valid) return assign(*rhs.get());\r\n    if(!_valid) return *t" +
                       "his;\r\n    cleanup();\r\n    return *this;\r\n  }\r\n  bool _valid;\r\n\tunion {\r\n    type" +
                       "name std::remove_cv<T>::type _value;\r\n  };\r\n};\r\n// Specialization for const-ref " +
                       "parameters, implemented by holding a pointer to the original variable.\r\n// Note " +
                       "that non-const references are *not* supported (but could be easily added)!\r\ntemp" +
                       "late<typename T> struct optional<const T&, false>\r\n{\r\n  // constructors\r\n  optio" +
                       "nal() noexcept : _valid(false), _pointer() {}\r\n  constexpr optional(nullopt_t) n" +
                       "oexcept : _valid(false), _pointer() {}\r\n  optional(const optional& rhs): _valid(" +
                       "rhs._valid), _pointer(rhs._pointer) { }\r\n  optional(const T& rhs) noexcept : _va" +
                       "lid(true), _pointer(&rhs) { }\r\n  template<typename Other>\r\n  optional(const Othe" +
                       "r& rhs): _valid(true), _pointer(&rhs) { }\r\n  template<typename Other>\r\n  optiona" +
                       "l(const optional<Other>& rhs): _valid(rhs.has_value()), _pointer(rhs.operator->(" +
                       ")) { }\r\n\r\n  // destructor\r\n  ~optional() { }\r\n\r\n  // check for value presence\r\n " +
                       " bool has_value() const { return _valid; }\r\n  explicit operator bool() const { r" +
                       "eturn _valid; }\r\n  bool operator ! () const { return !_valid; }\r\n\r\n  // assign\r\n" +
                       "  optional& operator = (const optional& rhs) {\r\n    _valid = rhs._valid;\r\n    _p" +
                       "ointer = rhs._pointer;\r\n    return *this;\r\n  }\r\n  optional& operator = (const T&" +
                       " w) {\r\n    _valid = true;\r\n    _pointer = &w;\r\n    return *this;\r\n  }\r\n  // unch" +
                       "ecked access to value\r\n  T const& operator * () const & { return *get(); }\r\n  T " +
                       "const* operator -> () const & { return get(); }\r\n  // checked access to value\r\n " +
                       " const T& value() const & {\r\n    if (!_valid) {\r\n      throw bad_optional_access" +
                       "{};\r\n    }\r\n    return *get();\r\n  }\r\n  T& value() & {\r\n    if (!_valid) {\r\n     " +
                       " throw bad_optional_access{};\r\n    }\r\n    return *get();\r\n  }\r\nprivate:\r\n  const" +
                       " T* get() const {\r\n    assert(_valid && \"no optional value\");\r\n    return _point" +
                       "er;\r\n  }\r\n  bool _valid;\r\n  const T* _pointer = nullptr;\r\n};\r\n// Specialization " +
                       "for everything else, which includes fundamental types and pointer types.\r\ntempla" +
                       "te<typename T> struct optional<T, false>\r\n{\r\n  // constructors\r\n  optional() noe" +
                       "xcept : _valid(false), _value() {}\r\n  constexpr optional(nullopt_t) noexcept : _" +
                       "valid(false), _value() {}\r\n  optional(const optional& rhs): _valid(rhs._valid), " +
                       "_value(rhs._value) { }\r\n  optional(const T& rhs) : _valid(true), _value(rhs) { }" +
                       "\r\n  template<typename Other>\r\n  optional(const Other& rhs): _valid(true), _value" +
                       "(rhs) { }\r\n  template<typename Other>\r\n  optional(const optional<Other>& rhs): _" +
                       "valid(rhs.has_value()), _value(rhs.operator*()) { }\r\n\r\n  // destructor\r\n  ~optio" +
                       "nal() { }\r\n\r\n  // check for value presence\r\n  bool has_value() const { return _v" +
                       "alid; }\r\n  explicit operator bool() const { return _valid; }\r\n  bool operator ! " +
                       "() const { return !_valid; }\r\n\r\n  // assign\r\n  optional& operator = (const optio" +
                       "nal& rhs) {\r\n    _valid = rhs._valid;\r\n    _value = rhs._value;\r\n    return *thi" +
                       "s;\r\n  }\r\n  optional& operator = (const T& w) {\r\n    _valid = true;\r\n    _value =" +
                       " w;\r\n    return *this;\r\n  }\r\n  // unchecked access to value\r\n  T const& operator" +
                       " * () const & { return _value; }\r\n  T const* operator -> () const { return &_val" +
                       "ue; }\r\n  // checked access to value\r\n  const T& value() const & {\r\n    if (!_val" +
                       "id) {\r\n      throw bad_optional_access{};\r\n    }\r\n    return _value;\r\n  }\r\n  T& " +
                       "value() & {\r\n    if (!_valid) {\r\n      throw bad_optional_access{};\r\n    }\r\n    " +
                       "return _value;\r\n  }\r\nprivate:\r\n  bool _valid;\r\n  T _value;\r\n};\r\n\r\nclass InvalidL" +
                       "ogicalTime : public std::logic_error\r\n{\r\n  public:\r\n    InvalidLogicalTime(const" +
                       " std::string& what_arg) : std::logic_error(what_arg) {}\r\n};\r\n\r\nclass NotConnecte" +
                       "d : public std::logic_error\r\n{\r\n  public:\r\n    NotConnected() : std::logic_error" +
                       "(\"not connected\") {}\r\n};\r\n\r\nclass NotInitialized : public std::logic_error\r\n{\r\n " +
                       " public:\r\n    NotInitialized() : std::logic_error(\"class registry not initialize" +
                       "d\") {}\r\n};\r\n\r\n// extended receive order type, includes \'interpolated\' for applic" +
                       "ation-generated timestamps\r\nenum class OrderType { RECEIVE, TIMESTAMP, INTERPOLA" +
                       "TED };\r\n\r\ntemplate<typename char_type, typename traits_type>\r\nstd::basic_ostream" +
                       "<char_type, traits_type>&\r\noperator<<(std::basic_ostream<char_type, traits_type>" +
                       "& os, OrderType value)\r\n{\r\n  switch (value)\r\n  {\r\n    case OrderType::RECEIVE: o" +
                       "s << \"RECEIVE\"; break;\r\n    case OrderType::TIMESTAMP: os << \"TIMESTAMP\"; break;" +
                       "\r\n    case OrderType::INTERPOLATED: os << \"INTERPOLATED\"; break;\r\n  }\r\n  return " +
                       "os;\r\n}\r\n\r\ninline std::string to_string(OrderType value)\r\n{\r\n  switch (value)\r\n  " +
                       "{\r\n    case OrderType::RECEIVE: return \"RECEIVE\";\r\n    case OrderType::TIMESTAMP" +
                       ": return \"TIMESTAMP\";\r\n    case OrderType::INTERPOLATED: return \"INTERPOLATED\";\r" +
                       "\n  }\r\n}\r\n\r\ninline std::wstring to_wstring(OrderType value)\r\n{\r\n  switch (value)\r" +
                       "\n  {\r\n    case OrderType::RECEIVE: return L\"RECEIVE\";\r\n    case OrderType::TIMES" +
                       "TAMP: return L\"TIMESTAMP\";\r\n    case OrderType::INTERPOLATED: return L\"INTERPOLA" +
                       "TED\";\r\n  }\r\n}\r\n");

            #line 300 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(FOM.DataTypeForwardDeclarations));

            #line default
            #line hidden
            this.Write("\r\n");

            #line 303 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"

            foreach (var dataType in FOM.DataTypes)
            {
                if (dataType is FOMParser.SimpleDataType && dataType.Generate)
                {
                    var simpleDataType = dataType as FOMParser.SimpleDataType;
                    if (dataType.Comment != null && dataType.Comment != "")
                    {
            #line default
            #line hidden

            #line 311 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Comment));

            #line default
            #line hidden
                        this.Write("\r\n");

            #line 312 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    }

            #line default
            #line hidden
                    this.Write("typedef ");

            #line 313 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(simpleDataType.Representation.CPPType));

            #line default
            #line hidden
                    this.Write(" ");

            #line 313 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(simpleDataType.Name));

            #line default
            #line hidden
                    this.Write(";\r\n\r\n");

            #line 315 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                } // if (dataType is FOMParser.SimpleDataType)
                else if (dataType is FOMParser.FixedRecordDataType)
                {
                    var fixedRecordDataType = dataType as FOMParser.FixedRecordDataType;
                    if (dataType.Comment != null && dataType.Comment != "")
                    {
            #line default
            #line hidden

            #line 321 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(fixedRecordDataType.Comment));

            #line default
            #line hidden
                        this.Write("\r\n");

            #line 322 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    }

            #line default
            #line hidden
                    this.Write("class ");

            #line 323 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(fixedRecordDataType.Name));

            #line default
            #line hidden

            #line 323 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(fixedRecordDataType.BaseClass != null ? " : public " + fixedRecordDataType.BaseClass.Name : ""));

            #line default
            #line hidden
                    this.Write("\r\n{\r\n  public:\r\n    virtual ~");

            #line 326 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(fixedRecordDataType.Name));

            #line default
            #line hidden
                    this.Write("() noexcept {}\r\n");

            #line 327 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    if (fixedRecordDataType.BaseClass == null)
                    {
            #line default
            #line hidden
                        this.Write("    virtual uint32_t getVersion() const = 0;\r\n");

            #line 329 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    }

            #line default
            #line hidden

            #line 330 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    foreach (var field in fixedRecordDataType.Fields)
                    {
            #line default
            #line hidden
                        this.Write("    virtual void Set");

            #line 331 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(field.Name));

            #line default
            #line hidden
                        this.Write("(");

            #line 331 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(field.DataType.ParameterCppType));

            #line default
            #line hidden
                        this.Write(" value) = 0;\r\n");

            #line 332 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        if (field.DataType is FOMParser.ArrayDataType)
                        {
                            var arrayDataType = field.DataType as FOMParser.ArrayDataType;


            #line default
            #line hidden
                            this.Write("    virtual void Set");

            #line 335 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                            this.Write(this.ToStringHelper.ToStringWithCulture(field.Name));

            #line default
            #line hidden
                            this.Write("(const ");

            #line 335 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                            this.Write(this.ToStringHelper.ToStringWithCulture(arrayDataType.DataType.CPPType));

            #line default
            #line hidden
                            this.Write("* value, size_t size) = 0;\r\n");

            #line 336 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        }

            #line default
            #line hidden
                        this.Write("    virtual ");

            #line 337 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(field.DataType.ReturnCppType));

            #line default
            #line hidden
                        this.Write(" Get");

            #line 337 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(field.Name));

            #line default
            #line hidden
                        this.Write("() const = 0;\r\n    virtual bool Is");

            #line 338 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(field.Name));

            #line default
            #line hidden
                        this.Write("Available() const = 0;\r\n");

            #line 339 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    } // foreach fixedRecordDataType.Fields

            #line default
            #line hidden
                    this.Write("\r\n}; // class ");

            #line 341 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Name));

            #line default
            #line hidden
                    this.Write("\r\n\r\n");

            #line 343 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                } // if (dataType is FOMParser.FixedRecordDataType)
                else if (dataType is FOMParser.EnumeratedDataType && dataType.Generate)
                {
                    var enumeratedDataType = dataType as FOMParser.EnumeratedDataType;
                    if (dataType.Comment != null && dataType.Comment != "")
                    {
            #line default
            #line hidden

            #line 350 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Comment));

            #line default
            #line hidden
                        this.Write("\r\n");

            #line 351 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    }

            #line default
            #line hidden
                    this.Write("enum class ");

            #line 352 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Name));

            #line default
            #line hidden
                    this.Write(" : ");

            #line 352 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(enumeratedDataType.Representation.CPPType));

            #line default
            #line hidden
                    this.Write("\r\n{\r\n");

            #line 354 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"

                    foreach (var enumerator in enumeratedDataType.Enumerators.Values)
                    {
                        if (enumerator.Comment != null)
                        {
            #line default
            #line hidden
                            this.Write("      ");

            #line 359 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                            this.Write(this.ToStringHelper.ToStringWithCulture(enumerator.Comment));

            #line default
            #line hidden
                            this.Write("\r\n");

            #line 360 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        }

            #line default
            #line hidden
                        this.Write("      ");

            #line 361 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(enumerator.Name));

            #line default
            #line hidden
                        this.Write(" = ");

            #line 361 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(enumerator.Value));

            #line default
            #line hidden
                        this.Write(",\r\n");

            #line 362 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    } // foreach enumeratedDataType.Enumerators.Values


            #line default
            #line hidden
                    this.Write("}; // enum ");

            #line 365 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Name));

            #line default
            #line hidden
                    this.Write("\r\n\r\ntemplate<typename char_type, typename traits_type>\r\nstd::basic_ostream<char_t" +
                               "ype, traits_type>&\r\noperator<<(std::basic_ostream<char_type, traits_type>& os, ");

            #line 369 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Name));

            #line default
            #line hidden
                    this.Write(" value)\r\n{\r\n  switch (value)\r\n  {\r\n");

            #line 373 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"

                    foreach (var enumerator in enumeratedDataType.Enumerators.Values)
                    {
            #line default
            #line hidden
                        this.Write("    case ");

            #line 377 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Name));

            #line default
            #line hidden
                        this.Write("::");

            #line 377 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(enumerator.Name));

            #line default
            #line hidden
                        this.Write(": os << \"");

            #line 377 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(enumerator.Name));

            #line default
            #line hidden
                        this.Write("\"; break;\r\n");

            #line 378 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    } // foreach enumeratedDataType.Enumerators.Values


            #line default
            #line hidden
                    this.Write("    default: os << \"<invalid ");

            #line 381 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Name));

            #line default
            #line hidden
                    this.Write(">\"; break;\r\n  }\r\n  return os;\r\n}\r\n\r\ninline std::string to_string(");

            #line 386 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Name));

            #line default
            #line hidden
                    this.Write(" value)\r\n{\r\n  switch (value)\r\n  {\r\n");

            #line 390 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"

                    foreach (var enumerator in enumeratedDataType.Enumerators.Values)
                    {
            #line default
            #line hidden
                        this.Write("    case ");

            #line 394 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Name));

            #line default
            #line hidden
                        this.Write("::");

            #line 394 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(enumerator.Name));

            #line default
            #line hidden
                        this.Write(": return \"");

            #line 394 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(enumerator.Name));

            #line default
            #line hidden
                        this.Write("\";\r\n");

            #line 395 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    } // foreach enumeratedDataType.Enumerators.Values


            #line default
            #line hidden
                    this.Write("    default: return \"<invalid ");

            #line 398 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Name));

            #line default
            #line hidden
                    this.Write(">\";\r\n  }\r\n}\r\n\r\ninline std::wstring to_wstring(");

            #line 402 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Name));

            #line default
            #line hidden
                    this.Write(" value)\r\n{\r\n  switch (value)\r\n  {\r\n");

            #line 406 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"

                    foreach (var enumerator in enumeratedDataType.Enumerators.Values)
                    {
            #line default
            #line hidden
                        this.Write("    case ");

            #line 410 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Name));

            #line default
            #line hidden
                        this.Write("::");

            #line 410 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(enumerator.Name));

            #line default
            #line hidden
                        this.Write(": return L\"");

            #line 410 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(enumerator.Name));

            #line default
            #line hidden
                        this.Write("\";\r\n");

            #line 411 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    } // foreach enumeratedDataType.Enumerators.Values


            #line default
            #line hidden
                    this.Write("    default: return L\"<invalid ");

            #line 414 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(dataType.Name));

            #line default
            #line hidden
                    this.Write(">\";\r\n  }\r\n}\r\n\r\n");

            #line 418 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                } // if (dataType is FOMParser.EnumeratedDataType)
            }     // foreach (var dataType in FOM.DataTypes.Values)


            #line default
            #line hidden
            this.Write("\r\n");

            #line 423 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"

            foreach (var namespacePart in FOM.Namespace)
            {
            #line default
            #line hidden
                this.Write("} // namespace ");

            #line 427 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(namespacePart));

            #line default
            #line hidden
                this.Write("\r\n");

            #line 428 "D:\vfs\OpenRTI\src\Tools\FOMCodeGen\FOMDataTypesHeader.tt"
            }

            #line default
            #line hidden
            return(this.GenerationEnvironment.ToString());
        }