<commit_before>// Copyright (c) 2014, <NAME>
// Use of this source code (and the Dart VM) is governed by a
// BSD-style license that can be found in the LICENSE.txt file.

#pragma once

#include "cinder/DataSource.h"

#include "include/dart_api.h"

#include <map>

namespace cidart {

typedef std::shared_ptr<class Script>		ScriptRef;

typedef std::function<void( Dart_NativeArguments )>		NativeCallback;
typedef std::map<std::string, NativeCallback>			NativeCallbackMap;

typedef std::map<std::string, Dart_Handle>	DataMap;
typedef std::function<void( const DataMap& )>			ReceiveMapCallback;

// TODO: consider whether to name this Isolate or Script
// - is it at all useful to create an Isolate that doesn't spawn a new script?
// - need to read up more on how Isolates are created in plain dart, and their uses
class Script {
  public:
	struct Options {
		Options& native( const std::string &dartFuncName, const NativeCallback &nativeFunc )	{ mNativeCallbackMap[dartFuncName] = nativeFunc; return *this; }
		Options& mapReceiver( const ReceiveMapCallback &callback )	{ mReceiveMapCallback = callback; return *this; }

		const NativeCallbackMap&	getNativeCallbackMap() const	{ return mNativeCallbackMap; }
		NativeCallbackMap&			getNativeCallbackMap()			{ return mNativeCallbackMap; }
		const ReceiveMapCallback&	getReceiveMapCallback() const	{ return mReceiveMapCallback; }

	  private:
		NativeCallbackMap			mNativeCallbackMap;<commit_msg>remove todo (current name is fine), add doc<commit_after>// Copyright (c) 2014, <NAME>
// Use of this source code (and the Dart VM) is governed by a
// BSD-style license that can be found in the LICENSE.txt file.

#pragma once

#include "cinder/DataSource.h"

#include "include/dart_api.h"

#include <map>

namespace cidart {

typedef std::shared_ptr<class Script>		ScriptRef;

typedef std::function<void( Dart_NativeArguments )>		NativeCallback;
typedef std::map<std::string, NativeCallback>			NativeCallbackMap;

typedef std::map<std::string, Dart_Handle>	DataMap;
typedef std::function<void( const DataMap& )>			ReceiveMapCallback;

//! Class representing a dart script.
class Script {
  public:
	struct Options {
		Options& native( const std::string &dartFuncName, const NativeCallback &nativeFunc )	{ mNativeCallbackMap[dartFuncName] = nativeFunc; return *this; }
		Options& mapReceiver( const ReceiveMapCallback &callback )	{ mReceiveMapCallback = callback; return *this; }

		const NativeCallbackMap&	getNativeCallbackMap() const	{ return mNativeCallbackMap; }
		NativeCallbackMap&			getNativeCallbackMap()			{ return mNativeCallbackMap; }
		const ReceiveMapCallback&	getReceiveMapCallback() const	{ return mReceiveMapCallback; }

	  private:
		NativeCallbackMap			mNativeCallbackMap;
{'fraction_non_alphanumeric': 0.09400146305779078, 'fraction_numerical': 0.002926115581565472, 'mean_word_length': 5.42018779342723, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '191587', 'n_tokens_mistral': 878, 'n_tokens_neox': 802, 'n_words': 259}