rasdaman complete source
rasmgr_localsrv.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
37 #ifndef RASMGR_LOCALSRV_HH
38 #define RASMGR_LOCALSRV_HH
39 
40 #include "rasmgr.hh"
41 
42 
46 class LocalServer
47 {
48 public:
49  LocalServer();
50  void init(const char*,pid_t);
51  const char* getName();
52  pid_t getPID();
53  bool isValid();
54 private:
55  char serverName[30];
56  pid_t serverPid;
57  bool valid;
58 };
59 
63 class LocalServerManager
64 {
65 public:
66  LocalServerManager();
67  ~LocalServerManager();
68  bool startNewServer(const char* commandline);
69  int countStartedServers();
70  bool sendTerminateSignal(const char *serverName);
71  bool killServer(const char *serverName);
72 
73  LocalServer& operator[](int);
74  LocalServer& operator[](const char* srvName);
75 
76  void childSignalIn(); //only signal calls this
77  void cleanChild();
78 private:
79  void reportDeadServer(LocalServer &);
80  bool wasSignal;
81  std::list<LocalServer> srvList;
82  LocalServer protElem;
83 
84 };
85 
86 extern LocalServerManager localServerManager;
87 #endif