fintp_base
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BatchFlatfileStorage.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 BATCHFLATFILESTORAGE_H
22 #define BATCHFLATFILESTORAGE_H
23 
24 #include "../BatchStorageBase.h"
25 #include <fstream>
26 
27 #include "../../Template/TemplateParser.h"
28 
29 //TODO:
30 // 1. La eroare de formatare, pune in Mq pana la linia respectiva
31 // dupa care muta fisierul in ErrorPath si trimite mesaje de eroare
32 // 2. Daca este eroare pe prima linie dupa schimbarea Chunk-ului
33 // ultimul mesaj bun nu il pune
34 //
35 
36 namespace FinTP
37 {
39  {
40  public:
41 
44 
45  void enqueue( BatchResolution& resolution );
46  BatchItem dequeue();
47 
48  // open/close storage
49  void open( const string& storageId, ios_base::openmode openMode );
50  void close( const string& storageId );
51 
52  void commit() {}
53  void rollback() {};
54 
55  long size() const { return 0; }
56 
57  // particular flags/sets
58  void setTemplate( const string& templateFilename );
59  void setBufferSize( const unsigned long buffsize ){ m_ChunkSize = buffsize; }
60 
61  private :
62 
64  // m_CrtStorage is the batch file under construction or under parse
65  fstream m_CrtStorage;
66  // m_CrtIndex = index in the current chunk, at the end of the current match
67  unsigned long m_CrtIndex, m_CrtSequence, m_ChunkSize, m_BufferLength;
68  unsigned char* m_Buffer;
69 
70  //m_NextItem is the next message
73  };
74 }
75 
76 #endif // BATCHFLATFILESTORAGE_H