projects
/
metaproxy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Unix text.
[metaproxy-moved-to-github.git]
/
src
/
package.cpp
diff --git
a/src/package.cpp
b/src/package.cpp
index
165145f
..
bdbaaaa
100644
(file)
--- a/
src/package.cpp
+++ b/
src/package.cpp
@@
-1,105
+1,125
@@
-/* $Id: package.cpp,v 1.5 2006-01-09 13:53:13 adam Exp $
- Copyright (c) 2005, Index Data.
+/* This file is part of Metaproxy.
+ Copyright (C) 2005-2008 Index Data
-%LICENSE%
- */
+Metaproxy is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
-#include "config.hpp"
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "config.hpp"
#include "package.hpp"
#include "package.hpp"
-yp2::Package::Package()
- : m_route_pos(0), m_data(0)
+#include <iostream>
+
+namespace mp = metaproxy_1;
+
+mp::Package::Package()
+ : m_route_pos(0)
{
}
{
}
-yp2::Package::~Package()
+mp::Package::~Package()
{
delete m_route_pos;
}
{
delete m_route_pos;
}
-yp2::Package::Package(yp2::Session &session, yp2::Origin &origin)
+mp::Package::Package(mp::Session &session, const mp::Origin &origin)
: m_session(session), m_origin(origin),
: m_session(session), m_origin(origin),
- m_route_pos(0), m_data(0)
+ m_route_pos(0)
{
}
{
}
-yp2::Package & yp2::Package::copy_filter(const Package &p)
+
+mp::Package & mp::Package::copy_filter(const Package &p)
{
{
+ delete m_route_pos;
m_route_pos = p.m_route_pos->clone();
return *this;
}
m_route_pos = p.m_route_pos->clone();
return *this;
}
-void yp2::Package::move()
+void mp::Package::move()
{
if (m_route_pos)
{
{
if (m_route_pos)
{
- const filter::Base *next_filter = m_route_pos->move();
+ const filter::Base *next_filter = m_route_pos->move(0);
if (next_filter)
next_filter->process(*this);
}
}
if (next_filter)
next_filter->process(*this);
}
}
-yp2::Session & yp2::Package::session()
+void mp::Package::move(std::string route)
{
{
- return m_session;
+ if (m_route_pos)
+ {
+ const char *r_cstr = route.length() ? route.c_str() : 0;
+ const filter::Base *next_filter = m_route_pos->move(r_cstr);
+ if (next_filter)
+ next_filter->process(*this);
+ }
}
}
-int yp2::Package::data() const
-{
- return m_data;
-}
-
-int & yp2::Package::data()
-{
- return m_data;
-}
-
-yp2::Package & yp2::Package::data(const int & data)
+mp::Session & mp::Package::session()
{
{
- m_data = data;
- return *this;
+ return m_session;
}
}
-yp2::Origin yp2::Package::origin() const
+mp::Origin mp::Package::origin() const
{
return m_origin;
}
{
return m_origin;
}
-yp2::Origin & yp2::Package::origin()
+mp::Origin & mp::Package::origin()
{
return m_origin;
}
{
return m_origin;
}
-yp2::Package & yp2::Package::origin(const Origin & origin)
+mp::Package & mp::Package::origin(const Origin & origin)
{
m_origin = origin;
return *this;
}
{
m_origin = origin;
return *this;
}
-yp2::Package & yp2::Package::router(const yp2::Router &router)
+mp::Package & mp::Package::router(const mp::Router &router)
{
m_route_pos = router.createpos();
return *this;
}
{
m_route_pos = router.createpos();
return *this;
}
-yazpp_1::GDU &yp2::Package::request()
+yazpp_1::GDU &mp::Package::request()
{
return m_request_gdu;
}
{
return m_request_gdu;
}
-yazpp_1::GDU &yp2::Package::response()
+yazpp_1::GDU &mp::Package::response()
{
return m_response_gdu;
}
{
return m_response_gdu;
}
-yp2::Session yp2::Package::session() const
+mp::Session mp::Package::session() const
{
return m_session;
}
{
return m_session;
}
+
+std::ostream& std::operator<<(std::ostream& os, mp::Package& p)
+{
+ os << p.origin() << " ";
+ os << p.session().id();
+ return os;
+}
+
/*
* Local variables:
/*
* Local variables: