<commit_before>#ifndef PCS_HPP
#define PCS_HPP

#include <string>
#include <vector>
#include <memory>
#include <random>

#include "warped.hpp"

WARPED_DEFINE_OBJECT_STATE_STRUCT(PcsState) {

    unsigned int normal_channels_;
    unsigned int reserve_channels_;
    unsigned int call_attempts_;
    unsigned int channel_blocks_;
    unsigned int busy_lines_;
    unsigned int handoff_blocks_;
};

enum event_type_t {

    CALL_ARRIVED,
    CALL_COMPLETED,
    MOVE_CALL_IN,
    MOVE_CALL_OUT
};

enum channel_type_t {

    NONE,
    NORMAL,
    RESERVE
};

enum direction_t {

    LEFT,
    RIGHT,
    DOWN,
    UP
};

class PcsEvent : public warped::Event {
public:

    PcsEvent() = default;

    PcsEvent(   const std::string   receiver_name, 
                unsigned int        timestamp, 
                unsigned int        call_arrival_ts, 
                event_type_t        event_type, 
                channel_type_t      channel_type    )

        :   receiver_name_(receiver_name), 
            event_timestamp_(timestamp), 
            call_arrival_ts_(call_arrival_ts), 
            event_type_(event_type), 
            channel_type_(channel_type) {}

    const std::string& receiverName() const { return receiver_name_; }
    unsigned int timestamp() const { return event_timestamp_; }

    std::string     receiver_name_;
    unsigned int    event_timestamp_;
    unsigned int    call_arrival_ts_;
    event_type_t    event_type_;
    channel_type_t  channel_type_;

    WARPED_REGISTER_SERIALIZABLE_MEMBERS(cereal::base_class<warped::Event>(this), 
                                            receiver_name_, event_timestamp_, event_type_, 
                                            channel_type_, call_arrival_ts_)
};

class PcsCell : public warped::SimulationObject {
public:

    PcsCell(    const std::string&  name, 
                unsigned int        num_cells_x, 
                unsigned int        num_cells_y, 
                unsigned int        max_normal_ch_cnt, 
                unsigned int        max_reserve_ch_cnt, 
                unsigned int        call_interval_mean, 
                unsigned int        call_duration_mean, 
                unsigned int        move_interval_mean, 
                unsigned int        portable_cnt, 
                unsigned int        index      )

        :   SimulationObject(name), 
            state_(), 
            num_cells_x_(num_cells_x), 
            num_cells_y_(num_cells_y), 
            max_normal_ch_cnt_(max_normal_ch_cnt), 
            max_reserve_ch_cnt_(max_reserve_ch_cnt), 
            call_interval_mean_(call_interval_mean), 
            call_duration_mean_(call_duration_mean), 
            move_interval_mean_(move_interval_mean),
            portable_init_cnt_(portable_cnt),
            index_(index),
            rng_(new std::default_random_engine(index)) {

        // Update the state variables
        state_.normal_channels_  = max_normal_ch_cnt_;
        state_.reserve_channels_ = max_reserve_ch_cnt_;
        state_.call_attempts_    = 0;
        state_.channel_blocks_   = 0;
        state_.busy_lines_       = 0;
        state_.handoff_blocks_   = 0;
    }

    virtual warped::ObjectState& getState() { return state_; }

    virtual std::vector<std::shared_ptr<warped::Event> > initializeObject() override;

    virtual std::vector<std::shared_ptr<warped::Event> > receiveEvent(const warped::Event&);

    PcsState state_;

protected:

    unsigned int num_cells_x_;
    unsigned int num_cells_y_;
    unsigned int max_normal_ch_cnt_;
    unsigned int max_reserve_ch_cnt_;
    unsigned int call_interval_mean_;
    unsigned int call_duration_mean_;
    unsigned int move_interval_mean_;
    unsigned int portable_init_cnt_;
    unsigned int index_;

    std::shared_ptr<std::default_random_engine> rng_;

    std::string compute_move(direction_t direction);
    std::string random_move();
};

#endif<commit_msg>re-structured the event class and added action() in object class<commit_after>#ifndef PCS_HPP
#define PCS_HPP

#include <string>
#include <vector>
#include <memory>
#include <random>

#include "warped.hpp"

WARPED_DEFINE_OBJECT_STATE_STRUCT(PcsState) {

    unsigned int normal_channels_;
    unsigned int reserve_channels_;
    unsigned int call_attempts_;
    unsigned int channel_blocks_;
    unsigned int busy_lines_;
    unsigned int handoff_blocks_;
};

enum method_t {

    NEXT_CALL_METHOD, 
    COMPLETE_CALL_METHOD, 
    MOVE_CALL_IN_METHOD, 
    MOVE_CALL_OUT_METHOD
};

enum action_t {

    NEXTCALL, 
    COMPLETECALL, 
    MOVECALL
};

enum channel_type_t {

    NONE,
    NORMAL,
    RESERVE
};

enum direction_t {

    LEFT,
    RIGHT,
    DOWN,
    UP
};

class PcsEvent : public warped::Event {
public:

    PcsEvent() = default;

    PcsEvent(   const std::string   receiver_name, 
                unsigned int        event_ts, 
                unsigned int        complete_call_ts, 
                unsigned int        next_call_ts, 
                unsigned int        move_call_ts,
                method_t            method, 
                channel_type_t      channel_type    )

        :   receiver_name_(receiver_name), 
            event_ts_(event_ts), 
            complete_call_ts_(complete_call_ts), 
            next_call_ts_(next_call_ts), 
            move_call_ts_(move_call_ts), 
            method_(method), 
            channel_type_(channel_type) {}

    const std::string& receiverName() const { return receiver_name_; }

    unsigned int timestamp() const { return event_ts_; }

    std::string     receiver_name_;
    unsigned int    event_ts_;
    unsigned int    complete_call_ts_;
    unsigned int    next_call_ts_;
    unsigned int    move_call_ts_;
    method_t        method_;
    channel_type_t  channel_type_;

    WARPED_REGISTER_SERIALIZABLE_MEMBERS(cereal::base_class<warped::Event>(this), 
                                            receiver_name_, event_ts_, 
                                            complete_call_ts_, next_call_ts_, 
                                            move_call_ts_, method_, channel_type_)
};

class PcsCell : public warped::SimulationObject {
public:

    PcsCell(    const std::string&  name, 
                unsigned int        num_cells_x, 
                unsigned int        num_cells_y, 
                unsigned int        max_normal_ch_cnt, 
                unsigned int        max_reserve_ch_cnt, 
                unsigned int        call_interval_mean, 
                unsigned int        call_duration_mean, 
                unsigned int        move_interval_mean, 
                unsigned int        portable_cnt, 
                unsigned int        index      )

        :   SimulationObject(name), 
            state_(), 
            num_cells_x_(num_cells_x), 
            num_cells_y_(num_cells_y), 
            max_normal_ch_cnt_(max_normal_ch_cnt), 
            max_reserve_ch_cnt_(max_reserve_ch_cnt), 
            call_interval_mean_(call_interval_mean), 
            call_duration_mean_(call_duration_mean), 
            move_interval_mean_(move_interval_mean),
            portable_init_cnt_(portable_cnt),
            index_(index),
            rng_(new std::default_random_engine(index)) {

        // Update the state variables
        state_.normal_channels_  = max_normal_ch_cnt_;
        state_.reserve_channels_ = max_reserve_ch_cnt_;
        state_.call_attempts_    = 0;
        state_.channel_blocks_   = 0;
        state_.busy_lines_       = 0;
        state_.handoff_blocks_   = 0;
    }

    virtual warped::ObjectState& getState() { return state_; }

    virtual std::vector<std::shared_ptr<warped::Event> > initializeObject() override;

    virtual std::vector<std::shared_ptr<warped::Event> > receiveEvent(const warped::Event&);

    PcsState state_;

protected:

    unsigned int num_cells_x_;
    unsigned int num_cells_y_;
    unsigned int max_normal_ch_cnt_;
    unsigned int max_reserve_ch_cnt_;
    unsigned int call_interval_mean_;
    unsigned int call_duration_mean_;
    unsigned int move_interval_mean_;
    unsigned int portable_init_cnt_;
    unsigned int index_;

    std::shared_ptr<std::default_random_engine> rng_;

    std::string compute_move(direction_t direction);
    std::string random_move();

    action_t action(unsigned int complete_call_ts, 
                    unsigned int next_call_ts, 
                    unsigned int move_call_ts);
};

#endif
{'fraction_non_alphanumeric': 0.06672988028920232, 'fraction_numerical': 0.0009482043380348466, 'mean_word_length': 2.209585393685812, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4855386', 'n_tokens_mistral': 2575, 'n_tokens_neox': 2407, 'n_words': 483}