CEBL
2.1
Main Page
Namespaces
Data Structures
Files
File List
Globals
model
RController.hpp
Go to the documentation of this file.
1
/*
2
* CEBL : CSU EEG Brain-Computer Interface Lab
3
*
4
* Author: Jeshua Bratman - jeshuabratman@gmail.com
5
*
6
* This file is part of CEBL.
7
*
8
* CEBL is free software; you can redistribute it and/or modify it.
9
* We only ask that if you use our code that you cite the source in
10
* your project or publication.
11
*
12
* EEG Group (www.cs.colostate.edu/eeg)
13
* Department of Computer Science
14
* Colorado State University
15
*
16
*/
17
18
#ifndef RCONTROLLER_H
19
#define RCONTROLLER_H
20
#include <
cppR/cppR.hpp
>
21
#include <string>
22
using
std::string;
23
30
namespace
CEBL
31
{
32
class
RController
33
{
34
private
:
35
int
read_pipe;
36
int
write_pipe;
37
int
child_pid;
38
bool
connected;
39
bool
cleared;
40
string
temp_filename;
41
string
temp_dir;
42
43
bool
rProcessStart();
44
void
rProcessKill();
45
string
pipeReadAll();
46
void
pipeWriteCommand(
string
command);
47
string
trimResponse(
string
response);
48
void
createTempFilename();
49
50
public
:
51
RController
();
52
~RController
();
53
59
bool
start
();
60
63
void
stop
();
64
65
70
bool
isConnected
()
71
{
72
return
connected;
73
}
74
86
void
sendCommand
(
string
command,
bool
clear =
true
);
87
93
string
getResponse
();
94
95
101
ublas::matrix<double>
readMatrixFromTempFile
();
102
107
void
writeMatrixToTempFile
(ublas::matrix<double> mat);
108
109
110
111
};
112
}
113
114
115
#endif
Generated by
1.8.1.1