docstr: Write a weights array to C++ header files.
  
  Args:
      var (WeightVariable): Weight to write
      odir (str): Output directory
      write_txt_file (bool, optional): Write txt files in addition to .h files. Defaults to True.
docstr_tok: ["Write","a","weights","array","to","C++","header","files",".","Args",":","var","(","WeightVariable",")",":","Weight","to","write","odir","(","str",")",":","Output","directory","write_txt_file","(","bool",",","optional",")",":","Write","txt","files","in","addition","to",".h","files",".","Defaults","to","True","."]
code: def print_array_to_cpp(self, var, odir, write_txt_file=True):
      """Write a weights array to C++ header files.
  
      Args:
          var (WeightVariable): Weight to write
          odir (str): Output directory
          write_txt_file (bool, optional): Write txt files in addition to .h files. Defaults to True.
      """
  
      h_file = open(f"{odir}/firmware/weights/{var.name}.h", "w")
      if write_txt_file:
          txt_file = open(
              f"{odir}/firmware/weights/{var.name}.txt", "w"
          )
  
      # meta data
      h_file.write(f"//Numpy array shape {var.shape}\n")
      h_file.write(f"//Min {np.min(var.min):.12f}\n")
      h_file.write(f"//Max {np.max(var.max):.12f}\n")
      h_file.write(f"//Number of zeros {var.nzeros}\n")
      h_file.write("\n")
  
      h_file.write(f"#ifndef {var.name.upper()}_H_\n")
      h_file.write(f"#define {var.name.upper()}_H_\n")
      h_file.write("\n")
  
      if write_txt_file:
          h_file.write("#ifndef __SYNTHESIS__\n")
          h_file.write(var.definition_cpp() + ";\n")
          h_file.write("#else\n")
  
      h_file.write(var.definition_cpp() + " = {")
  
      # fill c++ array.
      # not including internal brackets for multidimensional case
      sep = ""
      for x in var:
          h_file.write(sep + x)
          if write_txt_file:
              txt_file.write(sep + x)
          sep = ", "
      h_file.write("};\n")
      if write_txt_file:
          h_file.write("#endif\n")
          txt_file.close()
      h_file.write("\n#endif\n")
      h_file.close()
  
imports: import glob
  import os
  import tarfile
  from collections import OrderedDict
  from shutil import copyfile, copytree, rmtree
  import numpy
  import yaml
  from hls4ml.writer.writers import Writer
label_desc: Use image node_id 1 for calling the VivadoWriter obj's underlying member method code with example usage: obj.print_array_to_cpp(var, odir, write_txt_file) without return types