Generators generally have a very low amperage 12VDC output: like 8 or 10A.
So charging a battery with a generator directly isn’t a very efficient or effective solution in virtual all circumstances.
However, using a generator to power a device can be used quite successfully- like with an AIO or 120VAC to 12VDC nominal.
can a pure sinewave inverter be attached to a battery that is being charged by a gas generator i want to use a life poe 4 40 amp or more battery charger for when their is no sun for several days
So that scenario CAN be done - it is done all the time. I do it on the rare occasions when it is necessary.
I’m not sure what your circumstances are, but in my situation I am not grid-connected in any fashion. I rely on an AIO for battery charging.
Day to day I use a 2000W pure sine inverter for 120V, and a few different SCC’s for solar panel input.
The 12VDC-120VAC AIO on the wall is used primarily as a SCC with the inverter turned off, though I could connect it quickly if the inverter were needed for backup.
The AIO has a built-in 60A 12VDC nominal output battery ‘utility’ charger, and I have the parameters tailored for LiFePo4 battery bank’s charging needs. (Note that you can adjust aka limit the maximum charging amps in the parameter settings menu)
The AIO AC input is connected to the generator out in the shop. When I fire up the generator the AIO automatically begins charging the battery bank.
Just anticipating the question- my AIO is a 1012LV-MK which is moderately priced and allows using ~1000W of solar panels. There is a low priced 1012LV-MS model ($430) the difference being that it only supports ~500W of solar panels.
I hope that was a thorough answer to your question(s).