|
reSIProcate/rutil
9694
|
#include <ostream>#include <vector>#include <set>#include <map>#include <list>#include "rutil/resipfaststreams.hxx"#include "rutil/Inserter.hxx"#include "rutil/Data.hxx"
Go to the source code of this file.
Classes | |
| class | Foo |
Functions | |
| HashValue (Foo) | |
| HashValueImp (Foo, data.value.hash()) | |
| EncodeStream & | operator<< (EncodeStream &str, const Foo &foo) |
| int | main (int argc, char **argv) |
| HashValue | ( | Foo | ) |
| HashValueImp | ( | Foo | , |
| data.value. | hash() | ||
| ) |
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Definition at line 62 of file testInserter.cxx.
References resip::Inserter(), resip::InserterP(), resip::IntrusiveListElement< P >::push_back(), and resipCerr.
{
resipCerr << "Inserter tests..." << endl;
{
resipCerr << Inserter(Foo(0, "null")) << endl;
}
{
vector<Foo> container;
container.push_back(Foo(1, "foo"));
container.push_back(Foo(2, "bar"));
container.push_back(Foo(3, "baz"));
resipCerr << Inserter(container) << endl;
}
{
set<Foo> container;
container.insert(Foo(1, "foo"));
container.insert(Foo(2, "bar"));
container.insert(Foo(3, "baz"));
resipCerr << Inserter(container) << endl;
}
{
map<int, Foo> container;
container[1] = Foo(1, "foo");
container[2] = Foo(2, "bar");
container[3] = Foo(3, "baz");
resipCerr << Inserter(container) << endl;
}
{
HashMap<int, Foo> container;
container[1] = Foo(1, "foo");
container[2] = Foo(2, "bar");
container[3] = Foo(3, "baz");
resipCerr << Inserter(container) << endl;
}
{
HashSet<Foo> container;
container.insert(Foo(1, "foo"));
container.insert(Foo(2, "bar"));
container.insert(Foo(3, "baz"));
resipCerr << Inserter(container) << endl;
}
resipCerr << "InserterP tests..." << endl;
{
Foo *foo = new Foo(0, "null");
resipCerr << InserterP(foo) << endl;
delete foo;
}
{
vector<Foo*> container;
container.push_back(new Foo(1, "foo"));
container.push_back(new Foo(2, "bar"));
container.push_back(new Foo(3, "baz"));
resipCerr << InserterP(container) << endl;
// cleanup
vector<Foo*>::iterator it = container.begin();
for(;it!=container.end(); it++)
{
delete *it;
}
}
{
set<Foo*> container;
container.insert(new Foo(1, "foo"));
container.insert(new Foo(2, "bar"));
container.insert(new Foo(3, "baz"));
resipCerr << InserterP(container) << endl;
// cleanup
set<Foo*>::iterator it = container.begin();
for(;it!=container.end(); it++)
{
delete *it;
}
}
{
map<int, Foo*> container;
container[1] = new Foo(1, "foo");
container[2] = new Foo(2, "bar");
container[3] = new Foo(3, "baz");
resipCerr << InserterP(container) << endl;
// cleanup
map<int, Foo*>::iterator it = container.begin();
for(;it!=container.end(); it++)
{
delete it->second;
}
}
{
HashMap<int, Foo*> container;
container[1] = new Foo(1, "foo");
container[2] = new Foo(2, "bar");
container[3] = new Foo(3, "baz");
resipCerr << InserterP(container) << endl;
// cleanup
HashMap<int, Foo*>::iterator it = container.begin();
for(;it!=container.end(); it++)
{
delete it->second;
}
}
{
HashSet<Foo*> container;
container.insert(new Foo(1, "foo"));
container.insert(new Foo(2, "bar"));
container.insert(new Foo(3, "baz"));
resipCerr << InserterP(container) << endl;
// cleanup
HashSet<Foo*>::iterator it = container.begin();
for(;it!=container.end(); it++)
{
delete *it;
}
}
resipCerr << "All Ok" << endl;
}

| EncodeStream& operator<< | ( | EncodeStream & | str, |
| const Foo & | foo | ||
| ) |
Definition at line 55 of file testInserter.cxx.
References Foo::count, and Foo::value.
1.7.5.1