diff options
author | Matthew Newhook <matthew@zeroc.com> | 2002-07-17 20:10:41 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2002-07-17 20:10:41 +0000 |
commit | f7965adf013cb576a3d2cd0f05e2731ab10b4f8d (patch) | |
tree | e820b257dbb0d7fb653961124d1a27da86751b96 /cpp/src/Yellow/QueryI.cpp | |
parent | Have added new capabilities to Glacier to adjust the issued time to allow (diff) | |
download | ice-f7965adf013cb576a3d2cd0f05e2731ab10b4f8d.tar.bz2 ice-f7965adf013cb576a3d2cd0f05e2731ab10b4f8d.tar.xz ice-f7965adf013cb576a3d2cd0f05e2731ab10b4f8d.zip |
Added Yellow implementation.
Diffstat (limited to 'cpp/src/Yellow/QueryI.cpp')
-rw-r--r-- | cpp/src/Yellow/QueryI.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/cpp/src/Yellow/QueryI.cpp b/cpp/src/Yellow/QueryI.cpp new file mode 100644 index 00000000000..82f1ebfd700 --- /dev/null +++ b/cpp/src/Yellow/QueryI.cpp @@ -0,0 +1,45 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Yellow/QueryI.h> + +using namespace std; +using namespace Ice; +using namespace Yellow; +using namespace Freeze; + +Yellow::QueryI::QueryI(const DBPtr& db) : + _dict(db) +{ +} + +ObjectPrx +Yellow::QueryI::lookup(const string& intf, const Current&) +{ + StringObjectProxySeqDict::const_iterator p = _dict.find(intf); + if(p == _dict.end()) + { + throw NoSuchOfferException(); + } + + int r = rand() % p->second.size(); + return p->second[r]; +} + +ObjectProxySeq +Yellow::QueryI::lookupAll(const string& intf, const Current&) +{ + StringObjectProxySeqDict::const_iterator p = _dict.find(intf); + if(p == _dict.end()) + { + throw NoSuchOfferException(); + } + return p->second; +} |