diff options
author | Csaba Hruska <csaba.hruska@gmail.com> | 2015-12-21 13:48:22 +0100 |
---|---|---|
committer | Csaba Hruska <csaba.hruska@gmail.com> | 2015-12-21 13:48:22 +0100 |
commit | befc5afb22b36d744c403d103d591c5d190d394f (patch) | |
tree | 05e390bef55b0662a9a919b886322b66b113ff21 /ddl/test/idCpp.cpp | |
parent | dc8e31235fccbe5ea54d94b0ca69e005ca88c7ea (diff) |
add lambdacube-ir haskell lib
Diffstat (limited to 'ddl/test/idCpp.cpp')
-rw-r--r-- | ddl/test/idCpp.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/ddl/test/idCpp.cpp b/ddl/test/idCpp.cpp new file mode 100644 index 0000000..24894f4 --- /dev/null +++ b/ddl/test/idCpp.cpp | |||
@@ -0,0 +1,31 @@ | |||
1 | #include <string> | ||
2 | #include <iostream> | ||
3 | #include <istream> | ||
4 | #include <ostream> | ||
5 | #include <iterator> | ||
6 | |||
7 | #include "Mesh.hpp" | ||
8 | #include "IR.hpp" | ||
9 | #include "TypeInfo.hpp" | ||
10 | |||
11 | int main() { | ||
12 | // don't skip the whitespace while reading | ||
13 | std::cin >> std::noskipws; | ||
14 | |||
15 | // use stream iterators to copy the stream to a string | ||
16 | std::istream_iterator<char> it(std::cin); | ||
17 | std::istream_iterator<char> end; | ||
18 | std::string results(it, end); | ||
19 | |||
20 | try { | ||
21 | json jobjIn = json::parse(results); | ||
22 | std::shared_ptr<Pipeline> b = fromJSON(W<std::shared_ptr<Pipeline>>(),jobjIn); | ||
23 | std::shared_ptr<data::Pipeline> tv = std::static_pointer_cast<data::Pipeline>(b); | ||
24 | json jobjOut = toJSON(b); | ||
25 | std::cout << jobjOut; | ||
26 | } catch (std::string e) { | ||
27 | std::cout << "exception: " << e << "\n"; | ||
28 | } catch (...) { std::cout << "default exception\n"; } | ||
29 | |||
30 | return 0; | ||
31 | } | ||