card_pairs Class Reference

#include <card_pairs.h>

List of all members.

Public Member Functions

 card_pairs ()
 card_pairs (const card_pairs *pairs)
 ~card_pairs ()
void add_card_pair (string name, card_pair *pair)
void merge (const card_pairs *pairs)
void erase (string name)
const vector< string > * get_list_of_names (void) const
card_pairget_card_pair (string name) const
unsigned int get_n_pairs (void) const
bool exists (string name) const

Private Attributes

map< string, card_pair * > _card_pairs_map

Friends

ostream & operator<< (ostream &stream, const card_pairs &pairs)

Detailed Description

____________________________________________________________________________

Definition at line 28 of file card_pairs.h.


Constructor & Destructor Documentation

card_pairs::card_pairs (  ) 

Definition at line 39 of file card_pairs.cxx.

00040 {
00041 
00042 }

card_pairs::card_pairs ( const card_pairs pairs  ) 

Definition at line 44 of file card_pairs.cxx.

References _card_pairs_map, and add_card_pair().

00045 {
00046   map<string, card_pair *>::const_iterator pair_iter;
00047 
00048   for(pair_iter = pairs->_card_pairs_map.begin();
00049                        pair_iter != pairs->_card_pairs_map.end(); ++pair_iter) {
00050 
00051      string       name  =  pair_iter->first;
00052      card_pair *  cards =  pair_iter->second;
00053 
00054      this->add_card_pair(name, cards);
00055   }
00056 }

card_pairs::~card_pairs (  ) 

Definition at line 58 of file card_pairs.cxx.

00059 {
00060 
00061 }


Member Function Documentation

void card_pairs::add_card_pair ( string  name,
card_pair pair 
)

Definition at line 63 of file card_pairs.cxx.

References _card_pairs_map.

Referenced by card_pairs(), and merge().

00064 {
00065   card_pair * cloned_pair = new card_pair(pair);
00066 
00067   _card_pairs_map.insert(
00068                       map<string, card_pair *>::value_type(name, cloned_pair) );
00069 }

void card_pairs::erase ( string  name  ) 

Definition at line 85 of file card_pairs.cxx.

References _card_pairs_map.

00086 {
00087    _card_pairs_map.erase(name);
00088 }

bool card_pairs::exists ( string  name  )  const

Definition at line 117 of file card_pairs.cxx.

References _card_pairs_map.

00118 {
00119   return (_card_pairs_map.count(name) == 1);
00120 }

card_pair * card_pairs::get_card_pair ( string  name  )  const

Definition at line 102 of file card_pairs.cxx.

References _card_pairs_map.

00103 {
00104   if( _card_pairs_map.count(name) == 1 ) {
00105 
00106    map<string, card_pair *>::const_iterator pair_iter = _card_pairs_map.find(name);
00107    return pair_iter->second;
00108 
00109   } else return 0;
00110 }

const vector< string > * card_pairs::get_list_of_names ( void   )  const

Definition at line 90 of file card_pairs.cxx.

References _card_pairs_map.

00091 {
00092    map<string, card_pair *>::const_iterator pair_iter;
00093 
00094    vector<string> * names = new vector<string>;
00095 
00096    for(pair_iter = _card_pairs_map.begin();
00097                     pair_iter != _card_pairs_map.end(); ++pair_iter)
00098                                            names->push_back( pair_iter->first );
00099    return names;
00100 }

unsigned int card_pairs::get_n_pairs ( void   )  const

Definition at line 112 of file card_pairs.cxx.

References _card_pairs_map.

00113 {
00114   return _card_pairs_map.size();
00115 }

void card_pairs::merge ( const card_pairs pairs  ) 

Definition at line 71 of file card_pairs.cxx.

References _card_pairs_map, and add_card_pair().

00072 {
00073   map<string, card_pair *>::const_iterator pair_iter;
00074 
00075   for(pair_iter = pairs->_card_pairs_map.begin();
00076                        pair_iter != pairs->_card_pairs_map.end(); ++pair_iter) {
00077 
00078      string      name  =  pair_iter->first;
00079      card_pair * cards =  pair_iter->second;
00080 
00081      this->add_card_pair(name, cards);
00082   }
00083 }


Friends And Related Function Documentation

ostream& operator<< ( ostream &  stream,
const card_pairs pairs 
) [friend]

Member Data Documentation

map<string, card_pair *> card_pairs::_card_pairs_map [private]

The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1