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
Z39.50 init handler can generate SRU diagnostics.
[metaproxy-moved-to-github.git]
/
src
/
package.cpp
diff --git
a/src/package.cpp
b/src/package.cpp
index
3f99491
..
2b2c84c
100644
(file)
--- a/
src/package.cpp
+++ b/
src/package.cpp
@@
-1,99
+1,114
@@
-/* $Id: package.cpp,v 1.2 2006-01-04 11:19:04 adam Exp $
- Copyright (c) 2005, Index Data.
+/* $Id: package.cpp,v 1.17 2006-09-14 19:53:57 marc Exp $
+ Copyright (c) 2005-2006, Index Data.
-%LICENSE%
+ See the LICENSE file for details
*/
*/
-#include "config.hpp"
+#include "config.hpp"
#include "package.hpp"
#include "package.hpp"
-yp2::Package::Package()
- : m_filter(0), m_router(0), m_data(0)
-{
-}
+#include <iostream>
-yp2::Package::Package(yp2::Session &session, yp2::Origin &origin)
- : m_session(session), m_origin(origin),
- m_filter(0), m_router(0), m_data(0)
+namespace mp = metaproxy_1;
+
+mp::Package::Package()
+ : m_route_pos(0)
{
}
{
}
-yp2::Package & yp2::Package::copy_filter(const Package &p)
+mp::Package::~Package()
{
{
- m_router = p.m_router;
- m_filter = p.m_filter;
- return *this;
+ delete m_route_pos;
}
}
-
-void yp2::Package::move()
+mp::Package::Package(mp::Session &session, const mp::Origin &origin)
+ : m_session(session), m_origin(origin),
+ m_route_pos(0)
{
{
- m_filter = m_router->move(m_filter, this);
- if (m_filter)
- m_filter->process(*this);
}
}
-yp2::Session & yp2::Package::session()
+
+mp::Package & mp::Package::copy_filter(const Package &p)
{
{
- return m_session;
+ delete m_route_pos;
+ m_route_pos = p.m_route_pos->clone();
+ return *this;
}
}
-int yp2::Package::data() const
+void mp::Package::move()
{
{
- return m_data;
+ if (m_route_pos)
+ {
+ const filter::Base *next_filter = m_route_pos->move(0);
+ if (next_filter)
+ next_filter->process(*this);
+ }
}
}
-int & yp2::Package::data()
+void mp::Package::move(std::string route)
{
{
- return m_data;
+ 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);
+ }
}
}
-
-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_filter = 0;
- m_router = &router;
+ m_route_pos = router.createpos();
return *this;
}
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: