1 // COVTOOL -- test coverage analysis tool. 2 // Copyright (C) 2002, Lowell Boggs Jr. 3 // mailto:lowell.boggs@attbi.com 4 5 // This file contains free software. You can redistribute it 6 // and/or modify it under the terms of the GNU General Public License 7 // as published by the Free Software Foundation; either version 2, or 8 // (at your option) any later version. 9 10 // This source code 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 // Write to the Free Software Foundation, 59 Temple Place - Suite 330, 16 // Boston, MA 02111-1307, USA for a copy of the GNU General Public License. 17 // 18 19 20 #ifndef READ_DATABASE_H_INCLUDED 21 #define READ_DATABASE_H_INCLUDED 22 23 #include <map> 24 #include <set> 25 #include <string> 26 #include <fstream> 27 28 class CvT_Database 29 // 30 // This class defines the information produced by an 31 // execution of a program instrumented using covtool.exe. 32 // A CvT_Database is empty when created, you must use the 33 // member function, insert(), to get data into it from a 34 // named dtabase file. Further, multiple insert() calls 35 // may be made to merge multiple source files. 36 // 37 { 38 public: 39 40 bool insert(string filename); // load database from filename 41 42 struct File_Info 43 { 44 typedef set<int> line_table; 45 46 line_table instrumented_lines; 47 line_table executed_lines; 48 }; 49 50 typedef map<string, File_Info> value_type; 51 52 private: 53 54 value_type data; 55 56 public: 57 58 typedef value_type::const_iterator const_iterator; 59 60 - const_iterator find(string f) const { return data.find(f); } 61 - const_iterator begin() const { return data.begin(); } 62 - const_iterator end() const { return data.end(); } 63 64 65 }; 66 67 ostream& operator<< (ostream&i, CvT_Database const &db); 68 69 #endif 70 71