Overpass API regression suite coverage (Saxony) / template_db/file_tools.h

template_db/file_tools.h

0 of 4 instrumented lines run by the suite (0.0%) at 8edf11b0419c (this file on GitHub).

runnever runcolumns: line, executions, queries (click for the queries that run the line)

1/** Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Roland Olbricht et al.
2 *
3 * This file is part of Overpass_API.
4 *
5 * Overpass_API is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * Overpass_API is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with Overpass_API. If not, see <http://www.gnu.org/licenses/>.
17 */
19#ifndef DE__OSM3S___TEMPLATE_DB__FILE_TOOLS_H
20#define DE__OSM3S___TEMPLATE_DB__FILE_TOOLS_H
22#include "types.h"
24#include <map>
25#include <set>
26#include <vector>
29/* Represents the connection to a client that is blocking after it has sent a command until
30 * it gets an answer about the command execution state. This class ensures that the software cannot
31 * fail due to a broken pipe. */
32struct Blocking_Client_Socket
34 Blocking_Client_Socket(int socket_descriptor_);
35 uint32 get_command();
36 std::vector< uint32 > get_arguments(int num_arguments); // the number of arguments is defined by the opcode
37 void clear_state();
38 void send_data(uint32 result);
39 void send_result(uint32 result);
40 ~Blocking_Client_Socket();
41private:
42 int socket_descriptor;
43 enum { waiting, processing_command, disconnected } state;
44 std::vector< uint32 > buffer;
45 int bytes_in_buffer;
46 int bytes_expected;
47 int counter;
48};
51class Connection_Per_Pid_Map
53public:
54 typedef uint pid_t;
55 typedef std::map< pid_t, Blocking_Client_Socket* >::const_iterator const_iterator;
570 Connection_Per_Pid_Map() : last_pid(0) {}
58 ~Connection_Per_Pid_Map();
60 Blocking_Client_Socket* get(pid_t pid);
61 void insert(pid_t pid, int socket_fd);
62 void erase(pid_t pid);
640 std::map< pid_t, Blocking_Client_Socket* >::size_type size() const { return data.size(); }
650 const_iterator begin() const { return data.begin(); }
660 const_iterator end() const { return data.end(); }
68 void poll_command_round_robin(uint32& command, uint32& client_pid);
70private:
71 std::map< pid_t, Blocking_Client_Socket* > data;
72 uint32 last_pid;
73};
76std::string getcwd();
79#endif