<commit_before>/*
 * liblager_convert.h
 *
 *  Created on: Mar 2, 2015
 *      Author: andres
 */

#ifndef LIBLAGER_CONVERT_H_
#define LIBLAGER_CONVERT_H_

#include <string>
#include <mutex>
#include <condition_variable>
#include <chrono>
#include <boost/thread.hpp>

#include <vrpn_Button.h>                // for vrpn_BUTTONCB, etc
#include <vrpn_Tracker.h>               // for vrpn_TRACKERCB, etc

#include "vrpn_Configure.h"             // for VRPN_CALLBACK
#include "vrpn_Connection.h"            // for vrpn_Connection
#include "vrpn_ForceDevice.h"           // for vrpn_ForceDevice_Remote, etc
#include "vrpn_Types.h"                 // for vrpn_float64

using std::string;
using std::stringstream;
using std::chrono::system_clock;
using std::chrono::time_point;

#define DISTANCE_INTERVAL_SQUARED 0.0004f //0.4 * (1 cm)^2

class LagerConverter {
 public:
  static LagerConverter* Instance();

  ~LagerConverter() {
    tracker_->unregister_change_handler(NULL, HandleTrackerChange);

    if (use_buttons_) {
      button_->unregister_change_handler(NULL, HandleButtonChange);
    }
  }

  void Start() {
    InitializeTrackers();
    thread_ = boost::thread(&LagerConverter::ProcessSensorEvents, this);
  }

  string BlockingGetLagerString();

 private:
  LagerConverter() {
  }
  ;
  LagerConverter(LagerConverter const&) {
  }<commit_msg>liblager_convert: Add SetUseButtons method<commit_after>/*
 * liblager_convert.h
 *
 *  Created on: Mar 2, 2015
 *      Author: andres
 */

#ifndef LIBLAGER_CONVERT_H_
#define LIBLAGER_CONVERT_H_

#include <string>
#include <mutex>
#include <condition_variable>
#include <chrono>
#include <boost/thread.hpp>

#include <vrpn_Button.h>                // for vrpn_BUTTONCB, etc
#include <vrpn_Tracker.h>               // for vrpn_TRACKERCB, etc

#include "vrpn_Configure.h"             // for VRPN_CALLBACK
#include "vrpn_Connection.h"            // for vrpn_Connection
#include "vrpn_ForceDevice.h"           // for vrpn_ForceDevice_Remote, etc
#include "vrpn_Types.h"                 // for vrpn_float64

using std::string;
using std::stringstream;
using std::chrono::system_clock;
using std::chrono::time_point;

#define DISTANCE_INTERVAL_SQUARED 0.0004f //0.4 * (1 cm)^2

class LagerConverter {
 public:
  static LagerConverter* Instance();

  void SetUseButtons(bool use_buttons) {
    use_buttons_ = use_buttons;

    // If using buttons, will only draw when button is pressed
    draw_gestures_ = !use_buttons;
  }

  ~LagerConverter() {
    tracker_->unregister_change_handler(NULL, HandleTrackerChange);

    if (use_buttons_) {
      button_->unregister_change_handler(NULL, HandleButtonChange);
    }
  }

  void Start() {
    InitializeTrackers();
    thread_ = boost::thread(&LagerConverter::ProcessSensorEvents, this);
  }

  string BlockingGetLagerString();

 private:
  LagerConverter() {
  }
  ;
  LagerConverter(LagerConverter const&) {
  }
{'fraction_non_alphanumeric': 0.1119146005509642, 'fraction_numerical': 0.011019283746556474, 'mean_word_length': 3.596518987341772, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, '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': '2346297', 'n_tokens_mistral': 999, 'n_tokens_neox': 979, 'n_words': 198}