20#include "Cli_environment.h"
24#include "osl/diagnose.h"
27using namespace System::Runtime::Remoting;
28using namespace System::Runtime::Remoting::Proxies;
29using namespace System::Collections;
30using namespace System::Text;
31using namespace System::Diagnostics;
32using namespace System::Threading;
39 return System::String::Concat(oid,
t->FullName);
45#if OSL_DEBUG_LEVEL >= 2
57#if OSL_DEBUG_LEVEL >= 2
58 OSL_ENSURE(_numRegisteredObjects == 0,
59 "cli uno bridge: CLI environment contains unrevoked objects");
64 System::Object^ obj, System::String^ oid)
66#if OSL_DEBUG_LEVEL >= 1
68 OSL_ASSERT(RemotingServices::IsTransparentProxy(obj));
71 OSL_ASSERT( !
m_objects->ContainsKey(oid));
72 m_objects->Add(oid, gcnew WeakReference(obj));
76 System::Object^ obj, System::String^ oid, System::Type^ type)
78#if OSL_DEBUG_LEVEL >= 1
80 OSL_ASSERT( ! RemotingServices::IsTransparentProxy(obj));
83 System::String^ key =
createKey(oid, type);
85 OSL_ASSERT( !
m_objects->ContainsKey(key));
86 m_objects->Add(key, gcnew WeakReference(obj));
92 System::String^ key =
type !=
nullptr ?
createKey(oid, type) : oid;
93#if OSL_DEBUG_LEVEL >= 1
96#if OSL_DEBUG_LEVEL >= 2
100 Trace::WriteLine(
"cli uno bridge: try to revoke unregistered interface");
101 Trace::WriteLine(oid);
104 Trace::WriteLine(System::String::Format(
105 gcnew System::String(
"cli uno bridge: {0} remaining registered interfaces"),
129 System::WeakReference^ weakIface =
130 static_cast< System::WeakReference ^
>( ret );
131 ret = weakIface->Target;
140 System::String^ oId=
nullptr;
141 RealProxy^ aProxy= RemotingServices::GetRealProxy(obj);
151 StringBuilder ^ buf= gcnew StringBuilder(256);
152 bool bFirst =
new bool(
false);
153 System::Threading::Monitor::Enter(Cli_environment::typeid);
155 buf->Append(
m_IDGen->GetId(obj, bFirst));
158 System::Threading::Monitor::Exit(Cli_environment::typeid);
162 oId= buf->ToString();
static Hashtable m_objects
static System::String createKey(System::String ^ oid, System::Type ^ t)
Object registerInterface(Object ^ obj, System::String ^ oid)
Registers a UNO object as being mapped by this bridge.
int _numRegisteredObjects
void revokeInterface(System::String ^ oid)
By revoking an interface it is declared that the respective interface has not been mapped.
static System::Runtime::Serialization::ObjectIDGenerator m_IDGen
Object getRegisteredInterface(System::String ^ oid, System::Type ^ type)
Retrieves an interface identified by its object id and type from this environment.
static System::String getObjectIdentifier(Object ^ obj)
Generates a worldwide unique object identifier (oid) for the given object.
static System::String sOidPart