summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Object.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2001-10-18 15:34:32 +0000
committerMarc Laukien <marc@zeroc.com>2001-10-18 15:34:32 +0000
commit6f32b305b09f6b975db8f6626e851e4104e3c88e (patch)
tree1f2c1df0c066433b412b7bc16a7db00611efee93 /cpp/src/Ice/Object.cpp
parentwin fixes (diff)
downloadice-6f32b305b09f6b975db8f6626e851e4104e3c88e.tar.bz2
ice-6f32b305b09f6b975db8f6626e851e4104e3c88e.tar.xz
ice-6f32b305b09f6b975db8f6626e851e4104e3c88e.zip
more facet stuff
Diffstat (limited to 'cpp/src/Ice/Object.cpp')
-rw-r--r--cpp/src/Ice/Object.cpp108
1 files changed, 76 insertions, 32 deletions
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp
index 7549ddbc793..e2458e9ac89 100644
--- a/cpp/src/Ice/Object.cpp
+++ b/cpp/src/Ice/Object.cpp
@@ -28,26 +28,12 @@ Ice::LocationForward::LocationForward(const ObjectPrx& p) :
{
}
-Ice::Object::Object()
-{
-}
-
-Ice::Object::~Object()
-{
-}
-
bool
Ice::Object::_isA(const string& s)
{
return s == "::Ice::Object";
}
-bool
-Ice::Object::_hasFacet(const string& s)
-{
- return false; // TODO
-}
-
void
Ice::Object::_ping()
{
@@ -67,18 +53,6 @@ Ice::Object::____isA(Incoming& __in)
}
DispatchStatus
-Ice::Object::____hasFacet(Incoming& __in)
-{
- BasicStream* __is = __in.is();
- BasicStream* __os = __in.os();
- string s;
- __is->read(s);
- bool __ret = _hasFacet(s);
- __os->write(__ret);
- return DispatchOK;
-}
-
-DispatchStatus
Ice::Object::____ping(Incoming&)
{
_ping();
@@ -87,7 +61,6 @@ Ice::Object::____ping(Incoming&)
const char* Ice::Object::__all[] =
{
- "_hasFacet"
"_isA"
"_ping"
};
@@ -107,13 +80,9 @@ Ice::Object::__dispatch(Incoming& in, const string& s)
{
case 0:
{
- return ____hasFacet(in);
- }
- case 1:
- {
return ____isA(in);
}
- case 2:
+ case 1:
{
return ____ping(in);
}
@@ -132,3 +101,78 @@ Ice::Object::__isMutating(const std::string& s)
//
return false;
}
+
+void
+Ice::Object::_addFacet(const ObjectPtr& facet, const string& name)
+{
+ JTCSyncT<JTCMutex> sync(_activeFacetMapMutex);
+
+ _activeFacetMapHint = _activeFacetMap.insert(_activeFacetMapHint, make_pair(name, facet));
+}
+
+void
+Ice::Object::_removeFacet(const string& name)
+{
+ JTCSyncT<JTCMutex> sync(_activeFacetMapMutex);
+
+ map<string, ObjectPtr>::iterator p = _activeFacetMap.end();
+
+ if (_activeFacetMapHint != _activeFacetMap.end())
+ {
+ if (_activeFacetMapHint->first == name)
+ {
+ p = _activeFacetMapHint;
+ }
+ }
+
+ if (p == _activeFacetMap.end())
+ {
+ p = _activeFacetMap.find(name);
+ }
+
+ if (p != _activeFacetMap.end())
+ {
+ _activeFacetMap.erase(p);
+ _activeFacetMapHint = _activeFacetMap.end();
+ }
+}
+
+void
+Ice::Object::_removeAllFacets(const string& name)
+{
+ JTCSyncT<JTCMutex> sync(_activeFacetMapMutex);
+
+ _activeFacetMap.clear();
+ _activeFacetMapHint = _activeFacetMap.end();
+}
+
+ObjectPtr
+Ice::Object::_findFacet(const string& name)
+{
+ JTCSyncT<JTCMutex> sync(_activeFacetMapMutex);
+
+ map<string, ObjectPtr>::iterator p = _activeFacetMap.end();
+
+ if (_activeFacetMapHint != _activeFacetMap.end())
+ {
+ if (_activeFacetMapHint->first == name)
+ {
+ p = _activeFacetMapHint;
+ }
+ }
+
+ if (p == _activeFacetMap.end())
+ {
+ p = _activeFacetMap.find(name);
+ }
+
+ if (p != _activeFacetMap.end())
+ {
+ _activeFacetMapHint = p;
+ return p->second;
+ }
+ else
+ {
+ return 0;
+ }
+}