<commit_before><commit_msg>Object: a new class to represent objects that are owned by an actor<commit_after>/*
 * Stateplex - A server-side actor model library.
 *
 * core/object.h
 *
 * (c) 2013 <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1 as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * Authors: <NAME>
 */

#ifndef INCLUDED_STATEPLEX_OBJECT_H
#define INCLUDED_STATEPLEX_OBJECT_H

#include <new>
#include <stdlib.h>

namespace Stateplex {

class Actor;
class Allocator;

class Object {
	Actor *mActor;

public:
	Object(Actor *actor);
	virtual ~Object();

	Actor *actor() const;
	Allocator *allocator() const;

	static void *operator new(size_t size);
	static void operator delete(void *memory, size_t size);
};

}

/*** Inline implementations ***/

#include "actor.h"
#include "dispatcher.h"
#include "allocator.h"

namespace Stateplex {

inline Object::Object(Actor *actor)
	: mActor(actor)
{ }

inline Object::~Object()
{ }

inline Actor *Object::actor() const
{
	return mActor;
}

inline Allocator *Object::allocator() const
{
	return Dispatcher::current()->allocator();
}


inline void *Object::operator new(size_t size)
{
	return Dispatcher::current()->allocator()->allocate(size);
}

inline void Object::operator delete(void *memory, size_t size)
{
	Dispatcher::current()->allocator()->deallocate(memory, size);
}

}

#endif
{'fraction_non_alphanumeric': 0.11713286713286714, 'fraction_numerical': 0.0034965034965034965, 'mean_word_length': 4.840136054421769, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 14, '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': '6577637', 'n_tokens_mistral': 539, 'n_tokens_neox': 520, 'n_words': 182}