<commit_before>/**
 ** \file object/lobby-class.cc
 ** \brief Creation of the URBI object lobby.
 */

#include <kernel/uconnection.hh>
#include <kernel/userver.hh>

#include <object/lobby.hh>
#include <object/object.hh>
#include <object/string.hh>

#include <runner/raise.hh>
#include <runner/runner.hh>

namespace object
{
  Lobby::Lobby(value_type value)
    : state_(value)
  {
    proto_add(proto ? proto : object_class);
  }

  static UConnection* dummy = 0;

  Lobby::Lobby(rLobby)
    : state_(*dummy)
  {
    runner::raise_primitive_error("`Lobby' objects cannot be cloned");
  }

  Lobby::value_type&
  Lobby::value_get()
  {
    return state_;
  }

  const Lobby::value_type&
  Lobby::value_get() const
  {
    return state_;
  }

  void
  Lobby::send(objects_type& args)
  {
    check_arg_count(args.size(), 1, 2);
    // Second argument is the tag name.
    std::string tag;
    if (args.size() == 2)
    {
      const rString& name = args[1].unsafe_cast<String>();
      if (!name)
	runner::raise_argument_type_error(1, args[1], String::proto);
      tag = name->value_get();
    }
    const rString& rdata = args[0].unsafe_cast<String>();
    if (!rdata)
      runner::raise_argument_type_error(0, args[0], String::proto);
    const std::string data = rdata->value_get() + "\n";
    state_.connection.send (data.c_str(), data.length(), tag.c_str());
  }

  void
  Lobby::write(const std::string& data)
  {
    state_.connection.send_queue(data.c_str(),
				 data.size());
    state_.connection.flush();
  }<commit_msg>Prevent "send" and "write" to be called against "Lobby".<commit_after>/**
 ** \file object/lobby-class.cc
 ** \brief Creation of the URBI object lobby.
 */

#include <kernel/uconnection.hh>
#include <kernel/userver.hh>

#include <object/lobby.hh>
#include <object/object.hh>
#include <object/string.hh>

#include <runner/raise.hh>
#include <runner/runner.hh>

namespace object
{
  Lobby::Lobby(value_type value)
    : state_(value)
  {
    proto_add(proto ? proto : object_class);
  }

  static UConnection* dummy = 0;

  Lobby::Lobby(rLobby)
    : state_(*dummy)
  {
    runner::raise_primitive_error("`Lobby' objects cannot be cloned");
  }

  Lobby::value_type&
  Lobby::value_get()
  {
    return state_;
  }

  const Lobby::value_type&
  Lobby::value_get() const
  {
    return state_;
  }

  void
  Lobby::send(objects_type& args)
  {
    if (proto == this)
      runner::raise_primitive_error("must be called on Lobby derivative");

    check_arg_count(args.size(), 1, 2);
    // Second argument is the tag name.
    std::string tag;
    if (args.size() == 2)
    {
      const rString& name = args[1].unsafe_cast<String>();
      if (!name)
	runner::raise_argument_type_error(1, args[1], String::proto);
      tag = name->value_get();
    }
    const rString& rdata = args[0].unsafe_cast<String>();
    if (!rdata)
      runner::raise_argument_type_error(0, args[0], String::proto);
    const std::string data = rdata->value_get() + "\n";
    state_.connection.send (data.c_str(), data.length(), tag.c_str());
  }

  void
  Lobby::write(const std::string& data)
  {
    if (proto == this)
      runner::raise_primitive_error("must be called on Lobby derivative");

    state_.connection.send_queue(data.c_str(),
				 data.size());
    state_.connection.flush();
  }
{'fraction_non_alphanumeric': 0.1588502269288956, 'fraction_numerical': 0.006051437216338881, 'mean_word_length': 3.5287671232876714, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 25, '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': '2087756', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1157, 'n_words': 240}