<commit_before>/**
 * @file ZooKeeperEevent.hpp
 * @author <NAME>
 * @date Sep 7, 2011
 * @brief 
 */
#ifndef ZOO_KEEPER_EVENT_HPP_
#define ZOO_KEEPER_EVENT_HPP_

#include <3rdparty/zookeeper/zookeeper.h>
#include <sstream>

namespace zookeeper{

class ZooKeeperEvent
{
public:
    int type_;
    int state_;
    std::string path_;

public:
    ZooKeeperEvent()
    : type_(0), state_(0), path_()
    {
    }

    ZooKeeperEvent(int type, int state, const std::string path)
    : type_(type), state_(state), path_(path)
    {
    }

    std::string toString()
    {
        std::stringstream ss;
        ss << "[ZooKeeperEvent] "<<path_<<" - "<<watcherEvent2String(type_)<<" - "<<state2String(state_)<<std::endl;
        return ss.str();
    }

    static std::string state2String(int state)
    {
        if (state == 0) {
            return "ZOO_CLOSED_STATE";
        }
        else if (state == ZOO_CONNECTING_STATE) {
            return "ZOO_CONNECTING_STATE";
        }<commit_msg>little for format<commit_after>/**
 * @file ZooKeeperEevent.hpp
 * @author <NAME>
 * @date Sep 7, 2011
 * @brief 
 */
#ifndef ZOO_KEEPER_EVENT_HPP_
#define ZOO_KEEPER_EVENT_HPP_

#include <3rdparty/zookeeper/zookeeper.h>
#include <sstream>

namespace zookeeper{

class ZooKeeperEvent
{
public:
    int type_;
    int state_;
    std::string path_;

public:
    ZooKeeperEvent()
    : type_(0), state_(0), path_()
    {
    }

    ZooKeeperEvent(int type, int state, const std::string path)
    : type_(type), state_(state), path_(path)
    {
    }

    std::string toString()
    {
        std::stringstream ss;
        ss<<watcherEvent2String(type_)<<" - "<<state2String(state_)<<" - "<<path_<<std::endl;
        return ss.str();
    }

    static std::string state2String(int state)
    {
        if (state == 0) {
            return "ZOO_CLOSED_STATE";
        }
        else if (state == ZOO_CONNECTING_STATE) {
            return "ZOO_CONNECTING_STATE";
        }
{'fraction_non_alphanumeric': 0.1370843989769821, 'fraction_numerical': 0.012276214833759591, 'mean_word_length': 2.776061776061776, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 9, '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': '1206253', 'n_tokens_mistral': 726, 'n_tokens_neox': 694, 'n_words': 140}