<commit_before>#ifndef TIME_WARP_EVENT_SET_HPP
#define TIME_WARP_EVENT_SET_HPP

/* This class provides the set of APIs needed to handle events in
   an event set.
 */

#include <vector>
#include <set>
#include <unordered_map>
#include <mutex>
#include <memory>

#include "Event.hpp"
#include "STLLTSFQueue.hpp"
#include "utility/memory.hpp"

namespace warped {

/* Compares two events to see if one has a receive time less than to the other
 */
class compareEvents :
    public std::binary_function<std::shared_ptr<Event>, 
                                    std::shared_ptr<Event>, bool> {
public:
    bool operator() (std::shared_ptr<Event> first, 
                        std::shared_ptr<Event> second) {

        return (first->timestamp() <= second->timestamp()
                || first->sender_name_ <= second->sender_name_
                || first->rollback_cnt_ <= second->rollback_cnt_
                || first->event_type_ < second->event_type_);
    }
};

class TimeWarpEventSet {

public:
    TimeWarpEventSet() = default;

    void initialize (unsigned int num_of_objects, 
                     unsigned int num_of_schedulers,
                     unsigned int num_of_worker_threads);

    void insertEvent (unsigned int obj_id, std::shared_ptr<Event> event);

    std::shared_ptr<Event> getEvent (unsigned int thread_id);

    std::shared_ptr<Event> readLowestEventFromObj (unsigned int obj_id);

    void replenishScheduler (unsigned int obj_id, 
                                std::shared_ptr<Event> old_event);

    void fossilCollectAll (unsigned int fossil_collect_time);<commit_msg>modified the compare event function.<commit_after>#ifndef TIME_WARP_EVENT_SET_HPP
#define TIME_WARP_EVENT_SET_HPP

/* This class provides the set of APIs needed to handle events in
   an event set.
 */

#include <vector>
#include <set>
#include <unordered_map>
#include <mutex>
#include <memory>

#include "Event.hpp"
#include "STLLTSFQueue.hpp"
#include "utility/memory.hpp"

namespace warped {

/* Compares two events to see if one has a receive time less than to the other
 */
class compareEvents :
    public std::binary_function<std::shared_ptr<Event>, 
                                    std::shared_ptr<Event>, bool> {
public:
    bool operator() (std::shared_ptr<Event> first, 
                        std::shared_ptr<Event> second) {

        return (first->timestamp() < second->timestamp()
                || first->sender_name_ < second->sender_name_
                || first->rollback_cnt_ < second->rollback_cnt_
                || first->event_type_ < second->event_type_);
    }
};

class TimeWarpEventSet {

public:
    TimeWarpEventSet() = default;

    void initialize (unsigned int num_of_objects, 
                     unsigned int num_of_schedulers,
                     unsigned int num_of_worker_threads);

    void insertEvent (unsigned int obj_id, std::shared_ptr<Event> event);

    std::shared_ptr<Event> getEvent (unsigned int thread_id);

    std::shared_ptr<Event> readLowestEventFromObj (unsigned int obj_id);

    void replenishScheduler (unsigned int obj_id, 
                                std::shared_ptr<Event> old_event);

    void fossilCollectAll (unsigned int fossil_collect_time);
{'fraction_non_alphanumeric': 0.09665427509293681, 'fraction_numerical': 0.0, 'mean_word_length': 2.9282238442822384, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4087366', 'n_tokens_mistral': 965, 'n_tokens_neox': 914, 'n_words': 243}