-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
49 lines (46 loc) · 1.15 KB
/
Copy pathmain.cpp
File metadata and controls
49 lines (46 loc) · 1.15 KB
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
#include <iostream>
#include <fcntl.h>
#include <PatternComparator.h>
#include "ProcessFileUtils.h"
#include <TupleFileUtils.h>
#include <MatchesFinder.h>
#include <LindaCommunicator.h>
#include <linda_exception.h>
using namespace linda;
int main(int argc, char** argv)
{
if(argc > 1)
{
linda::LindaCommunicator com("tuple_test", "proc_test");
linda::TupleFileUtils::tuple t;
std::string first(argv[1]);
try
{
if(first == "input")
{
t = com.input(std::string(argv[2]));
std::cout << t.pattern << std::endl;
}
else if(first == "output")
{
com.output(std::string(argv[2]));
}
else if(first == "read")
{
t = com.read(std::string(argv[2]));
std::cout << t.pattern << std::endl;
}
}
catch (LindaException& l)
{
std::cerr << l.what();
return -1;
}
catch (...)
{
std::cerr << "Other exception" << std::endl;
return -1;
}
}
return 0;
}