Evolution of the magnetic properties and magnetic structures along the RmMIn3m+2 (R=Ce, Nd, Gd, Tb; M=Rh, Ir; and m=1,2) series of intermetallic compounds