Skip to content

Commit

Permalink
Merge pull request #12 from martinRenou/rename_files
Browse files Browse the repository at this point in the history
Rename classes and files
  • Loading branch information
martinRenou committed Nov 7, 2018
2 parents 7f23a27 + 92e6843 commit 07af12f
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 42 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib; ${CMAKE_INSTALL_PREFIX}/${

set(XEUSCLING_SRC
src/main.cpp
src/xpython_interpreter.cpp
src/xpython_logger.cpp
src/xpython_display.cpp
src/xinterpreter.cpp
src/xlogger.cpp
src/xdisplay.cpp
src/xpyt_config.hpp
)

Expand Down
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "xeus/xkernel.hpp"
#include "xeus/xkernel_configuration.hpp"

#include "xpython_interpreter.hpp"
#include "xinterpreter.hpp"

#include "Python.h"

Expand All @@ -40,12 +40,12 @@ std::string extract_filename(int& argc, char* argv[])

int main(int argc, char* argv[])
{
using interpreter_ptr = std::unique_ptr<xpyt::xpython_interpreter>;
using interpreter_ptr = std::unique_ptr<xpyt::interpreter>;

std::string file_name = (argc == 1) ? "connection.json" : extract_filename(argc, argv);
xeus::xconfiguration config = xeus::load_configuration(file_name);

interpreter_ptr interpreter = interpreter_ptr(new xpyt::xpython_interpreter(argc, argv));
interpreter_ptr interpreter = interpreter_ptr(new xpyt::interpreter(argc, argv));
xeus::xkernel kernel(config, xeus::get_user_name(), std::move(interpreter));
std::cout << "starting xeus-python kernel" << std::endl;
kernel.start();
Expand Down
2 changes: 1 addition & 1 deletion src/xpython_display.cpp → src/xdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "pybind11/pybind11.h"
#include "pybind11/embed.h"

#include "xpython_display.hpp"
#include "xdisplay.hpp"

namespace py = pybind11;

Expand Down
4 changes: 2 additions & 2 deletions src/xpython_display.hpp → src/xdisplay.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#ifndef XPYT_PYTHON_DISPLAY_HPP
#define XPYT_PYTHON_DISPLAY_HPP
#ifndef XPYT_DISPLAY_HPP
#define XPYT_DISPLAY_HPP

#include <functional>

Expand Down
30 changes: 15 additions & 15 deletions src/xpython_interpreter.cpp → src/xinterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@
#include "pybind11/functional.h"

#include "xpyt_config.hpp"
#include "xpython_interpreter.hpp"
#include "xpython_logger.hpp"
#include "xinterpreter.hpp"
#include "xlogger.hpp"

namespace py = pybind11;

namespace xpyt
{
void xpython_interpreter::configure_impl()
void interpreter::configure_impl()
{
}

xpython_interpreter::xpython_interpreter(int /*argc*/, const char* const* /*argv*/)
interpreter::interpreter(int /*argc*/, const char* const* /*argv*/)
{
py::initialize_interpreter();

redirect_output();
redirect_display();
}

xpython_interpreter::~xpython_interpreter() {}
interpreter::~interpreter() {}

xeus::xjson xpython_interpreter::execute_request_impl(
xeus::xjson interpreter::execute_request_impl(
int execution_counter,
const std::string& code,
bool silent,
Expand Down Expand Up @@ -108,31 +108,31 @@ namespace xpyt
return kernel_res;
}

xeus::xjson xpython_interpreter::complete_request_impl(
xeus::xjson interpreter::complete_request_impl(
const std::string& code,
int cursor_pos)
{
return xeus::xjson::object();
}

xeus::xjson xpython_interpreter::inspect_request_impl(const std::string& /*code*/,
xeus::xjson interpreter::inspect_request_impl(const std::string& /*code*/,
int /*cursor_pos*/,
int /*detail_level*/)
{
return xeus::xjson::object();
}

xeus::xjson xpython_interpreter::history_request_impl(const xeus::xhistory_arguments& /*args*/)
xeus::xjson interpreter::history_request_impl(const xeus::xhistory_arguments& /*args*/)
{
return xeus::xjson::object();
}

xeus::xjson xpython_interpreter::is_complete_request_impl(const std::string& /*code*/)
xeus::xjson interpreter::is_complete_request_impl(const std::string& /*code*/)
{
return xeus::xjson::object();
}

xeus::xjson xpython_interpreter::kernel_info_request_impl()
xeus::xjson interpreter::kernel_info_request_impl()
{
xeus::xjson result;
result["implementation"] = "xeus-python";
Expand Down Expand Up @@ -165,16 +165,16 @@ namespace xpyt
return result;
}

void xpython_interpreter::shutdown_request_impl()
void interpreter::shutdown_request_impl()
{
py::finalize_interpreter();
}

void xpython_interpreter::input_reply_impl(const std::string& /*value*/)
void interpreter::input_reply_impl(const std::string& /*value*/)
{
}

void xpython_interpreter::redirect_output()
void interpreter::redirect_output()
{
// In Python:
// import sys and import xeus_python_logger
Expand Down Expand Up @@ -202,7 +202,7 @@ namespace xpyt
sys.attr("stderr") = err_logger;
}

void xpython_interpreter::redirect_display()
void interpreter::redirect_display()
{
py::module sys = py::module::import("sys");

Expand Down
10 changes: 5 additions & 5 deletions src/xpython_interpreter.hpp → src/xinterpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#ifndef XPYT_PYTHON_INTERPRETER_HPP
#define XPYT_PYTHON_INTERPRETER_HPP
#ifndef XPYT_INTERPRETER_HPP
#define XPYT_INTERPRETER_HPP

#include <string>

Expand All @@ -21,12 +21,12 @@ namespace py = pybind11;

namespace xpyt
{
class xpython_interpreter : public xeus::xinterpreter
class interpreter : public xeus::xinterpreter
{
public:

xpython_interpreter(int argc, const char* const* argv);
virtual ~xpython_interpreter();
interpreter(int argc, const char* const* argv);
virtual ~interpreter();

private:

Expand Down
16 changes: 8 additions & 8 deletions src/xpython_logger.cpp → src/xlogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@
#include "pybind11/embed.h"
#include "pybind11/functional.h"

#include "xpython_logger.hpp"
#include "xlogger.hpp"

namespace py = pybind11;

namespace xpyt
{
xpython_logger::xpython_logger()
xlogger::xlogger()
{
}

xpython_logger::~xpython_logger()
xlogger::~xlogger()
{
}

void xpython_logger::add_logger(logger_function_type logger)
void xlogger::add_logger(logger_function_type logger)
{
m_loggers.push_back(logger);
}

void xpython_logger::write(const std::string& message)
void xlogger::write(const std::string& message)
{
for (auto it = m_loggers.begin(); it != m_loggers.end(); ++it)
{
Expand All @@ -41,9 +41,9 @@ namespace xpyt
}

PYBIND11_EMBEDDED_MODULE(xeus_python_logger, m) {
py::class_<xpython_logger>(m, "XPythonLogger")
py::class_<xlogger>(m, "XPythonLogger")
.def(py::init<>())
.def("add_logger", &xpython_logger::add_logger)
.def("write", &xpython_logger::write);
.def("add_logger", &xlogger::add_logger)
.def("write", &xlogger::write);
}
}
10 changes: 5 additions & 5 deletions src/xpython_logger.hpp → src/xlogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#ifndef XPYT_PYTHON_LOGGER_HPP
#define XPYT_PYTHON_LOGGER_HPP
#ifndef XPYT_LOGGER_HPP
#define XPYT_LOGGER_HPP

#include <string>
#include <vector>
#include <functional>

namespace xpyt
{
class xpython_logger
class xlogger
{

public:

using logger_function_type = std::function<void(const std::string&)>;
using loggers_type = std::vector<logger_function_type>;

xpython_logger();
virtual ~xpython_logger();
xlogger();
virtual ~xlogger();

void add_logger(logger_function_type logger);
void write(const std::string& message);
Expand Down

0 comments on commit 07af12f

Please sign in to comment.