00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00040 #ifndef SPVECGF2_H
00041 #define SPVECGF2_H
00042
00043 #include <iostream>
00044 #include <LEP/mcb/config.h>
00045
00046 #ifdef LEDA_GE_V5
00047 #include <LEDA/system/basic.h>
00048 #include <LEDA/core/list.h>
00049 #include <LEDA/core/d_int_set.h>
00050 #include <LEDA/system/error.h>
00051 #include <LEDA/system/assert.h>
00052 #else
00053 #include <LEDA/basic.h>
00054 #include <LEDA/list.h>
00055 #include <LEDA/d_int_set.h>
00056 #include <LEDA/error.h>
00057 #include <LEDA/assert.h>
00058 #endif
00059 #include <LEP/mcb/edge_num.h>
00060 #include <LEP/mcb/arithm.h>
00061
00062 namespace mcb
00063 {
00064
00065 #if defined(LEDA_NAMESPACE)
00066 using leda::list;
00067 using leda::list_item;
00068 using leda::error_handler;
00069 using leda::d_int_set;
00070 #endif
00071
00072
00115 class spvecgf2
00116 {
00117 public:
00119
00120 spvecgf2();
00121
00123 spvecgf2( const spvecgf2 & a );
00124
00125 explicit spvecgf2( const int& i );
00126
00128 ~spvecgf2( );
00130
00131
00133
00137 spvecgf2& operator=( const spvecgf2& i );
00138
00140 spvecgf2& operator=( const int& i );
00141
00146 #if (__LEDA__ >= 500)
00147 spvecgf2& operator=( const d_int_set& i );
00148 #else
00149 spvecgf2& operator=( d_int_set& i );
00150 #endif
00151
00155 spvecgf2 operator-( ) const;
00156
00162 int operator*( const spvecgf2& a ) const;
00163
00169 spvecgf2 operator+( const spvecgf2& a ) const;
00170
00175 void add( const spvecgf2& a );
00176
00183 spvecgf2 operator%( const spvecgf2& a ) const;
00184
00190 d_int_set operator%( const d_int_set& a ) const;
00191
00197 spvecgf2 intersect( const spvecgf2& a ) const;
00198
00204 spvecgf2& operator+=( const spvecgf2& a );
00205
00212 spvecgf2& operator-=( const spvecgf2& a );
00213
00220 spvecgf2& operator%=( const spvecgf2& a );
00221
00226 void swap( spvecgf2& a );
00228
00230
00233 d_int_set to_d_int_set() const;
00234
00238 list<int> to_list() const { return l; }
00240
00242
00243 void clear( ) { l.clear(); }
00244
00248 void print( std::ostream & o ) const;
00249
00258 void append( int index );
00259
00268 void insert( int index );
00269
00274 int pop() { return l.pop(); }
00275
00281 void sort() { l.sort(); }
00282
00283
00284
00288 bool empty() const { return l.empty(); }
00289
00293 int size( ) const { return l.size(); }
00295
00297
00303 list_item first( ) const { return l.first(); }
00304
00311 list_item last( ) const { return l.last(); }
00312
00318 list_item succ( list_item it ) const { return l.succ(it); }
00319
00325 list_item pred( list_item it ) const { return l.pred(it); }
00326
00332 int index( list_item it ) const { return l.contents(it); }
00333
00339 int inf( list_item it ) const { return l.contents(it); }
00340
00341
00342 typedef list_item item;
00343
00344 item first_item() const { return l.first(); }
00345 item last_item() const { return l.last(); }
00346 item next_item(item it) const { return it ? l.succ(it) : 0; }
00348
00349 private:
00350
00351 list < int > l;
00352 };
00353
00359 std::ostream & operator<<( std::ostream & o, const spvecgf2& v );
00360
00366 std::istream & operator>>( std::istream & o, spvecgf2& v );
00367
00368
00369 }
00370
00371
00372 namespace std {
00373 template<>
00374 void swap<mcb::spvecgf2>( mcb::spvecgf2& a, mcb::spvecgf2& b );
00375 }
00376
00377
00378 #endif
00379
00380
00381
00382