<commit_before>/*
 * Copyright (c) 2010, The Infrastructure Developers Group
 * All rights reserved.
 *
 * This file is subject to the New BSD License (see the LICENSE file).
 */

#ifndef _PROCESS_MANAGER_H_
#define _PROCESS_MANAGER_H_

#include <sys/select.h>
#include <list>

#include <txmpp/messagequeue.h>
#include <txmpp/taskrunner.h>
#include <txmpp/thread.h>
#include <txmpp/time.h>

#include "constants.h"
#include "loop.h"
#include "node_envelope.h"
#include "node_process.h"

namespace tyrion {

class NodeServiceHandlerData : public txmpp::MessageData {
 public:
  NodeServiceHandlerData(NodeEnvelope* envelope, NodeProcess* process = NULL)
      : envelope_(envelope), process_(process) {}
  NodeEnvelope* envelope() { return envelope_; }
  NodeProcess* process() { return process_; }
  void set_process(NodeProcess* process) { process_ = process; }
 private:
  NodeEnvelope* envelope_;
  NodeProcess* process_;
};

class NodeServiceHandler : public txmpp::MessageHandler,
                           public txmpp::TaskRunner,
                           public txmpp::Thread {
  public:
    enum Message {
      MSG_REQUEST = 1,
      MSG_POLL,
      MSG_RESPONSE
    };
    typedef NodeServiceHandlerData ServiceData;
    typedef std::list<NodeServiceHandlerData*> ServiceList;

    NodeServiceHandler();

    void Request(NodeEnvelope* envelope);

    void WakeTasks();
    void OnMessage(txmpp::Message *pmsg);
    int64 CurrentTime();

  private:
    void DoRequest(ServiceData* data);<commit_msg>Tweak typedef<commit_after>/*
 * Copyright (c) 2010, The Infrastructure Developers Group
 * All rights reserved.
 *
 * This file is subject to the New BSD License (see the LICENSE file).
 */

#ifndef _PROCESS_MANAGER_H_
#define _PROCESS_MANAGER_H_

#include <sys/select.h>
#include <list>

#include <txmpp/messagequeue.h>
#include <txmpp/taskrunner.h>
#include <txmpp/thread.h>
#include <txmpp/time.h>

#include "constants.h"
#include "loop.h"
#include "node_envelope.h"
#include "node_process.h"

namespace tyrion {

class NodeServiceHandlerData : public txmpp::MessageData {
 public:
  NodeServiceHandlerData(NodeEnvelope* envelope, NodeProcess* process = NULL)
      : envelope_(envelope), process_(process) {}
  NodeEnvelope* envelope() { return envelope_; }
  NodeProcess* process() { return process_; }
  void set_process(NodeProcess* process) { process_ = process; }
 private:
  NodeEnvelope* envelope_;
  NodeProcess* process_;
};

class NodeServiceHandler : public txmpp::MessageHandler,
                           public txmpp::TaskRunner,
                           public txmpp::Thread {
  public:
    enum Message {
      MSG_REQUEST = 1,
      MSG_POLL,
      MSG_RESPONSE
    };
    typedef NodeServiceHandlerData ServiceData;
    typedef std::list<ServiceData*> ServiceList;

    NodeServiceHandler();

    void Request(NodeEnvelope* envelope);

    void WakeTasks();
    void OnMessage(txmpp::Message *pmsg);
    int64 CurrentTime();

  private:
    void DoRequest(ServiceData* data);
{'fraction_non_alphanumeric': 0.10487885828078328, 'fraction_numerical': 0.004646531695984069, 'mean_word_length': 3.861290322580645, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '5419085', 'n_tokens_mistral': 953, 'n_tokens_neox': 922, 'n_words': 232}