source: trunk/disparm.h

Last change on this file was 4, checked in by willem, 11 years ago

willem

File size: 2.6 KB
Line 
1
2/*
3   Copyright 2012 Willem Vermin, SARA
4
5   Licensed under the Apache License, Version 2.0 (the "License");
6   you may not use this file except in compliance with the License.
7   You may obtain a copy of the License at
8
9       http://www.apache.org/licenses/LICENSE-2.0
10
11   Unless required by applicable law or agreed to in writing, software
12   distributed under the License is distributed on an "AS IS" BASIS,
13   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   See the License for the specific language governing permissions and
15   limitations under the License.
16 */
17
18struct stats{bool valid; unsigned int records;unsigned int ready;unsigned int committed;unsigned int commax;};
19const std::string programname = "disparm";
20class disparm{
21  private:
22  static const std::string keyname;
23  static const std::string committedname;
24  static const std::string valuename;
25  static const std::string rcname;
26  static const std::string linename;
27
28  bool debug;
29
30  std::string arg;
31
32  std::streampos key;
33  int            committed;
34  std::string    rc;
35  std::string    value;
36  char           status;
37  unsigned int   linenr;
38
39  std::string path_pool;
40  std::string path_link;
41  std::string baselinkfilename;
42  std::string inputfilename;
43  std::string path_lockdir;
44  std::string path_lock;
45  unsigned int maxiter;
46  const static int pointerlen = 16;
47  std::string lockname;
48  std::string pmarker;
49  int pmarkerlen;
50  int shelltype;
51  void setpath_link(std::string filename);
52  int getlock(void);
53  void removelock();
54  void setpath_lock(std::string p);
55  void setbaselinkfilename(std::string filename);
56  void createlinkfilename(void);
57  void removedanglinglinks(void);
58  int remove_lock_and_links(const std::string path, const std::string dirl, 
59      const std::string path_lock, int timer);
60  void remove_lock_and_links(void);
61  int realnext(void);
62  void debugger(const std::string s);
63  std::string createrc(void);
64  char *buffer; 
65
66  public:
67
68  ~disparm();
69  void setarg(int argc, char*argv[]);
70  void setdebug();
71  static const std::string defpath_pool;
72  std::string defpath_lockdir;
73  static const std::string definputfilename;
74  disparm(void);
75  void setinputfilename(std::string inputfilename);
76  void setmaxiter(int maxiter);
77  std::streampos getkey(void);
78  int create(std::string &s);
79  int next(std::string& s);
80  int ready(void);
81  int REMOVE(void);
82  int getstat(int& records, int& committed, int& ready);
83  int echounhandled(void);
84  void setpath_pool(std::string pool);
85  int setpath_lockdir(std::string lockdir);
86  void setkey(std::streampos key);
87  friend std::ostream& operator <<(std::ostream &os,disparm &obj);
88  stats getstats();
89};
Note: See TracBrowser for help on using the repository browser.