/* Blinker
   Copyright 2011-2019 Stefan Schuermans <stefan@blinkenarea.org>
   Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
   a blinkenarea.org project */

#ifndef BLINKER_OUTSYNCFILE_H
#define BLINKER_OUTSYNCFILE_H

#include <BlinkenLib/BlinkenFrame.h>

#include "File.h"
#include "SyncFile.h"
#include "SyncMgr.h"
#include "SyncRecv.h"

namespace Blinker {

/// setting file containting a name of an output sync stream
class OutSyncFile: public SyncFile
{
public:
  /**
   * @brief constructor from path
   * @param[in] path path to file
   * @param[in] syncMgr sync stream manager
   */
  OutSyncFile(const std::string &path, SyncMgr &syncMgr);

  /**
   * @brief constructor from basic file
   * @param[in] file basic file object
   * @param[in] syncMgr sync stream manager
   */
  OutSyncFile(const File &file, SyncMgr &syncMgr);

  /// destructor
  ~OutSyncFile();

  /**
   * @brief assignment operator
   * @param[in] file basic file object
   */
  const OutSyncFile & operator=(const File &file);

private:
  /// copy constructor disabled
  OutSyncFile(const OutSyncFile &that);

  /// assignment operator disabled
  const OutSyncFile & operator=(const OutSyncFile &that);

public:
  /// update, i.e. (re-)read file and reference new sync stream
  void update();

  /**
   * @brief send synchronization information
   * @param[in] pInfo synchronization information
   */
  void sendInfo(SyncRecv::Info &info);
}; // class OutSyncFile

} // namespace Blinker

#endif // #ifndef BLINKER_OUTSYNCFILE_H

