23 #ifndef __INT_DATASET_H__
24 #define __INT_DATASET_H__
47 static const std::vector<int> *
empty_;
49 const std::vector<int>*
data;
67 std::vector<int> tmp = std::vector<int> (ddata);
68 sort( tmp.begin() , tmp.end() );
75 std::vector<int> tmp = std::vector<int> (ddata);
76 sort( tmp.begin() , tmp.end() );
93 std::vector<int> res ;
94 const std::vector<int>* bvec = ((
const IntDataSet &) b).data;
95 std::set_intersection(
data->begin(),
data->end(),bvec->begin(), bvec->end(),std::back_insert_iterator<std::vector<int> > (res));
97 std::vector<int> trimres = std::vector<int> (res);
98 assert (trimres.size() == trimres.capacity());
103 std::vector<int> res ;
104 const std::vector<int>* bvec = ((
const IntDataSet &) b).data;
105 std::set_union(
data->begin(),
data->end(),bvec->begin(), bvec->end(),std::back_insert_iterator<std::vector<int> > (res));
107 std::vector<int> trimres = std::vector<int> (res);
108 assert (trimres.size() == trimres.capacity());
113 std::vector<int> res ;
114 const std::vector<int>* bvec = ((
const IntDataSet &) b).data;
115 std::set_difference(
data->begin(),
data->end(),bvec->begin(), bvec->end(),std::back_insert_iterator<std::vector<int> > (res));
117 std::vector<int> trimres = std::vector<int> (res);
118 assert (trimres.size() == trimres.capacity());
149 if (!
data->empty() ) {
150 std::copy(
data->begin(), --
data->end(),
151 std::ostream_iterator<int>(os,
",") );
152 os << *(--
data->end());
161 DataSet *normalizeDistance(
int n)
const {
164 int getMinDistance()
const {
This class is an abstraction of a set of data.
Definition: DataSet.h:44
This class is a very basic implementation of DataSet interface based on std::std::vector<int> and a u...
Definition: IntDataSet.h:38
IntDataSet(const std::vector< int >::iterator &begin, const std::vector< int >::iterator &end)
public constructor from iterator (begin,end)
Definition: IntDataSet.h:73
static void garbage()
Definition: IntDataSet.cpp:35
std::set< const std::vector< int > * > marktable_t
Definition: IntDataSet.h:43
IntDataSet(const std::vector< int > *ddata)
Definition: IntDataSet.h:54
std::vector< int >::const_iterator const_iterator
typedef IntDataSet::const_iterator
Definition: IntDataSet.h:54
bool empty() const
returns true if this is the empty set
Definition: IntDataSet.h:123
IntDataSet(const std::vector< int > &ddata)
public constructor from non unique std::vector<int>
Definition: IntDataSet.h:66
DataSet * set_union(const DataSet &b) const
returns a new instance with elements = this union b
Definition: IntDataSet.h:102
DataSet * newcopy() const
returns a new instance copy of this
Definition: IntDataSet.h:88
const_iterator end() const
Definition: IntDataSet.h:62
DataSet * empty_set() const
returns a pointer to an instance of the empty set
Definition: IntDataSet.h:127
static const std::vector< int > * empty_
Definition: IntDataSet.h:47
long double set_size() const
Definition: IntDataSet.h:139
virtual size_t set_hash() const
returns a hash function, used in the SDD hash function computation
Definition: IntDataSet.h:143
bool set_equal(const DataSet &b) const
Compares two sets for equality.
Definition: IntDataSet.h:131
marktable_t::const_iterator marktable_it
Definition: IntDataSet.h:44
bool set_less_than(const DataSet &b) const
Compares two sets for equality.
Definition: IntDataSet.h:135
void mark() const
for memory management : if your DataSet references no GDD,GHom,GSDD,GShom, mark() should do nothing
Definition: IntDataSet.h:158
static marktable_t marktable
Definition: IntDataSet.h:45
const_iterator begin() const
read-only iterator interface
Definition: IntDataSet.h:61
virtual ~IntDataSet()
destructor
Definition: IntDataSet.h:86
const std::vector< int > * data
Definition: IntDataSet.h:49
IntDataSet()
public deafult constructor = empty set
Definition: IntDataSet.h:81
DataSet * set_intersect(const DataSet &b) const
returns a new instance with elements = this inter b
Definition: IntDataSet.h:92
DataSet * set_minus(const DataSet &b) const
returns a new instance with elements = this setminus b
Definition: IntDataSet.h:112
UniqueTable< std::vector< int > > canonical_t
Definition: IntDataSet.h:39
virtual void set_print(std::ostream &os) const
returns a formatted string description of the set
Definition: IntDataSet.h:147
canonical_t::Table::iterator canonical_it
Definition: IntDataSet.h:40
static canonical_t canonical
Definition: IntDataSet.h:41
This class implements a unicity table mechanism, based on an STL hash_set.
Definition: UniqueTable.h:43
Definition: hash_support.hh:40