EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PyService.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Zhur
24 */
25 
26 
27 #ifndef __PYSERVICE_H_INCL__
28 #define __PYSERVICE_H_INCL__
29 
30 #include "PyCallable.h"
31 #include "PyServiceMgr.h"
32 
33 class PyPacket;
34 class PyRep;
35 class PySubStream;
36 class PyTuple;
37 class PyObject;
38 class Client;
39 class PyCallStream;
40 class PyBoundObject;
41 class EntityList;
42 
43 //convenience macro, you do not HAVE to use this
44 #define PyCallable_DECL_CALL(n) PyResult Handle_##n(PyCallArgs &call);
45 
46 class PyService : public PyCallable {
47 public:
48  PyService(PyServiceMgr *mgr, const char *serviceName);
49  virtual ~PyService();
50 
51  //overload Callable for binding:
52  virtual PyResult Call(const std::string &method, PyCallArgs &args);
53 
54  const char* GetName() const { return m_name; }
55 
56 protected:
57  typedef enum { //enum to make sure the caller uses legit values.
81  static const char *const s_checkTimeStrings[_checkCount];
82  PyObject *_BuildCachedReturn(PySubStream **result, const char *sessionInfo, CacheCheckTime check);
83 
84  //you MUST overload this factory method if you offer any bound services:
85  virtual PyBoundObject* CreateBoundObject(Client *pClient, const PyRep *bind_args);
86 
87  //some service-level remote calls, need to be reworked:
90 
92 
93 private:
94  const char* m_name;
95 };
96 
97 #endif
98 
Base Python wire object.
Definition: PyRep.h:66
PyService(PyServiceMgr *mgr, const char *serviceName)
Definition: PyService.cpp:32
Python tuple.
Definition: PyRep.h:567
const char * GetName() const
Definition: PyService.h:54
CacheCheckTime
Definition: PyService.h:57
PyObject * _BuildCachedReturn(PySubStream **result, const char *sessionInfo, CacheCheckTime check)
Definition: PyService.cpp:142
* args
const char * m_name
Definition: PyService.h:94
Python object.
Definition: PyRep.h:826
virtual PyResult Handle_MachoResolveObject(PyCallArgs &call)
Definition: PyService.cpp:63
virtual PyResult Handle_MachoBindObject(PyCallArgs &call)
Definition: PyService.cpp:70
PyServiceMgr *const m_manager
Definition: PyService.h:91
virtual PyResult Call(const std::string &method, PyCallArgs &args)
Definition: PyService.cpp:43
Definition: Client.h:66
static const char *const s_checkTimeStrings[_checkCount]
Definition: PyService.h:81
virtual PyBoundObject * CreateBoundObject(Client *pClient, const PyRep *bind_args)
Definition: PyService.cpp:169
virtual ~PyService()
Definition: PyService.cpp:38