<commit_before>// ======================================================================== //
// Copyright 2009-2015 Intel Corporation                                    //
//                                                                          //
// Licensed under the Apache License, Version 2.0 (the "License");          //
// you may not use this file except in compliance with the License.         //
// You may obtain a copy of the License at                                  //
//                                                                          //
//     http://www.apache.org/licenses/LICENSE-2.0                           //
//                                                                          //
// Unless required by applicable law or agreed to in writing, software      //
// distributed under the License is distributed on an "AS IS" BASIS,        //
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
// See the License for the specific language governing permissions and      //
// limitations under the License.                                           //
// ======================================================================== //

#pragma once

#include <thread>

#include <ospray_cpp/Camera.h>
#include <ospray_cpp/Data.h>
#include <ospray_cpp/FrameBuffer.h>
#include <ospray_cpp/Geometry.h>
#include <ospray_cpp/Light.h>
#include <ospray_cpp/Material.h>
#include <ospray_cpp/Model.h>
#include <ospray_cpp/PixelOp.h>
#include <ospray_cpp/Renderer.h>
#include <ospray_cpp/Texture2D.h>
#include <ospray_cpp/TransferFunction.h>
#include <ospray_cpp/Volume.h>

// ChaiScript
#include "chaiscript/chaiscript.hpp"

namespace ospray {

class OSPRayScriptHandler
{
public:

  OSPRayScriptHandler(OSPModel model, OSPRenderer renderer, OSPCamera camera);
  ~OSPRayScriptHandler();

  void runScriptFromFile(const std::string &file);

  void start();
  void stop();

  bool running();

protected:

  //! \brief ChaiScript engine, only accessable if the interactive thread isn't
  //!        running.
  //!
  //! \note Allow anyone who extends (inherits from) OSPRayScriptHandler to
  //!       have access to the engine to let them add custom functions or types.
  chaiscript::ChaiScript &scriptEngine();

  //! \note Child classes should append this string with any additional help
  //!       text that is desired when 'help' is invoked in the script engine.
  std::string m_helpText;

private:

  void consoleLoop();

  void runChaiLine(const std::string &line);
  void runChaiFile(const std::string &file);

  void registerScriptObjects();
  void registerScriptTypes();
  void registerScriptFunctions();

  // Data //

  cpp::Model    m_model;
  cpp::Renderer m_renderer;
  cpp::Camera   m_camera;<commit_msg>Made ospray_script shared lib -> need export interface for Windows<commit_after>// ======================================================================== //
// Copyright 2009-2015 Intel Corporation                                    //
//                                                                          //
// Licensed under the Apache License, Version 2.0 (the "License");          //
// you may not use this file except in compliance with the License.         //
// You may obtain a copy of the License at                                  //
//                                                                          //
//     http://www.apache.org/licenses/LICENSE-2.0                           //
//                                                                          //
// Unless required by applicable law or agreed to in writing, software      //
// distributed under the License is distributed on an "AS IS" BASIS,        //
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
// See the License for the specific language governing permissions and      //
// limitations under the License.                                           //
// ======================================================================== //

#pragma once

#include <thread>

#include <ospray_cpp/Camera.h>
#include <ospray_cpp/Data.h>
#include <ospray_cpp/FrameBuffer.h>
#include <ospray_cpp/Geometry.h>
#include <ospray_cpp/Light.h>
#include <ospray_cpp/Material.h>
#include <ospray_cpp/Model.h>
#include <ospray_cpp/PixelOp.h>
#include <ospray_cpp/Renderer.h>
#include <ospray_cpp/Texture2D.h>
#include <ospray_cpp/TransferFunction.h>
#include <ospray_cpp/Volume.h>

// ChaiScript
#include "chaiscript/chaiscript.hpp"

#ifdef _WIN32
#  ifdef ospray_script_EXPORTS
#    define OSPSCRIPT_INTERFACE __declspec(dllexport)
#  else
#    define OSPSCRIPT_INTERFACE __declspec(dllimport)
#  endif
#else
#  define OSPSCRIPT_INTERFACE
#endif

namespace ospray {

class OSPRayScriptHandler
{
public:

  OSPSCRIPT_INTERFACE OSPRayScriptHandler(OSPModel model, OSPRenderer renderer, OSPCamera camera);
  OSPSCRIPT_INTERFACE ~OSPRayScriptHandler();

  OSPSCRIPT_INTERFACE void runScriptFromFile(const std::string &file);

  OSPSCRIPT_INTERFACE void start();
  OSPSCRIPT_INTERFACE void stop();

  OSPSCRIPT_INTERFACE bool running();

protected:

  //! \brief ChaiScript engine, only accessable if the interactive thread isn't
  //!        running.
  //!
  //! \note Allow anyone who extends (inherits from) OSPRayScriptHandler to
  //!       have access to the engine to let them add custom functions or types.
  chaiscript::ChaiScript &scriptEngine();

  //! \note Child classes should append this string with any additional help
  //!       text that is desired when 'help' is invoked in the script engine.
  std::string m_helpText;

private:

  void consoleLoop();

  void runChaiLine(const std::string &line);
  void runChaiFile(const std::string &file);

  void registerScriptObjects();
  void registerScriptTypes();
  void registerScriptFunctions();

  // Data //

  cpp::Model    m_model;
  cpp::Renderer m_renderer;
  cpp::Camera   m_camera;
{'fraction_non_alphanumeric': 0.14107534131130964, 'fraction_numerical': 0.004719366256531266, 'mean_word_length': 2.300333704115684, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7378148', 'n_tokens_mistral': 1604, 'n_tokens_neox': 1507, 'n_words': 471}