/* Copyright 2012 Willem Vermin, SARA Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ struct stats{bool valid; unsigned int records;unsigned int ready;unsigned int committed;unsigned int commax;}; const std::string programname = "disparm"; class disparm{ private: static const std::string keyname; static const std::string committedname; static const std::string valuename; static const std::string rcname; static const std::string linename; bool debug; std::string arg; std::streampos key; int committed; std::string rc; std::string value; char status; unsigned int linenr; std::string path_pool; std::string path_link; std::string baselinkfilename; std::string inputfilename; std::string path_lockdir; std::string path_lock; unsigned int maxiter; const static int pointerlen = 16; std::string lockname; std::string pmarker; int pmarkerlen; int shelltype; void setpath_link(std::string filename); int getlock(void); void removelock(); void setpath_lock(std::string p); void setbaselinkfilename(std::string filename); void createlinkfilename(void); void removedanglinglinks(void); int remove_lock_and_links(const std::string path, const std::string dirl, const std::string path_lock, int timer); void remove_lock_and_links(void); int realnext(void); void debugger(const std::string s); std::string createrc(void); char *buffer; public: ~disparm(); void setarg(int argc, char*argv[]); void setdebug(); static const std::string defpath_pool; std::string defpath_lockdir; static const std::string definputfilename; disparm(void); void setinputfilename(std::string inputfilename); void setmaxiter(int maxiter); std::streampos getkey(void); int create(std::string &s); int next(std::string& s); int ready(void); int REMOVE(void); int getstat(int& records, int& committed, int& ready); int echounhandled(void); void setpath_pool(std::string pool); int setpath_lockdir(std::string lockdir); void setkey(std::streampos key); friend std::ostream& operator <<(std::ostream &os,disparm &obj); stats getstats(); };