public int setStructure(Instances headerInfo){
  
      Capabilities cap = getCapabilities();
      if (!cap.test(headerInfo))
	throw new IllegalArgumentException(cap.getFailReason());
  
      if(m_writeMode == WAIT && headerInfo != null){
        m_instances = headerInfo;
        m_writeMode = STRUCTURE_READY;
      }
      else{
        if((headerInfo == null)  || !(m_writeMode == STRUCTURE_READY) || !headerInfo.equalHeaders(m_instances)){
            m_instances = null;
            if(m_writeMode != WAIT)
                System.err.println("A structure cannot be set up during an active incremental saving process.");
            m_writeMode = CANCEL;
        }
      }
      return m_writeMode;
  }