/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2012 University of California, Los Angeles
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
 *         卞超轶 Chaoyi Bian <bcy@pku.edu.cn>
 *	   Alexander Afanasyev <alexander.afanasyev@ucla.edu>
 */

#ifndef SYNC_SCHEDULER_H
#define SYNC_SCHEDULER_H

#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>

#include "sync-logic-event-container.h"

namespace Sync {

/**
 * @ingroup sync
 * @brief General purpose event scheduler
 *
 * This class internally runs a thread and events can be scheduled by specifying an absolute or relative time of the event
 */
class Scheduler
{
public:
  /**
   * @brief Default constructor. Thread will be created
   */
  Scheduler ();
  /**
   * @brief Destructor. Thread will be nicely stopped
   */
  ~Scheduler ();

  /**
   * @brief Schedule an event at absolute time 'abstime'
   * @param abstime Absolute time
   * @param event function to be called at the time
   */
  void
  schedule (const boost::system_time &abstime, Event event);

  /**
   * @brief Schedule an event at relative time 'reltime'
   * @param reltime Relative time
   * @param event function to be called at the time
   */
  void
  schedule (const boost::posix_time::time_duration &reltime, Event event); 


#ifdef _DEBUG
  size_t
  getEventsSize ()
  {
    boost::lock_guard<boost::mutex> lock (m_eventsMutex);
    return m_events.size ();
  }
#endif
  
private:
  void
  threadLoop ();
    
private:
  EventsContainer m_events;
  boost::condition_variable m_eventsCondition;
  boost::mutex  m_eventsMutex;

  boost::thread m_thread;
  bool          m_threadRunning;
};
  
}

#endif // SYNC_SCHEDULER_H
