The function above would be more concise if something like
sr_actuator::SrActuator* actuator = static_cast<sr_actuator::SrActuator*>(as[0]);
was defined at the beginning and used afterwards.