4#include "GaudiKernel/ContainedObject.h"
5#include "GaudiKernel/ObjectList.h"
19static const CLID CLID_FakeOne = 5101;
20static const CLID CLID_FakeTwo = 5102;
28 static const CLID&
classID() {
return CLID_FakeOne; }
42 static const CLID&
classID() {
return CLID_FakeTwo; }
55 FakeOne *person1, *person2, *person3;
60 person1 =
new FakeOne(
"Jack Tripper", 654);
61 person2 =
new FakeOne(
"Richard Kanningam", 456);
62 person3 =
new FakeOne(
"Dana Scully", 231);
64 location1 =
new FakeTwo(
"531 Stanford Avenue", 2);
65 location2 =
new FakeTwo(
"520 Cowper Street", 3);
85 std::vector< Relation<FakeOne, FakeTwo>* > empty = tab.
getRelByFirst(person1);
86 std::cout <<
"Querying and empty table the size of the returned vector is "
87 << empty.size() << std::endl;
104 std::vector< Relation<FakeOne, FakeTwo>* >::iterator i;
107 std::vector< Relation<FakeOne, FakeTwo>* > locs = tab.
getRelByFirst(person1);
109 std::cout << std::endl << person1->
name << std::endl;
110 for (i = locs.begin(); i != locs.end(); i++)
112 std::cout <<
"Address: " << (*i)->getSecond()->address
113 <<
" Floor: " << (*i)->getSecond()->floor
114 <<
" Date : " << (*i)->getInfos()[0] << std::endl;
118 std::vector< Relation<FakeOne, FakeTwo>* > pers = tab.
getRelBySecond(location2);
120 std::cout << std::endl << location2->
address << std::endl;
121 for (i = pers.begin(); i != pers.end(); i++)
123 std::cout <<
"Name: " << (*i)->getFirst()->name
124 <<
" ssn: " << (*i)->getFirst()->ssn << std::endl;
132 for (i = locs.begin(); i != locs.end(); i++)
137 std::cout << std::endl <<
"persion3 location changed" << std::endl;
138 std::cout << std::endl << location2->
address << std::endl;
141 for (i = pers.begin(); i != pers.end(); i++)
143 std::cout <<
"Name: " << (*i)->getFirst()->name
144 <<
" ssn: " << (*i)->getFirst()->ssn << std::endl;
151 for (i = locs.begin(); i != locs.end(); i++)
156 std::cout << std::endl <<
"Jack Tripper set to null" << std::endl;
163 std::cout <<
"Number of relations with location2 = " << pers.size() << std::endl;
165 std::cout << std::endl << location2->
address << std::endl;
166 for (i = pers.begin(); i != pers.end(); i++)
168 if ((*i)->getFirst())
169 std::cout <<
"Name: " << (*i)->getFirst()->name
170 <<
" ssn: " << (*i)->getFirst()->ssn << std::endl;
177 for (i = pers.begin(); i != pers.end(); i++)
182 std::cout << std::endl <<
"Removed relations with null pointer" << std::endl;
183 std::cout <<
"Number of relations = " << tab.
size() << std::endl;
184 std::cout << std::endl << location2->
address << std::endl;
187 for (i = pers.begin(); i != pers.end(); i++)
189 std::cout <<
"Name: " << (*i)->getFirst()->name
190 <<
" ssn: " << (*i)->getFirst()->ssn << std::endl;
195 std::cout << std::endl << person2->
name << std::endl;
201 for (i = locs.begin(); i != locs.end(); i++)
203 std::cout <<
"Address: " << (*i)->getSecond()->address << std::endl;
204 std::cout <<
"Floor: " << (*i)->getSecond()->floor << std::endl;
205 std::cout <<
"Dates : " << std::endl;
206 for ( index = 0; index < (*i)->getInfos().size(); index++)
208 std::cout << (*i)->getInfos()[index] << std::endl;
void changeSecond(Relation< T1, T2 > *rel, T2 *pobj)
std::vector< Relation< T1, T2 > * > getRelBySecond(const T2 *pobj) const
void init()
Initialize the internal pointer to an ObjectList of relations.
unsigned long size() const
This method returns the number of relations in the table.
void erase(Relation< T1, T2 > *rel)
bool addRelation(Relation< T1, T2 > *rel)
std::vector< Relation< T1, T2 > * > getRelByFirst(const T1 *pobj) const
void changeFirst(Relation< T1, T2 > *rel, T1 *pobj)
std::ostream & fillStream(std::ostream &s) const
Fill the ASCII output stream.
static const CLID & classID()
virtual const CLID & clID() const
FakeOne(std::string s, int number)
static const CLID & classID()
FakeTwo(std::string add, int fl)
virtual const CLID & clID() const