File: cccc_tbl.h

package info (click to toggle)
cccc 3.pre81-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,820 kB
  • ctags: 4,972
  • sloc: ansic: 33,244; cpp: 10,691; java: 618; makefile: 165; sh: 11
file content (41 lines) | stat: -rw-r--r-- 859 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * cccc_tbl.h
 * 
 * defines the database used by CCCC to generate a report
 */
#ifndef CCCC_TBL_H
#define CCCC_TBL_H

#include <iostream>
#include <string>

#include <map>

using std::string;

// CCCC_Table started its life as an array of pointers to CCCC_Records.
// It will ultimately become identical to a std::map from string to T*.
// In the mean time we are supporting a legacy API.
template <class T> class CCCC_Table 
: public std::map<string,T*>
{
  typedef std::map<string,T*> map_t;
  typename map_t::iterator iter_;
  bool sorted;

 public:
  CCCC_Table();
  virtual ~CCCC_Table();
  int records();
  T* find(string name);
  T* find_or_insert(T* new_item_ptr);
  bool remove(T* old_item_ptr);
  void reset_iterator();
  T* first_item();
  T* next_item();
  virtual int get_count(const char *count_tag);
  void sort();
};

#endif // CCCC_DB_H