Skip to content

Commit

Permalink
Release 2.0.0 (#6)
Browse files Browse the repository at this point in the history
Merging v2.0.0. from dev.

* ready to make xenon namespace

* broken

* prog with new ns

* xenon converted to xenon namespace complete

* oops, not quite

* Continue port to xenon namespace

Renamed include/ict to include/xenon.
Copied a couple ict files over to ict repo.
Still have to purge ict files from xenon and their unit tests.

* prog

* prog with exceptions

* prog

* ict::exception removed

* prog with xml_error

* ready to add ict submodule

* added ict submodule

* prog

* minor

* updated copy
  • Loading branch information
intrig authored Jul 22, 2016
1 parent bea1e97 commit 0e3071f
Show file tree
Hide file tree
Showing 290 changed files with 1,190 additions and 6,480 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "include/ict"]
path = include/ict
url = https://github.com/intrig/ict
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ clean:
test -d build && make -C build clean
test -d build && rm -rf build

test:
test: all
make CTEST_OUTPUT_ON_FAILURE=1 -C build test

tags:
Expand Down
21 changes: 10 additions & 11 deletions examples/decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
//-- See https://github.com/intrig/xenon for license.
#include <iostream>
#include <vector>
#include <ict/xenon.h>
#include <xenon/xenon.h>

using std::cout;
using std::cerr;
using ict::message;

struct nv_pairs {
nv_pairs(const std::string & name, int64_t value) : name(name), value(value) {}
Expand All @@ -19,9 +18,9 @@ int main(int, char**) {
auto fields = std::vector<nv_pairs>();

cout << "loading\n";
ict::spec_server doc("icd.xddl");
xenon::spec_server doc("icd.xddl");
cout << "assigning\n";
auto msg = ict::parse(doc, "0101046B102C000114E03003603800203801C03801E03801F030037030002030"
auto msg = xenon::parse(doc, "0101046B102C000114E03003603800203801C03801E03801F030037030002030"
"00903000603000E0300120300130380000300110300030380080300200300210"
"3001903001603000F03000703000403000C03000503000D1A03C9E16C18070DE"
"2C7CFF3C7CC1001E00E01C000389");
Expand All @@ -33,7 +32,7 @@ int main(int, char**) {
}

// using a linear cursor, we can iterate through the entire message in a depth first way
cout << "putting fields and their values into a vector: " << ict::to_text(msg);
cout << "putting fields and their values into a vector: " << xenon::to_text(msg);
for (auto c = ict::to_linear(msg.root()); c != msg.end(); ++c) {
// consumes() means it consumes bits from the message, usually a field
if (c->consumes()) fields.emplace_back(c->name(), c->value());
Expand All @@ -47,25 +46,25 @@ int main(int, char**) {
cout << "again, using recurse algorithm\n";
// The first cursor parameter in the lambda expression is a cursor to the current node, the second
// cursor parameter is its parent, which is unused in this case.
ict::recurse(msg.root(), [&](message::cursor c, message::cursor) {
ict::recurse(msg.root(), [&](xenon::message::cursor c, xenon::message::cursor) {
if (c->consumes()) fields.emplace_back(c->name(), c->value());
});
cout << "done, processed " << fields.size() << " fields\n\n";

cout << "now find a field: DATA/MSG_TYPE\n";
auto c = ict::find(msg.root(), "DATA/MSG_TYPE");
auto c = xenon::find(msg.root(), "DATA/MSG_TYPE");

if (c != msg.end()) cout << "found it! " << ict::description(c) << "\n\n";
if (c != msg.end()) cout << "found it! " << xenon::description(c) << "\n\n";

cout << "now find using a non-anchored path: //RLP_CAP_INFO_BLOCK/MAX_MS_NAK_ROUNDS_FWD\n";
c = ict::find(msg.root(), "//RLP_CAP_INFO_BLOCK/MAX_MS_NAK_ROUNDS_FWD");
c = xenon::find(msg.root(), "//RLP_CAP_INFO_BLOCK/MAX_MS_NAK_ROUNDS_FWD");
if (c != msg.end()) {
cout << "found it! " << c->value() << "\n";
cout << "full path is: " << ict::path_string(c) << "\n\n";
cout << "full path is: " << xenon::path_string(c) << "\n\n";
}


} catch (ict::exception & e) { cerr << e.what() << '\n';
} catch (std::exception & e) { cerr << e.what() << '\n';
return 1;
}
}
94 changes: 48 additions & 46 deletions examples/sibs.cpp
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
#include <iostream>
#include <ict/xenon.h>
#include <ict/command.h>

using std::cout;
using std::cerr;

int main(int argc, char ** argv) {
try {
ict::spec_server ss;

ict::command line("sibs",
"Example to parse a sib message containing another.",
"sibs [options]");
line.add(ict::option("xddl_path", 'X', "XDDL path", "", [&](const std::string & v){
ss.xddl_path.push_back(v);
}));

line.parse(argc, argv);

auto start = ict::get_record(ss, "icd.xddl");
auto msg = ict::parse(start, "220008342E1F7F61BA04C697D176821A7A9F4EA20663F3");

// display sib message
cout << ict::to_text(msg) << '\n';

// grab the inner sib. The '//' means it doesn't have to be a direct child of msg.root()
auto c = ict::find(msg.root(), "//SIB-Data-variable");
if (c==msg.end()) IT_THROW("can't find SIB-Data-variable");

// display the bits of the inner sib
cout << c->name() << " " << c->bits << "\n";

// now parse the inner sib as a SysInfoType19
// We first get the record we are interested from the spec, and then use it to parse.
start = ict::get_record(ss, "3GPP/TS-25.331.xddl#SysInfoType19");
auto inner = ict::parse(start, c->bits);

// display inner sib
cout << ict::to_text(inner, "nlvsFL");
}

catch (std::exception & e) {
cerr << e.what() << "\n";
}
}
//-- Copyright 2016 Intrig
//-- See https://github.com/intrig/xenon for license.
#include <iostream>
#include <ict/command.h>
#include <xenon/xenon.h>

using std::cout;
using std::cerr;

int main(int argc, char ** argv) {
try {
xenon::spec_server ss;

ict::command line("sibs",
"Example to parse a sib message containing another.",
"sibs [options]");
line.add(ict::option("xddl_path", 'X', "XDDL path", "", [&](const std::string & v){
ss.xddl_path.push_back(v);
}));

line.parse(argc, argv);

auto start = xenon::get_record(ss, "icd.xddl");
auto msg = xenon::parse(start, "220008342E1F7F61BA04C697D176821A7A9F4EA20663F3");

// display sib message
cout << xenon::to_text(msg) << '\n';

// grab the inner sib. The '//' means it doesn't have to be a direct child of msg.root()
auto c = xenon::find(msg.root(), "//SIB-Data-variable");
if (c==msg.end()) IT_PANIC("can't find SIB-Data-variable");

// display the bits of the inner sib
cout << c->name() << " " << c->bits << "\n";

// now parse the inner sib as a SysInfoType19
// We first get the record we are interested from the spec, and then use it to parse.
start = xenon::get_record(ss, "3GPP/TS-25.331.xddl#SysInfoType19");
auto inner = xenon::parse(start, c->bits);

// display inner sib
cout << xenon::to_text(inner, "nlvsFL");
}

catch (std::exception & e) {
cerr << e.what() << "\n";
}
}
1 change: 1 addition & 0 deletions include/ict
Submodule ict added at 6fbe96
Loading

0 comments on commit 0e3071f

Please sign in to comment.