Commit 7956c1683bbd84c50870f49a75647e64e0fa8114

Authored by Jürgen Knödlseder
1 parent be00fd3a

Add vo module and GVOClient class to Python interface.

The vo module and GVOClient class were missing in the Python interface. They have been added now.
ChangeLog
1   -2014-01-24 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
  1 +2014-01-25 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
2 2  
3 3 * Bug fix Version 0.8.1 released
4 4 ================================
... ... @@ -9,6 +9,7 @@
9 9 id attribute into XML file (#1092)
10 10 Add GChatter typedef to Python interface
11 11 GAMMALIB_CALDB takes precedence over CALDB environment var (#1094)
  12 + Added vo module and GVOClient class to Python interface
12 13  
13 14 2014-01-18 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
14 15  
... ...
... ... @@ -2,7 +2,7 @@ New Features and Important Changes in GammaLib 00-08-01
2 2  
3 3 Author(s) : Juergen Knoedlseder
4 4  
5   -24 January 2014
  5 +25 January 2014
6 6  
7 7  
8 8 1. Introduction
... ... @@ -89,7 +89,8 @@ None
89 89  
90 90 15. VO module
91 91 -------------
92   -None
  92 +The vo module and GVOClient class have been added to the Python
  93 +interface.
93 94  
94 95  
95 96 16. Xspec module
... ...
configure.ac
... ... @@ -887,7 +887,8 @@ else
887 887 pyext/gammalib/support_wrap.cpp pyext/gammalib/support.py
888 888 pyext/gammalib/test_wrap.cpp pyext/gammalib/test.py
889 889 pyext/gammalib/xml_wrap.cpp pyext/gammalib/xml.py
890   - pyext/gammalib/xspec_wrap.cpp pyext/gammalib/xspec.py],,
  890 + pyext/gammalib/xspec_wrap.cpp pyext/gammalib/xspec.py
  891 + pyext/gammalib/vo_wrap.cpp pyext/gammalib/vo.py],,
891 892 [has_wrappers="no"])
892 893 if test "x$with_mwl" = "xyes"; then
893 894 AC_CHECK_FILES([pyext/gammalib/mwl_wrap.cpp pyext/gammalib/mwl.py],,
... ...
pyext/GVOClient.i 0 → 100644
  1 +/***************************************************************************
  2 + * GVOClient.i - VO client class *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2014 by Juergen Knoedlseder *
  5 + * ----------------------------------------------------------------------- *
  6 + * *
  7 + * This program is free software: you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation, either version 3 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + * This program is distributed in the hope that it will be useful, *
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15 + * GNU General Public License for more details. *
  16 + * *
  17 + * You should have received a copy of the GNU General Public License *
  18 + * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  19 + * *
  20 + ***************************************************************************/
  21 +/**
  22 + * @file GVOClient.i
  23 + * @brief VO client class interface definition
  24 + * @author Juergen Knoedlseder
  25 + */
  26 +%{
  27 +/* Put headers and other declarations here that are needed for compilation */
  28 +#include "GVOClient.hpp"
  29 +%}
  30 +
  31 +
  32 +/***********************************************************************//**
  33 + * @class GVOClient
  34 + *
  35 + * @brief VO client class
  36 + ***************************************************************************/
  37 +class GVOClient : public GBase {
  38 +public:
  39 + // Constructors and destructors
  40 + GVOClient(void);
  41 + GVOClient(const GVOClient& client);
  42 + virtual ~GVOClient(void);
  43 +
  44 + // Methods
  45 + void clear(void);
  46 + GVOClient* clone(void) const;
  47 + void connect(void);
  48 + void disconnect(void);
  49 + bool has_hub(void) const;
  50 + bool is_connected(void) const;
  51 + GXml response(void) const;
  52 +};
  53 +
  54 +
  55 +/***********************************************************************//**
  56 + * @brief GVOClient class extension
  57 + ***************************************************************************/
  58 +%extend GVOClient {
  59 + GVOClient copy() {
  60 + return (*self);
  61 + }
  62 +};
... ...
pyext/Makefile.am
... ... @@ -61,9 +61,10 @@ BUILT_SOURCES = gammalib/app_wrap.cpp gammalib/app.py \
61 61 gammalib/opt_wrap.cpp gammalib/opt.py \
62 62 gammalib/sky_wrap.cpp gammalib/sky.py \
63 63 gammalib/support_wrap.cpp gammalib/support.py \
  64 + gammalib/test_wrap.cpp gammalib/test.py \
64 65 gammalib/xml_wrap.cpp gammalib/xml.py \
65 66 gammalib/xspec_wrap.cpp gammalib/xspec.py \
66   - gammalib/test_wrap.cpp gammalib/test.py \
  67 + gammalib/vo_wrap.cpp gammalib/vo.py \
67 68 $(INST_SWIG_TARGETS)
68 69  
69 70 # Dependencies. Obtain the list of dependencies by executing ls.
... ...
pyext/gammalib/vo.i 0 → 100644
  1 +/***************************************************************************
  2 + * vo.i - Virtual Observatory module *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2014 by Juergen Knoedlseder *
  5 + * ----------------------------------------------------------------------- *
  6 + * *
  7 + * This program is free software: you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation, either version 3 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + * This program is distributed in the hope that it will be useful, *
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15 + * GNU General Public License for more details. *
  16 + * *
  17 + * You should have received a copy of the GNU General Public License *
  18 + * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  19 + * *
  20 + * ----------------------------------------------------------------------- *
  21 + * Usage: *
  22 + * swig -c++ -python -Wall vo.i *
  23 + ***************************************************************************/
  24 +/**
  25 + * @file vo.i
  26 + * @brief Virtual Observatory module
  27 + * @author Juergen Knoedlseder
  28 + */
  29 +%module vo
  30 +%feature("autodoc", "1");
  31 +
  32 +/* __ Headers needed for compilation _____________________________________ */
  33 +%{
  34 +#include <stddef.h>
  35 +#include "GException.hpp"
  36 +#include "GTools.hpp"
  37 +%}
  38 +
  39 +/* __ Include standard typemaps for vectors and strings __________________ */
  40 +//%include stl.i
  41 +
  42 +/* __ Include interface classes __________________________________________ */
  43 +%import(module="gammalib.base") "GBase.i";
  44 +//%import(module="gammalib.base") "GContainer.i";
  45 +
  46 +/* __ Make sure that exceptions are catched ______________________________ */
  47 +//%import(module="gammalib.support") "GException.i";
  48 +
  49 +/* __ Virtual Observatory module _________________________________________ */
  50 +%include "GVOClient.i"
... ...
pyext/setup.py.in
... ... @@ -31,7 +31,8 @@ pkg_name = &#39;gammalib&#39;
31 31  
32 32 # Define core modules
33 33 core_modules = ['app', 'base', 'fits', 'linalg', 'model', 'numerics', \
34   - 'obs', 'opt', 'sky', 'support', 'test', 'xml', 'xspec']
  34 + 'obs', 'opt', 'sky', 'support', 'test', 'xml', 'xspec', \
  35 + 'vo']
35 36  
36 37 # Detect execution mode
37 38 is_build = True
... ...
test/test_GVO.py 0 → 100755
  1 +# ==========================================================================
  2 +# This module performs unit tests for the GammaLib vo module.
  3 +#
  4 +# Copyright (C) 2014 Juergen Knoedlseder
  5 +#
  6 +# This program is free software: you can redistribute it and/or modify
  7 +# it under the terms of the GNU General Public License as published by
  8 +# the Free Software Foundation, either version 3 of the License, or
  9 +# (at your option) any later version.
  10 +#
  11 +# This program is distributed in the hope that it will be useful,
  12 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 +# GNU General Public License for more details.
  15 +#
  16 +# You should have received a copy of the GNU General Public License
  17 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
  18 +#
  19 +# ==========================================================================
  20 +from gammalib import *
  21 +from math import *
  22 +import os
  23 +
  24 +
  25 +# ================================= #
  26 +# Test class for GammaLib vo module #
  27 +# ================================= #
  28 +class Test(GPythonTestSuite):
  29 + """
  30 + Test class for GammaLib vo module.
  31 + """
  32 + # Constructor
  33 + def __init__(self):
  34 + """
  35 + Constructor.
  36 + """
  37 + # Call base class constructor
  38 + GPythonTestSuite.__init__(self)
  39 +
  40 + # Return
  41 + return
  42 +
  43 + # Set test functions
  44 + def set(self):
  45 + """
  46 + Set all test functions.
  47 + """
  48 + # Set test name
  49 + self.name("vo")
  50 +
  51 + # Append tests
  52 + self.append(self.test_voclient, "Test GVOClient")
  53 +
  54 + # Return
  55 + return
  56 +
  57 + # Test GVOClient class
  58 + def test_voclient(self):
  59 + """
  60 + Test GVOClient class.
  61 + """
  62 + # Allocate GVOClient object
  63 + client = GVOClient()
  64 +
  65 + # Return
  66 + return
... ...
test/test_python.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # This scripts performs unit tests for the GammaLib Python bindings.
4 4 #
5   -# Copyright (C) 2012 Juergen Knoedlseder
  5 +# Copyright (C) 2012-2014 Juergen Knoedlseder
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -33,6 +33,7 @@ import test_GSupport
33 33 import test_GTest
34 34 import test_GXml
35 35 import test_GXspec
  36 +import test_GVO
36 37  
37 38 # Try importing MWL tests
38 39 try:
... ... @@ -86,6 +87,7 @@ if __name__ == &#39;__main__&#39;:
86 87 suite10 = test_GTest.Test()
87 88 suite11 = test_GXml.Test()
88 89 suite12 = test_GXspec.Test()
  90 + suite13 = test_GVO.Test()
89 91  
90 92 # Setup unit tests
91 93 suite1.set()
... ... @@ -100,6 +102,7 @@ if __name__ == &#39;__main__&#39;:
100 102 suite10.set()
101 103 suite11.set()
102 104 suite12.set()
  105 + suite13.set()
103 106  
104 107 # Append tests to container
105 108 suites.append(suite1)
... ... @@ -114,6 +117,7 @@ if __name__ == &#39;__main__&#39;:
114 117 suites.append(suite10)
115 118 suites.append(suite11)
116 119 suites.append(suite12)
  120 + suites.append(suite13)
117 121  
118 122 # Optionally handle MWL suite
119 123 if has_mwl:
... ...