Doxygen Generated Documentation of Ben-Jose Trainable SAT Solver Library
str_set.h
1 
2 
3 /*************************************************************
4 
5 This file is part of ben-jose.
6 
7 ben-jose is free software: you can redistribute it and/or modify
8 it under the terms of the version 3 of the GNU General Public
9 License as published by the Free Software Foundation.
10 
11 ben-jose is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with ben-jose. If not, see <http://www.gnu.org/licenses/>.
18 
19 ------------------------------------------------------------
20 
21 Copyright (C) 2007-2012, 2014-2016. QUIROGA BELTRAN, Jose Luis.
22 Id (cedula): 79523732 de Bogota - Colombia.
23 See https://github.com/joseluisquiroga/ben-jose
24 
25 ben-jose is free software thanks to The Glory of Our Lord
26  Yashua Melej Hamashiaj.
27 Our Resurrected and Living, both in Body and Spirit,
28  Prince of Peace.
29 
30 ------------------------------------------------------------
31 
32 str_set.h
33 
34 string set wrapper.
35 
36 --------------------------------------------------------------*/
37 
38 #ifndef STR_SET_H
39 #define STR_SET_H
40 
41 #include <set>
42 #include <map>
43 
44 //=================================================================
45 // strset
46 
47 typedef std::set<ch_string> string_set_t;
48 //typedef mem_redblack<ch_string> string_set_t;
49 typedef std::map<ch_string, long> string_long_map_t;
50 typedef std::map<ch_string, ch_string> str_str_map_t;
51 
52 inline
53 void strset_clear(string_set_t& ss){
54  //ss.clear_redblack();
55  ss.clear();
56 }
57 
58 inline
59 bool strset_is_empty(string_set_t& ss){
60  //bool ee = ss.is_empty();
61  bool ee = ss.empty();
62  return ee;
63 }
64 
65 inline
66 long strset_size(string_set_t& ss){
67  //long nn = ss.size();
68  long nn = ss.size();
69  return nn;
70 }
71 
72 inline
73 bool strset_find_path(string_set_t& ss, ch_string pth){
74  //bool ff = ss.search(pth);
75  bool ff = (ss.find(pth) != ss.end());
76  return ff;
77 }
78 
79 inline
80 void strset_add_path(string_set_t& ss, ch_string pth){
81  if(pth.empty()){ return; }
82  if(pth == ""){ return; }
83  //ss.push(pth);
84  ss.insert(pth);
85 }
86 
87 inline
88 void strset_print(bj_ostream& os, string_set_t& pmp){
89  for(string_set_t::iterator it = pmp.begin(); it != pmp.end(); ++it){
90  os << *it << '\n';
91  }
92 }
93 
94 
95 #endif // STR_SET_H
96 
97