Skip to content
Snippets Groups Projects
Commit 4470995b authored by Paweł Kędzia's avatar Paweł Kędzia
Browse files

(swig) Catch exceptions raised by wcclfile

parent a0fef117
Branches
No related merge requests found
......@@ -88,6 +88,14 @@ namespace Wccl {
/* --------------------------------------------------------------------- */
// const UntypedOpSequence& get_untyped_section(const std::string& name) const;
%exception {
try {
$action
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
UntypedOpSequence& get_untyped_section(const std::string& name);
/* --------------------------------------------------------------------- */
......@@ -100,12 +108,38 @@ namespace Wccl {
%template(get_section_position) get_section<Position>;
%template(get_section_match) get_section<Match>;
%exception {
try {
$action
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
shared_ptr<UntypedOpSequence> get_untyped_section_ptr(const std::string& name);
%exception {
try {
$action
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
shared_ptr<const UntypedOpSequence> get_untyped_section_ptr(const std::string& name) const;
/* --------------------------------------------------------------------- */
// template<class T> shared_ptr<const OpSequence<T> > get_section_ptr(const std::string& name) const;
%exception {
try {
$action
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
template<class T> shared_ptr<OpSequence<T> > get_section_ptr(const std::string& name);
%template(get_section_ptr_bool) get_section_ptr<Bool>;
%template(get_section_ptr_tset) get_section_ptr<TSet>;
......@@ -116,11 +150,27 @@ namespace Wccl {
/* --------------------------------------------------------------------- */
// const FunctionalOperator& get_untyped_op(const std::string& name, size_t idx = 0) const;
%exception {
try {
$action
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
FunctionalOperator& get_untyped_op(const std::string& name, size_t idx = 0);
/* --------------------------------------------------------------------- */
// template<class T> const Operator<T>& get_op(const std::string& name, size_t idx = 0) const;
%exception {
try {
$action
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
template<class T> Operator<T>& get_op(const std::string& name, size_t idx = 0);
/*
%template(get_op_bool) get_op<Bool>;
......@@ -133,11 +183,27 @@ namespace Wccl {
/* --------------------------------------------------------------------- */
// shared_ptr<const FunctionalOperator> get_untyped_op_ptr(const std::string& name, size_t idx = 0) const;
%exception {
try {
$action
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
shared_ptr<FunctionalOperator> get_untyped_op_ptr(const std::string& name, size_t idx = 0);
/* --------------------------------------------------------------------- */
// template<class T> shared_ptr<const Operator<T> > get_op_ptr(const std::string& name, size_t idx = 0) const;
%exception {
try {
$action
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
template<class T> shared_ptr<Operator<T> > get_op_ptr(const std::string& name, size_t idx = 0);
%template(get_op_ptr_bool) get_op_ptr<Bool>;
%template(get_op_ptr_tset) get_op_ptr<TSet>;
......@@ -148,11 +214,27 @@ namespace Wccl {
/* --------------------------------------------------------------------- */
// UntypedOpSequence::name_op_v_c_t gen_name_untyped_op_pairs() const;
%exception {
try {
$action
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
UntypedOpSequence::name_op_v_t gen_name_untyped_op_pairs();
/* --------------------------------------------------------------------- */
// template<class T> typename OpSequence<T>::name_op_v_c_t gen_name_op_pairs() const;
%exception {
try {
$action
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
template<class T> typename OpSequence<T>::name_op_v_t gen_name_op_pairs();
%template(gen_name_op_pairs_bool) gen_name_op_pairs<Bool>;
%template(gen_name_op_pairs_tset) gen_name_op_pairs<TSet>;
......@@ -163,6 +245,14 @@ namespace Wccl {
/* --------------------------------------------------------------------- */
// FunctionalOpSequence::name_op_v_c_t gen_all_op_pairs() const;
%exception {
try {
$action
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
FunctionalOpSequence::name_op_v_t gen_all_op_pairs();
......@@ -173,7 +263,24 @@ namespace Wccl {
bool has_lexicon(const std::string& name) const;
bool has_lexicons() const;
%exception {
try {
$action
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
shared_ptr<const Lexicon> get_lexicon_ptr(const std::string& name) const;
%exception {
try {
$action
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
const Lexicon& get_lexicon(const std::string& name) const;
shared_ptr<const Lexicons> get_lexicons_ptr() const;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment