-
Notifications
You must be signed in to change notification settings - Fork 293
/
execution.hpp
53 lines (42 loc) · 1.72 KB
/
execution.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/***********************************************************************************
* Copyright (c) 2016, Johan Mabille, Loic Gouarin, Sylvain Corlay, Wolf Vollprecht *
* Copyright (c) 2016, QuantStack *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
************************************************************************************/
#ifndef XMAGICS_EXECUTION_HPP
#define XMAGICS_EXECUTION_HPP
#include <cstddef>
#include <string>
#include "cling/MetaProcessor/MetaProcessor.h"
#include "xeus-cling/xmagics.hpp"
#include "xeus-cling/xoptions.hpp"
namespace xcpp
{
class timeit : public xmagic_line_cell
{
public:
timeit(cling::MetaProcessor* p);
virtual void operator()(const std::string& line) override
{
std::string cline = line;
std::string cell = "";
execute(cline, cell);
}
virtual void operator()(const std::string& line, const std::string& cell) override
{
std::string cline = line;
std::string ccell = cell;
execute(cline, ccell);
}
private:
cling::MetaProcessor* m_processor;
xoptions get_options();
std::string inner(std::size_t number, const std::string& code) const;
std::string _format_time(double timespan, std::size_t precision) const;
void execute(std::string& line, std::string& cell);
};
}
#endif