CFx SDK Documentation  2020SP3
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 
FIRSTDLL_EXPORT
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
OdString
Definition: OdString.h:95
odrxDynamicLinker
FIRSTDLL_EXPORT OdRxDynamicLinker * odrxDynamicLinker()
odrxLoadApp
OdRxModulePtr odrxLoadApp(const OdString &applicationName)
Definition: DynamicLinker.h:193
RxModule.h
OdRxModulePtr
OdSmartPtr< OdRxModule > OdRxModulePtr
Definition: DynamicLinker.h:40
OdRxSystemServicesPtr
OdSmartPtr< OdRxSystemServices > OdRxSystemServicesPtr
Definition: DynamicLinker.h:46
OdRxObject
Definition: RxObject.h:564
OdRxDynamicLinker::unloadUnreferenced
virtual bool unloadUnreferenced()=0
OdRxDynamicLinker::removeReactor
virtual void removeReactor(OdRxDLinkerReactor *pReactor)=0
TD_PackPop.h
OdRxObjectPtr::get
OdRxObject * get()
Definition: RxObject.h:503
OdRxDynamicLinker::loadModuleObj
virtual OdRxModule * loadModuleObj(OdRxModule *pModuleObj, bool bSilent=true)=0
index
GLuint index
Definition: gles2_ext.h:265
OdRxDynamicLinker::getModuleCount
virtual int getModuleCount() const =0
OdRxClass
Definition: RxObject.h:865
OdRxDynamicLinker::getModule
virtual OdRxModulePtr getModule(const OdString &key) const =0
OdRxDictionary::getAt
virtual OdRxObjectPtr getAt(const OdString &key) const =0
OdRxDynamicLinker::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdRxDynamicLinker)
OdRxDynamicLinker::loadModule
virtual OdRxModulePtr loadModule(const OdString &moduleFileName, bool silent=true)=0
OdSmartPtr
Definition: SmartPtr.h:58
OdRxDynamicLinker::unloadModule
virtual bool unloadModule(const OdString &moduleFileName)=0
OdRxDynamicLinker
Definition: DynamicLinker.h:72
OdRxDictionary
Definition: RxDictionary.h:114
TD_PackPush.h
OdRxDynamicLinker::loadApp
virtual OdRxModulePtr loadApp(const OdString &applicationName, bool silent=true)=0
OdRxDynamicLinker::sysRegistry
virtual OdRxDictionaryPtr sysRegistry() const =0
OdRxDLinkerReactor
Definition: RxDLinkerReactor.h:52
odrxSafeCreateObject
OdSmartPtr< TClass > odrxSafeCreateObject(const OdString &sClassName, const OdString &sAppName=OdString::kEmpty)
Definition: DynamicLinker.h:177
OdRxDynamicLinkerPtr
OdSmartPtr< OdRxDynamicLinker > OdRxDynamicLinkerPtr
Definition: DynamicLinker.h:168
odrxClassDictionary
FIRSTDLL_EXPORT OdRxDictionaryPtr odrxClassDictionary()
OdError
Definition: OdError.h:43
OdRxModule
Definition: RxModule.h:45
OdRxClass::create
virtual OdRxObjectPtr create() const =0
OdString::kEmpty
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
Definition: OdString.h:98
odrxSafeLoadApp
OdRxModulePtr odrxSafeLoadApp(const OdString &applicationName)
Definition: DynamicLinker.h:195
RxDictionary.h
OdRxDynamicLinker::sysServices
virtual OdRxSystemServicesPtr sysServices() const =0
OdRxSystemServices
Definition: RxSystemServices.h:180
OdRxDynamicLinker::getModule
virtual OdRxModulePtr getModule(int index, OdString &key) const =0
OdRxDynamicLinker::addReactor
virtual void addReactor(OdRxDLinkerReactor *pReactor)=0