10#include <boost/python/class.hpp>
11#include <boost/python/enum.hpp>
12#include <boost/python/reference_existing_object.hpp>
26std::once_flag INIT_FLAG;
36 auto &svc = UsageService::Instance();
37 std::call_once(INIT_FLAG, []() {
38 PyRun_SimpleString(
"import atexit\n"
39 "from mantid.kernel import UsageService\n"
40 "atexit.register(lambda: UsageService.shutdown())");
47 const bool internal) {
49 if (singleString.check()) {
59 enum_<Mantid::Kernel::FeatureType>(
"FeatureType")
64 class_<UsageServiceImpl, boost::noncopyable>(
"UsageServiceImpl", no_init)
67 "Sends any pending usage information, and disables the usage "
70 "Returns the time that the instance of mantid has been running")
73 "Enables or disables the usage service.")
75 "Sets the interval that the timer checks for tasks.")
77 "Sets the application name that has invoked Mantid.")
79 "Gets the application name that has invoked Mantid.")
81 .def(
"registerFeatureUsage", ®isterFeatureUsage, (arg(
"self"), arg(
"type"), arg(
"name"), arg(
"internal")),
82 "Registers the use of a feature in Mantid.")
84 "Returns the time at which Mantid was started")
85 .def(
"Instance", instance, return_value_policy<reference_existing_object>(),
86 "Returns a reference to the UsageService")
87 .staticmethod(
"Instance");
#define GET_POINTER_SPECIALIZATION(TYPE)
boost::python::extract< std::string > ExtractStdString
void export_UsageService()
Manage the lifetime of a class intended to be a singleton.
void registerFeatureUsage(const FeatureType &type, const std::vector< std::string > &name, const bool internal)
registerFeatureUsage registers the use of a feature in mantid.
void setApplicationName(const std::string &name)
Sets the application name that has invoked Mantid.
void setEnabled(const bool enabled)
Sets whether the UsageReporter is enabled.
void registerStartup()
Registers the Startup of Mantid.
std::string getApplicationName() const
Returns the application name that has invoked Mantid.
void flush()
flushes any buffers and sends any outstanding usage reports
Types::Core::DateAndTime getStartTime()
Gets the start time of this mantid instance.
bool isEnabled() const
Returns true if usage reporting is enabled.
Types::Core::time_duration getUpTime()
gets the uptime of this mantid instance
FeatureType
An enum specifying the 4 possible features types that can be logged in the usage service.
Converts a Python sequence type to a C++ std::vector, where the element type is defined by the templa...