Changeset 11014 for code/trunk/src/libraries/core/module/Plugin.cc
- Timestamp:
- Jan 2, 2016, 3:15:04 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/module/Plugin.cc
r10553 r11014 44 44 { 45 45 if (this->moduleInstance_ != NULL) 46 {47 this->referenceCounter_ = 1; // force unloading48 46 this->unload(); 49 }50 47 } 51 48 52 void Plugin:: load()49 void Plugin::reference() 53 50 { 54 51 this->referenceCounter_++; 55 52 if (this->referenceCounter_ == 1) // increased from 0 to 1 -> load plugin 56 { 57 orxout(internal_info) << "Loading plugin " << this->name_ << "..." << endl; 58 this->moduleInstance_ = new ModuleInstance(this->libraryName_); 59 Core::getInstance().loadModule(this->moduleInstance_); 60 } 53 this->load(); 61 54 else 62 55 orxout(internal_info) << "Increased reference count for plugin " << this->name_ << " to " << this->referenceCounter_ << endl; 63 56 } 64 57 65 void Plugin:: unload()58 void Plugin::dereference() 66 59 { 67 60 if (this->referenceCounter_ == 0) … … 73 66 this->referenceCounter_--; 74 67 if (this->referenceCounter_ == 0) // reduced from 1 to 0 -> load plugin 75 { 76 orxout(internal_info) << "Unloading plugin " << this->name_ << "..." << endl; 77 Core::getInstance().unloadModule(this->moduleInstance_); 78 delete this->moduleInstance_; 79 this->moduleInstance_ = NULL; 80 } 68 this->unload(); 81 69 else 82 70 orxout(internal_info) << "Reduced reference count for plugin " << this->name_ << " to " << this->referenceCounter_ << endl; 83 71 } 72 73 void Plugin::load() 74 { 75 orxout(internal_info) << "Loading plugin " << this->name_ << "..." << endl; 76 this->moduleInstance_ = new ModuleInstance(this->libraryName_); 77 Core::getInstance().loadModule(this->moduleInstance_); 78 } 79 80 void Plugin::unload() 81 { 82 orxout(internal_info) << "Unloading plugin " << this->name_ << "..." << endl; 83 Core::getInstance().unloadModule(this->moduleInstance_); 84 delete this->moduleInstance_; 85 this->moduleInstance_ = NULL; 86 } 84 87 }
Note: See TracChangeset
for help on using the changeset viewer.