GVOHub.hpp

Louge Thierry, 06/27/2014 04:11 PM

Download (4.06 KB)

 
1
/***************************************************************************
2
 *                     GVOHub.hpp - VO SAMP Hub class                     *
3
 * ----------------------------------------------------------------------- *
4
 *  copyright (C) 2014 by Juergen Knoedlseder & Thierry Louge                             *
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 GVOHub.hpp
23
 * @brief SAMP hub class interface definition
24
 * @author Juergen Knoedlseder, Thierry Louge
25
 */
26

    
27
#ifndef GVOHUB_HPP
28
#define GVOHUB_HPP
29

    
30
/* __ Includes ___________________________________________________________ */
31
#include <string>
32
#include "GBase.hpp"
33
#include "GXml.hpp"
34
#include "GXmlNode.hpp"
35

    
36

    
37
/***********************************************************************//**
38
 * @class GVOHub
39
 *
40
 * @brief VO SAMP Hub class
41
 *
42
 * This class implements a SAMP hub for exchanges 
43
 * through VO-compatible applications.
44
 ***************************************************************************/
45
class GVOHub : public GBase {
46

    
47
public:
48
    // Constructors and destructors
49
    GVOHub(void);
50
    GVOHub(const GVOHub& hub);
51
    virtual ~GVOHub(void);
52

    
53
    // Operators
54
    GVOHub& operator=(const GVOHub& hub);
55

    
56
    // Methods
57
    //void        clear(void);
58
    //GVOHub*  clone(void) const;
59
    //void        connect(void);
60
    //void        disconnect(void);
61
    //bool        has_hub(void) const;
62
    //bool        is_connected(void) const;
63
    GXml        response(void) const;
64
    std::string print(const GChatter& chatter = NORMAL) const;
65

    
66
protected:
67
    // Protected methods
68
    void        init_members(void);
69
    void        init_hub(void);
70
    int         start_hub(void);
71
    //void        free_members(void);
72
    //bool        find_hub(void);
73
    //void        connect_to_hub(void);
74
    void        register_service(void);
75
    void        unregister(void);
76
    //void        send_metadata(void);
77
    
78
    // Low-level methods
79
    void        post_string(const std::string& string) const;
80
    std::string receive_string(void) const;
81
    std::string get_response_value(const GXml& xml, const std::string& name) const;
82
    void        get_name_value_pair(const GXmlNode* node, std::string& name, std::string& value) const;
83
    std::string get_hub_lockfile(void) const;
84

    
85
    // Protected data area
86
    std::string m_name;        //!< Client name
87
    std::string m_secret;      //!< Secret Hub key
88
    std::string m_hub_url;     //!< The XML-RPC endpoint for communication with the hub
89
    std::string m_hub_host;    //!< Hub host (extracted from XML-RPC endpoint)
90
    std::string m_hub_port;    //!< Hub port (extracted from XML-RPC endpoint)
91
    std::string m_version;     //!< The version of the SAMP Standard Profile implemented by the hub
92
    std::string m_client_key;  //!< Private client key
93
    std::string m_hub_id;      //!< Hub identifier
94
    std::string m_client_id;   //!< Client identifier
95
    int         m_socket;      //!< Hub socket
96
};
97

    
98
#endif /* GVOHUB_HPP */