CFx SDK Documentation  2022 SP0
DynamicLinker.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 
25 
26 
27 // DynamicLinker.h: interface for the OdaDynamicLinkerI class.
28 //
30 
31 #if !defined(_ODADYNAMICLINKERI_H_INCLUDED_)
32 #define _ODADYNAMICLINKERI_H_INCLUDED_
33 
34 class OdRxDictionary;
35 class OdRxDLinkerReactor;
36 
37 #include "RxDictionary.h"
38 #include "RxModule.h"
39 
40 class OdRxModule;
45 
46 class OdRxSystemServices;
51 
52 #include "TD_PackPush.h"
53 
72 {
73 public:
75 
80  virtual void addReactor (
81  OdRxDLinkerReactor* pReactor) = 0;
86  virtual void removeReactor (
87  OdRxDLinkerReactor* pReactor) = 0;
88 
99  const OdString& moduleFileName, bool silent = true) = 0;
100 
106  virtual bool unloadModule(
107  const OdString& moduleFileName) = 0;
108 
109 
113  virtual bool unloadUnreferenced() = 0;
114 
123  const OdString& applicationName,
124  bool silent = true) = 0;
125 
132  virtual OdRxSystemServicesPtr sysServices() const = 0;
133 
137  virtual OdRxDictionaryPtr sysRegistry() const = 0;
138 
144  OdRxModule* pModuleObj, bool bSilent = true) = 0;
145 
149  virtual int getModuleCount() const = 0;
150 
155  int index,
156  OdString& key) const = 0;
157 
162  const OdString& key) const = 0;
163 };
164 
169 
170 
175 
176 template <class TClass>
178 {
180  OdRxClass* pClass = ( OdRxClass* )clsdict->getAt( sClassName ).get();
181  if ( pClass )
182  return ( TClass* )pClass->create().get();
183  if ( !sAppName.isEmpty() )
184  {
185  odrxDynamicLinker()->loadApp( sAppName, false );
186  pClass = ( OdRxClass* )clsdict->getAt( sClassName ).get();
187  if ( pClass )
188  return ( TClass* )pClass->create().get();
189  }
190  throw OdError( sClassName + " class was not found" );
191 }
192 
193 inline OdRxModulePtr odrxLoadApp( const OdString& applicationName ) { return odrxDynamicLinker()->loadApp( applicationName ); }
194 
195 inline OdRxModulePtr odrxSafeLoadApp( const OdString& applicationName ) { return odrxDynamicLinker()->loadApp( applicationName, false ); }
196 
197 
198 #include "TD_PackPop.h"
199 
200 #endif // !defined(_ODADYNAMICLINKERI_H_INCLUDED_)
201 
OdSmartPtr< OdRxDynamicLinker > OdRxDynamicLinkerPtr
OdSmartPtr< TClass > odrxSafeCreateObject(const OdString &sClassName, const OdString &sAppName=OdString::kEmpty)
FIRSTDLL_EXPORT OdRxDynamicLinker * odrxDynamicLinker()
OdSmartPtr< OdRxModule > OdRxModulePtr
Definition: DynamicLinker.h:40
OdRxModulePtr odrxSafeLoadApp(const OdString &applicationName)
OdSmartPtr< OdRxSystemServices > OdRxSystemServicesPtr
Definition: DynamicLinker.h:46
OdRxModulePtr odrxLoadApp(const OdString &applicationName)
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
FIRSTDLL_EXPORT OdRxDictionaryPtr odrxClassDictionary()
virtual OdRxObjectPtr create() const =0
virtual OdRxObjectPtr getAt(const OdString &key) const =0
virtual OdRxModule * loadModuleObj(OdRxModule *pModuleObj, bool bSilent=true)=0
virtual bool unloadUnreferenced()=0
virtual int getModuleCount() const =0
virtual OdRxModulePtr loadApp(const OdString &applicationName, bool silent=true)=0
virtual OdRxSystemServicesPtr sysServices() const =0
virtual OdRxModulePtr loadModule(const OdString &moduleFileName, bool silent=true)=0
virtual bool unloadModule(const OdString &moduleFileName)=0
virtual void addReactor(OdRxDLinkerReactor *pReactor)=0
ODRX_DECLARE_MEMBERS(OdRxDynamicLinker)
virtual void removeReactor(OdRxDLinkerReactor *pReactor)=0
virtual OdRxModulePtr getModule(const OdString &key) const =0
virtual OdRxDictionaryPtr sysRegistry() const =0
virtual OdRxModulePtr getModule(int index, OdString &key) const =0
OdRxObject * get()
Definition: RxObject.h:503
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
Definition: OdString.h:98
GLuint index
Definition: gles2_ext.h:265