LibreOffice Module cli_ure (master) 1
cli_bridge.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_CLI_URE_SOURCE_UNO_BRIDGE_CLI_BRIDGE_H
21#define INCLUDED_CLI_URE_SOURCE_UNO_BRIDGE_CLI_BRIDGE_H
22#include <vcclr.h>
23#include "osl/interlck.h"
24#include "uno/mapping.h"
25#include "uno/environment.h"
26#include "uno/dispatcher.h"
27#include "cli_base.h"
28#include "cli_environment.h"
29//#using <cli_uretypes.dll>
30#using <cli_basetypes.dll>
31#using <system.dll>
32
33namespace sr = System::Reflection;
34
35namespace cli_uno
36{
37
38
39// holds environments and mappings
40struct Bridge;
41struct Mapping : public uno_Mapping
42{
44};
45
46// The environment will be created in uno_initEnvironment. See also the remarks there
47//Managed cli environment for cli objects a UNO proxies (which are cli
48//objects. The uno_Environment is not used for cli objects.
49ref struct CliEnvHolder {
50static Cli_environment ^ g_cli_env = nullptr;
51};
52
53
57struct Bridge
58{
59 mutable oslInterlockedCount m_ref;
60 uno_ExtEnvironment * m_uno_env;
62
66
67 ~Bridge();
68 Bridge( uno_Environment * java_env, uno_ExtEnvironment * uno_env, bool registered_java2uno );
69
70 void acquire() const;
71 void release() const;
72
73 void map_to_uno(
74 void * uno_data, System::Object^ cli_data,
75 typelib_TypeDescriptionReference * type,
76 bool assign) const;
77
82 void map_to_cli(
83 System::Object^ *cli_data, void const * uno_data,
84 typelib_TypeDescriptionReference * type, System::Type^ info /* maybe 0 */,
85 bool bDontCreateObj) const;
86
87 System::Object^ map_uno2cli(uno_Interface * pUnoI, typelib_InterfaceTypeDescription* pTD) const;
88
89 System::Object^ call_uno(uno_Interface * pUnoI,
90 typelib_TypeDescription* member_td,
91 typelib_TypeDescriptionReference * return_type,
92 sal_Int32 nParams, typelib_MethodParameter const * pParams,
93 array<System::Object^>^ args, array<System::Type^>^ argTypes,
94 System::Object^* pException) const;
95
96
97 void call_cli(
98 System::Object^ cliI, sr::MethodInfo^ method,
99 typelib_TypeDescriptionReference * return_type,
100 typelib_MethodParameter * params, int nParams,
101 void * uno_ret, void * uno_args [], uno_Any ** uno_exc ) const;
102
103 uno_Interface * map_cli2uno(
104 System::Object^ cliI, typelib_TypeDescription* pTD) const;
105
106};
107
108} //namespace cli_uno
109
110
111#endif
112
113/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _uno_Environment uno_Environment
struct _uno_Mapping uno_Mapping
struct _typelib_TypeDescription typelib_TypeDescription
struct _uno_Any uno_Any
An instance of Bridge represents exactly one mapping therefore either m_cli2uno or m_uno2cli is valid...
Definition: cli_bridge.h:58
Mapping m_cli2uno
Definition: cli_bridge.h:63
System::Object map_uno2cli(uno_Interface *pUnoI, typelib_InterfaceTypeDescription *pTD) const
Definition: cli_data.cxx:63
System::Object call_uno(uno_Interface *pUnoI, typelib_TypeDescription *member_td, typelib_TypeDescriptionReference *return_type, sal_Int32 nParams, typelib_MethodParameter const *pParams, array< System::Object^>^ args, array< System::Type^>^ argTypes, System::Object^ *pException) const
Definition: cli_uno.cxx:41
oslInterlockedCount m_ref
Definition: cli_bridge.h:59
uno_Environment * m_uno_cli_env
Definition: cli_bridge.h:61
Mapping m_uno2cli
Definition: cli_bridge.h:64
Bridge(uno_Environment *java_env, uno_ExtEnvironment *uno_env, bool registered_java2uno)
Definition: cli_bridge.cxx:199
void map_to_uno(void *uno_data, System::Object^ cli_data, typelib_TypeDescriptionReference *type, bool assign) const
Definition: cli_data.cxx:735
void release() const
Definition: cli_bridge.cxx:188
void call_cli(System::Object^ cliI, sr::MethodInfo^ method, typelib_TypeDescriptionReference *return_type, typelib_MethodParameter *params, int nParams, void *uno_ret, void *uno_args[], uno_Any **uno_exc) const
Definition: cli_uno.cxx:198
uno_ExtEnvironment * m_uno_env
Definition: cli_bridge.h:60
uno_Interface * map_cli2uno(System::Object^ cliI, typelib_TypeDescription *pTD) const
Definition: cli_data.cxx:107
void map_to_cli(System::Object^ *cli_data, void const *uno_data, typelib_TypeDescriptionReference *type, System::Type^ info, bool bDontCreateObj) const
Definition: cli_data.cxx:1448
void acquire() const
ToDo I doubt that the case that the ref count raises from 0 to 1 can occur.
Definition: cli_bridge.cxx:169
bool m_registered_cli2uno
Definition: cli_bridge.h:65
static Cli_environment g_cli_env
Definition: cli_bridge.h:50
Bridge * m_bridge
Definition: cli_bridge.h:43