1 | struct stats{bool valid; unsigned int records;unsigned int ready;unsigned int committed;unsigned int commax;}; |
---|
2 | const std::string programname = "disparm"; |
---|
3 | class disparm{ |
---|
4 | private: |
---|
5 | static const std::string keyname; |
---|
6 | static const std::string committedname; |
---|
7 | static const std::string valuename; |
---|
8 | static const std::string rcname; |
---|
9 | static const std::string linename; |
---|
10 | |
---|
11 | bool debug; |
---|
12 | |
---|
13 | std::string arg; |
---|
14 | |
---|
15 | std::streampos key; |
---|
16 | int committed; |
---|
17 | std::string rc; |
---|
18 | std::string value; |
---|
19 | char status; |
---|
20 | unsigned int linenr; |
---|
21 | |
---|
22 | std::string path_pool; |
---|
23 | std::string path_link; |
---|
24 | std::string baselinkfilename; |
---|
25 | std::string inputfilename; |
---|
26 | std::string path_lockdir; |
---|
27 | std::string path_lock; |
---|
28 | unsigned int maxiter; |
---|
29 | const static int pointerlen = 16; |
---|
30 | std::string lockname; |
---|
31 | std::string pmarker; |
---|
32 | int pmarkerlen; |
---|
33 | int shelltype; |
---|
34 | void setpath_link(std::string filename); |
---|
35 | int getlock(void); |
---|
36 | void removelock(); |
---|
37 | void setpath_lock(std::string p); |
---|
38 | void setbaselinkfilename(std::string filename); |
---|
39 | void createlinkfilename(void); |
---|
40 | void removedanglinglinks(void); |
---|
41 | int remove_lock_and_links(const std::string path, const std::string dirl, |
---|
42 | const std::string path_lock, int timer); |
---|
43 | void remove_lock_and_links(void); |
---|
44 | int realnext(void); |
---|
45 | void debugger(const std::string s); |
---|
46 | std::string createrc(void); |
---|
47 | char *buffer; |
---|
48 | |
---|
49 | public: |
---|
50 | |
---|
51 | ~disparm(); |
---|
52 | void setarg(int argc, char*argv[]); |
---|
53 | void setdebug(); |
---|
54 | static const std::string defpath_pool; |
---|
55 | std::string defpath_lockdir; |
---|
56 | static const std::string definputfilename; |
---|
57 | disparm(void); |
---|
58 | void setinputfilename(std::string inputfilename); |
---|
59 | void setmaxiter(int maxiter); |
---|
60 | std::streampos getkey(void); |
---|
61 | int create(std::string &s); |
---|
62 | int next(std::string& s); |
---|
63 | int ready(void); |
---|
64 | int REMOVE(void); |
---|
65 | int getstat(int& records, int& committed, int& ready); |
---|
66 | int echounhandled(void); |
---|
67 | void setpath_pool(std::string pool); |
---|
68 | int setpath_lockdir(std::string lockdir); |
---|
69 | void setkey(std::streampos key); |
---|
70 | friend std::ostream& operator <<(std::ostream &os,disparm &obj); |
---|
71 | stats getstats(); |
---|
72 | }; |
---|