<commit_before>/*
**  Copyright (C) 2012 <NAME>
**  See COPYING for the license
*/

#ifndef _QIMESSAGING_OBJECTHOST_HPP_
#define _QIMESSAGING_OBJECTHOST_HPP_

#include <map>

#include <boost/thread/mutex.hpp>

#include <qi/atomic.hpp>

#include <qitype/fwd.hpp>

#include <qimessaging/transportsocket.hpp>


namespace qi
{
  class Message;
  class BoundObject;
  typedef boost::shared_ptr<BoundObject> BoundObjectPtr;

  class ObjectHost
  {
  public:
    ObjectHost(unsigned int service);
    ~ObjectHost();
    void onMessage(const qi::Message &msg, TransportSocketPtr socket);
    unsigned int addObject(BoundObjectPtr obj, unsigned int objId = 0);
    void removeObject(unsigned int);
    unsigned int service() { return _service;}
    unsigned int nextId() { return ++_nextId;}
    qi::Signal<void()> onDestroy;
  private:
    typedef std::map<unsigned int, BoundObjectPtr > ObjectMap;
    boost::mutex  _mutex;
    unsigned int _service;
    ObjectMap _objectMap;
    qi::Atomic<long> _nextId;
  };
}

#endif
<commit_msg>objecthost: use atomic<int> instead of atomic<long><commit_after>/*
**  Copyright (C) 2012 <NAME>
**  See COPYING for the license
*/

#ifndef _QIMESSAGING_OBJECTHOST_HPP_
#define _QIMESSAGING_OBJECTHOST_HPP_

#include <map>

#include <boost/thread/mutex.hpp>

#include <qi/atomic.hpp>

#include <qitype/fwd.hpp>

#include <qimessaging/transportsocket.hpp>


namespace qi
{
  class Message;
  class BoundObject;
  typedef boost::shared_ptr<BoundObject> BoundObjectPtr;

  class ObjectHost
  {
  public:
    ObjectHost(unsigned int service);
    ~ObjectHost();
    void onMessage(const qi::Message &msg, TransportSocketPtr socket);
    unsigned int addObject(BoundObjectPtr obj, unsigned int objId = 0);
    void removeObject(unsigned int);
    unsigned int service() { return _service;}
    unsigned int nextId() { return ++_nextId;}
    qi::Signal<void()> onDestroy;
  private:
    typedef std::map<unsigned int, BoundObjectPtr > ObjectMap;
    boost::mutex    _mutex;
    unsigned int    _service;
    ObjectMap       _objectMap;
    qi::Atomic<int> _nextId;
  };
}

#endif

{'fraction_non_alphanumeric': 0.109895337773549, 'fraction_numerical': 0.004757373929590866, 'mean_word_length': 4.351145038167939, 'pattern_counts': {'":': 0, '<': 25, '<?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': '3173796', 'n_tokens_mistral': 717, 'n_tokens_neox': 686, 'n_words': 175}