fintp_connectors
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
Connector.h
Go to the documentation of this file.
1 /*
2 * FinTP - Financial Transactions Processing Application
3 * Copyright (C) 2013 Business Information Systems (Allevo) S.R.L.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program 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 General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>
17 * or contact Allevo at : 031281 Bucuresti, 23C Calea Vitan, Romania,
18 * phone +40212554577, office@allevo.ro <mailto:office@allevo.ro>, www.allevo.ro.
19 */
20 
21 #ifndef FILECONNECTOR_H
22 #define FILECONNECTOR_H
23 
24 #include <pthread.h>
25 
26 #include <string>
27 #include <deque>
28 
29 using namespace std;
30 
31 #include "Endpoint.h"
32 #include "Service/NTServiceBase.h"
33 #include "AppSettings.h"
34 
35 #if defined( WIN32 ) && defined( WIN32_SERVICE )
36 class Connector : public CNTService
37 #else
38 class Connector
39 #endif
40 {
41  public :
42 
43  //constructor
44  Connector( const string& mainProgramName = "Connector", const string& startupFolder = "" );
45 
46  //destructor
47  ~Connector();
48 
49  //members
50  void Start( const string& recoveryMessageId = "" );
51  void Stop( void );
52 
53  bool isRunning() const { return m_Running; }
54 
55 #if defined( WIN32_SERVICE )
56  virtual void Run( DWORD, LPTSTR * );
57 #endif
58 
59  void setMainProgramName( const string& mainProgramName ) { m_FullProgramName = mainProgramName; }
60  string getMainProgramName() const { return m_FullProgramName; }
61 
62  // endpoints accessors
63  const Endpoint* getFetcher() const { return m_Fetcher; }
64  const Endpoint* getPublisher() const { return m_Publisher; }
65 
66  AppSettings GlobalSettings;
67 
68  private :
69 
70 #if defined( WIN32_SERVICE )
71  HANDLE m_hStop;
72 #endif
73 
75  static bool m_ShouldStop;
76 
79 
80  bool m_Running;
81 };
82 
83 #endif