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
Fix various link to reference. Added partinfo element for reference
[metaproxy-moved-to-github.git]
/
src
/
package.hpp
diff --git
a/src/package.hpp
b/src/package.hpp
index
014bfeb
..
bbefb39
100644
(file)
--- a/
src/package.hpp
+++ b/
src/package.hpp
@@
-1,126
+1,94
@@
+/* $Id: package.hpp,v 1.25 2006-09-26 13:02:50 marc Exp $
+ Copyright (c) 2005-2006, Index Data.
-#ifndef PACKAGE_HPP
-#define PACKAGE_HPP
+ See the LICENSE file for details
+ */
+
+#ifndef YP2_PACKAGE_HPP
+#define YP2_PACKAGE_HPP
-#include <iostream>
-#include <stdexcept>
-#include <yaz++/gdu.h>
+#include <iosfwd>
+
+#include <yazpp/gdu.h>
#include "router.hpp"
#include "filter.hpp"
#include "session.hpp"
#include "router.hpp"
#include "filter.hpp"
#include "session.hpp"
+#include "origin.hpp"
+
+namespace metaproxy_1 {
+ class Package;
+}
+
+
+namespace std
+{
+ std::ostream& operator<<(std::ostream& os, metaproxy_1::Package& p);
+}
+
+namespace metaproxy_1 {
-namespace yp2 {
-
- class Origin {
- enum origin_t {
- API,
- UNIX,
- TCPIP
- } type;
- std::string address; // UNIX+TCPIP
- int port; // TCPIP only
- public:
- Origin() : type(API) {};
- };
-
class Package {
public:
class Package {
public:
+ Package();
+
+ ~Package();
- Package(yp2::Session &session, yp2::Origin &origin)
- : m_session(session), m_origin(origin),
- m_filter(0), m_router(0), m_data(0) {}
+ Package(metaproxy_1::Session &session,
+ const metaproxy_1::Origin &origin);
- Package & copy_filter(const Package &p) {
- m_router = p.m_router;
- m_filter = p.m_filter;
- return *this;
- }
+ /// shallow copy constructor which only copies the filter chain info
+ Package & copy_filter(const Package &p);
/// send Package to it's next Filter defined in Router
/// send Package to it's next Filter defined in Router
- Package & move() {
- m_filter = m_router->move(m_filter, this);
- if (m_filter)
- return m_filter->process(*this);
- else
- return *this;
- }
+ void move();
+
+ /// send Package to other route
+ void move(std::string route);
/// access session - left val in assignment
/// access session - left val in assignment
- yp2::Session & session() {
- return m_session;
- }
+ metaproxy_1::Session & session();
/// get function - right val in assignment
/// get function - right val in assignment
- unsigned int data() const {
- return m_data;
- }
+ Origin origin() const;
/// set function - left val in assignment
/// set function - left val in assignment
- unsigned int & data() {
- return m_data;
- }
+ Origin & origin();
/// set function - can be chained
/// set function - can be chained
- Package & data(const unsigned int & data){
- m_data = data;
- return *this;
- }
-
-
- /// get function - right val in assignment
- Origin origin() const {
- return m_origin;
- }
-
- /// set function - left val in assignment
- Origin & origin() {
- return m_origin;
- }
-
+ Package & origin(const Origin & origin);
+
/// set function - can be chained
/// set function - can be chained
- Package & origin(const Origin & origin){
- m_origin = origin;
- return *this;
- }
-
- Package & router(const Router &router){
- m_filter = 0;
- m_router = &router;
- return *this;
- }
-
- yazpp_1::GDU &request() {
- return m_request_gdu;
- }
-
- yazpp_1::GDU &response() {
- return m_response_gdu;
- }
+ Package & router(const Router &router);
+
+ yazpp_1::GDU &request();
+
+ yazpp_1::GDU &response();
/// get function - right val in assignment
/// get function - right val in assignment
- Session session() const {
- return m_session;
- }
+ Session session() const;
private:
Session m_session;
Origin m_origin;
private:
Session m_session;
Origin m_origin;
-
- const Filter *m_filter;
- const Router *m_router;
- unsigned int m_data;
+
+ RoutePos *m_route_pos;
+
+ //int m_data;
yazpp_1::GDU m_request_gdu;
yazpp_1::GDU m_response_gdu;
};
}
yazpp_1::GDU m_request_gdu;
yazpp_1::GDU m_response_gdu;
};
}
+
+
#endif
/*
* Local variables:
* c-basic-offset: 4
* indent-tabs-mode: nil
#endif
/*
* Local variables:
* c-basic-offset: 4
* indent-tabs-mode: nil
+ * c-file-style: "stroustrup"
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/