/* -*- 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
   * @param label Label for the event
   */
  void
  schedule (const boost::system_time &abstime, Event event, uint32_t label);

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

  /**
   * @brief Cancel all events for the label
   * @param label Label of the event that needs to be cancelled
   */
  void
  cancel (uint32_t label);

#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
