@Override public void populatePVStructure(Serialiser serialiser, SpiralModel model, PVStructure pvStructure) throws Exception { PVString name = pvStructure.getSubField(PVString.class, "name"); name.put(model.getName()); PVString fastAxisName = pvStructure.getSubField(PVString.class, "fastAxisName"); fastAxisName.put(model.getFastAxisName()); PVString slowAxisName = pvStructure.getSubField(PVString.class, "slowAxisName"); slowAxisName.put(model.getSlowAxisName()); PVDouble scale = pvStructure.getSubField(PVDouble.class, "scale"); scale.put(model.getScale()); PVStructure bbStructure = pvStructure.getStructureField("boundingBox"); serialiser.setValues(model.getBoundingBox(), bbStructure); }
@Override public Structure buildStructure(Serialiser serialiser, SpiralModel model) throws Exception { FieldCreate fieldCreate = FieldFactory.getFieldCreate(); Structure boundingBoxStructure = serialiser.buildStructure(model.getBoundingBox()); Structure structure = fieldCreate .createFieldBuilder() .add("name", ScalarType.pvString) .add("boundingBox", boundingBoxStructure) .add("fastAxisName", ScalarType.pvString) .add("slowAxisName", ScalarType.pvString) .add("scale", ScalarType.pvDouble) .setId("SpiralModel") .createStructure(); return structure; }