<commit_before>#ifndef BROADCAST_H
#define BROADCAST_H

#include <iostream>
#include <list>
#include <thread>
#include <time.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <unistd.h>
#include <netdb.h>
#include <cstring>
#include <Salamandre-stats/stats.hpp>


namespace salamandre {
namespace stats {

    // Program identifier
    const char SALAMANDRE_PROGRAM_ID[8] = "Salaman";
    enum MESSAGE_TYPE:unsigned int {
        MESSAGE_INVALID = 0,
        MESSAGE_PRESENCE = 10,
        MESSAGE_RECOVER = 20
    };
    typedef struct message_struct {
        unsigned int type;
        // For Presence
        int my_port;
        // For Recover
        int id_medecin;
        int id_patient;
        char filename[4];
    } Message;
    typedef struct serialized_message_stuct {
        char program_identifier[8];
        unsigned int type;
        // For Presence
        int my_port;
        // For Recover
        int id_medecin;
        int id_patient;
        char filename[4];
    } SerializedMessage;

    class Broadcast
    {
    public:
        Broadcast(int port, int listen_port);

        bool start();
        bool stop();
        void dispatch(Message message, std::string source_ip);
        void send(const Message message);

    private:
        bool setupSocket();
        void receive();
        SerializedMessage * serialize(const Message message);
        Message deserialize(void * buffer);

        int port;
        int listen_port;
        int listen_socket;
        int socket;
        bool running;
        struct sockaddr_in destination;
        std::thread thread_receive;
    };
}
}



#endif // BROADCAST_H
<commit_msg>[stats] Ensure that struct has the same size in 32 and 64 bits<commit_after>#ifndef BROADCAST_H
#define BROADCAST_H

#include <iostream>
#include <list>
#include <thread>
#include <time.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <unistd.h>
#include <netdb.h>
#include <cstring>
#include <Salamandre-stats/stats.hpp>


namespace salamandre {
namespace stats {

    // Program identifier
    const char SALAMANDRE_PROGRAM_ID[8] = "Salaman";
    enum MESSAGE_TYPE:unsigned int {
        MESSAGE_INVALID = 0,
        MESSAGE_PRESENCE = 10,
        MESSAGE_RECOVER = 20
    };
    typedef struct message_struct {
        uint32_t type;
        // For Presence
        uint32_t my_port;
        // For Recover
        uint32_t id_medecin;
        uint32_t id_patient;
        char filename[4];
    } Message;
    typedef struct serialized_message_stuct {
        char program_identifier[8];
        uint32_t type;
        // For Presence
        uint32_t my_port;
        // For Recover
        uint32_t id_medecin;
        uint32_t id_patient;
        char filename[4];
    } SerializedMessage;

    class Broadcast
    {
    public:
        Broadcast(int port, int listen_port);

        bool start();
        bool stop();
        void dispatch(Message message, std::string source_ip);
        void send(const Message message);

    private:
        bool setupSocket();
        void receive();
        SerializedMessage * serialize(const Message message);
        Message deserialize(void * buffer);

        int port;
        int listen_port;
        int listen_socket;
        int socket;
        bool running;
        struct sockaddr_in destination;
        std::thread thread_receive;
    };
}
}



#endif // BROADCAST_H

{'fraction_non_alphanumeric': 0.0916030534351145, 'fraction_numerical': 0.010743567995476393, 'mean_word_length': 2.340887629839471, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7650086', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1078, 'n_words': 286}