summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-11-14 18:22:36 +0000
committerMarc Laukien <marc@zeroc.com>2002-11-14 18:22:36 +0000
commite70e616c1e5ee66760ad268f15aa58d11ffc48e1 (patch)
treecbee66ac2ac42cf3eda54e0f88e7861a0056c77e /cpp/src
parentproject file fix (diff)
downloadice-e70e616c1e5ee66760ad268f15aa58d11ffc48e1.tar.bz2
ice-e70e616c1e5ee66760ad268f15aa58d11ffc48e1.tar.xz
ice-e70e616c1e5ee66760ad268f15aa58d11ffc48e1.zip
added proxy comparison functions
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Proxy.cpp78
-rw-r--r--cpp/src/Ice/Reference.cpp10
-rw-r--r--cpp/src/Ice/Reference.h6
3 files changed, 78 insertions, 16 deletions
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index ee571f900c5..a64909c6254 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -226,7 +226,7 @@ IceProxy::Ice::Object::ice_id(const Context& __context)
}
}
-vector<string>
+FacetPath
IceProxy::Ice::Object::ice_facets(const Context& __context)
{
int __cnt = 0;
@@ -311,14 +311,14 @@ IceProxy::Ice::Object::ice_newIdentity(const Identity& newIdentity) const
}
}
-vector<string>
+FacetPath
IceProxy::Ice::Object::ice_getFacet() const
{
return _reference->facet;
}
ObjectPrx
-IceProxy::Ice::Object::ice_newFacet(const vector<string>& newFacet) const
+IceProxy::Ice::Object::ice_newFacet(const FacetPath& newFacet) const
{
if(newFacet == _reference->facet)
{
@@ -335,7 +335,7 @@ IceProxy::Ice::Object::ice_newFacet(const vector<string>& newFacet) const
ObjectPrx
IceProxy::Ice::Object::ice_appendFacet(const string& f) const
{
- vector<string> newFacet = _reference->facet;
+ FacetPath newFacet = _reference->facet;
newFacet.push_back(f);
ObjectPrx proxy(new ::IceProxy::Ice::Object());
proxy->setup(_reference->changeFacet(newFacet));
@@ -804,7 +804,7 @@ IceDelegateM::Ice::Object::ice_id(const Context& __context)
return __ret;
}
-vector<string>
+FacetPath
IceDelegateM::Ice::Object::ice_facets(const Context& __context)
{
static const string __operation("ice_facets");
@@ -814,7 +814,7 @@ IceDelegateM::Ice::Object::ice_facets(const Context& __context)
{
throw ::Ice::UnknownUserException(__FILE__, __LINE__);
}
- vector<string> __ret;
+ FacetPath __ret;
__is->read(__ret);
return __ret;
}
@@ -1110,7 +1110,7 @@ IceDelegateD::Ice::Object::ice_id(const ::Ice::Context& __context)
return false; // To keep the Visual C++ compiler happy.
}
-vector<string>
+FacetPath
IceDelegateD::Ice::Object::ice_facets(const ::Ice::Context& __context)
{
Current __current;
@@ -1120,7 +1120,7 @@ IceDelegateD::Ice::Object::ice_facets(const ::Ice::Context& __context)
Direct __direct(__current);
return __direct.facetServant()->ice_facets(__current);
}
- return vector<string>(); // To keep the Visual C++ compiler happy.
+ return FacetPath(); // To keep the Visual C++ compiler happy.
}
bool
@@ -1194,3 +1194,65 @@ IceDelegateD::Ice::Object::setup(const ReferencePtr& ref, const ObjectAdapterPtr
__reference = ref;
__adapter = adapter;
}
+
+bool
+Ice::proxyIdentityLess(const ObjectPrx& lhs, const ObjectPrx& rhs)
+{
+ return lhs->ice_getIdentity() < rhs->ice_getIdentity();
+}
+
+bool
+Ice::proxyIdentityEqual(const ObjectPrx& lhs, const ObjectPrx& rhs)
+{
+ return lhs->ice_getIdentity() == rhs->ice_getIdentity();
+}
+
+bool
+Ice::proxyIdentityAndFacetLess(const ObjectPrx& lhs, const ObjectPrx& rhs)
+{
+ Identity lhsIdentity = lhs->ice_getIdentity();
+ Identity rhsIdentity = rhs->ice_getIdentity();
+
+ if(lhsIdentity < rhsIdentity)
+ {
+ return true;
+ }
+ else if(rhsIdentity < lhsIdentity)
+ {
+ return false;
+ }
+
+ FacetPath lhsFacet = lhs->ice_getFacet();
+ FacetPath rhsFacet = rhs->ice_getFacet();
+
+ if(lhsFacet < rhsFacet)
+ {
+ return true;
+ }
+ else if(rhsFacet < lhsFacet)
+ {
+ return false;
+ }
+
+ return false;
+}
+
+bool
+Ice::proxyIdentityAndFacetEqual(const ObjectPrx& lhs, const ObjectPrx& rhs)
+{
+ Identity lhsIdentity = lhs->ice_getIdentity();
+ Identity rhsIdentity = rhs->ice_getIdentity();
+
+ if(lhsIdentity == rhsIdentity)
+ {
+ FacetPath lhsFacet = lhs->ice_getFacet();
+ FacetPath rhsFacet = rhs->ice_getFacet();
+
+ if(lhsFacet == rhsFacet)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index ce7280b1014..53543719ae4 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -258,7 +258,7 @@ IceInternal::Reference::toString() const
if(!facet.empty())
{
ostringstream f;
- vector<string>::const_iterator p = facet.begin();
+ FacetPath::const_iterator p = facet.begin();
while(p != facet.end())
{
f << encodeString(*p++, "/");
@@ -376,7 +376,7 @@ IceInternal::Reference::changeIdentity(const Identity& newIdentity) const
}
ReferencePtr
-IceInternal::Reference::changeFacet(const vector<string>& newFacet) const
+IceInternal::Reference::changeFacet(const FacetPath& newFacet) const
{
if(newFacet == facet)
{
@@ -546,13 +546,13 @@ IceInternal::Reference::changeDefault() const
RouterInfoPtr routerInfo = instance->routerManager()->get(instance->referenceFactory()->getDefaultRouter());
LocatorInfoPtr locatorInfo = instance->locatorManager()->get(instance->referenceFactory()->getDefaultLocator());
- return instance->referenceFactory()->create(identity, vector<string>(), ModeTwoway, false, false, adapterId,
+ return instance->referenceFactory()->create(identity, FacetPath(), ModeTwoway, false, false, adapterId,
endpoints, routerInfo, locatorInfo, 0);
}
IceInternal::Reference::Reference(const InstancePtr& inst,
const Identity& ident,
- const vector<string>& facPath,
+ const FacetPath& facPath,
Mode md,
bool sec,
bool com,
@@ -582,7 +582,7 @@ IceInternal::Reference::Reference(const InstancePtr& inst,
Int h = 0;
string::const_iterator p;
- vector<string>::const_iterator q;
+ FacetPath::const_iterator q;
for(p = identity.name.begin(); p != identity.name.end(); ++p)
{
diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h
index 374de6716bc..a79ed7b5dd5 100644
--- a/cpp/src/Ice/Reference.h
+++ b/cpp/src/Ice/Reference.h
@@ -65,7 +65,7 @@ public:
//
const InstancePtr instance;
const Ice::Identity identity;
- const std::vector<std::string> facet;
+ const Ice::FacetPath facet;
const Mode mode;
const bool secure;
const bool compress;
@@ -81,7 +81,7 @@ public:
// certain values.
//
ReferencePtr changeIdentity(const Ice::Identity&) const;
- ReferencePtr changeFacet(const std::vector<std::string>&) const;
+ ReferencePtr changeFacet(const Ice::FacetPath&) const;
ReferencePtr changeTimeout(int) const;
ReferencePtr changeMode(Mode) const;
ReferencePtr changeSecure(bool) const;
@@ -94,7 +94,7 @@ public:
private:
- Reference(const InstancePtr&, const Ice::Identity&, const std::vector<std::string>&, Mode, bool, bool,
+ Reference(const InstancePtr&, const Ice::Identity&, const Ice::FacetPath&, Mode, bool, bool,
const std::string&, const std::vector<EndpointPtr>&,
const RouterInfoPtr&, const LocatorInfoPtr&,
const Ice::ObjectAdapterPtr&);