(file) Return to DynamicLibrary.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 karl  1.15 //%2006////////////////////////////////////////////////////////////////////////
  2 chip  1.1  //
  3 karl  1.9  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 karl  1.5  // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.9  // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.10 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.15 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 chip  1.1  //
 14            // Permission is hereby granted, free of charge, to any person obtaining a copy
 15            // of this software and associated documentation files (the "Software"), to
 16            // deal in the Software without restriction, including without limitation the
 17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18            // sell copies of the Software, and to permit persons to whom the Software is
 19            // furnished to do so, subject to the following conditions:
 20 karl  1.9  // 
 21 chip  1.1  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29            //
 30            //==============================================================================
 31            //
 32            // Author: Chip Vincent (cvincent@us.ibm.com)
 33            //
 34            // Modified By:
 35 gs.keenan 1.11 //	Sean Keenan, Hewlett Packard Company <sean.keenan@hp.com>
 36 chip      1.1  //
 37                //%/////////////////////////////////////////////////////////////////////////////
 38                
 39                #include "DynamicLibrary.h"
 40                
 41 chip      1.4  #include <Pegasus/Common/InternalException.h>
 42 chip      1.1  
 43                #if defined(PEGASUS_OS_TYPE_WINDOWS)
 44                # include "DynamicLibraryWindows.cpp"
 45 mateus.baur 1.14 #elif defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_HPUX_USE_DLOPEN)
 46 kumpf       1.13 # include "DynamicLibraryHPUX.cpp"
 47                  #elif defined(PEGASUS_OS_TYPE_UNIX)
 48 chip        1.1  # include "DynamicLibraryUnix.cpp"
 49 gs.keenan   1.11 #elif defined(PEGASUS_OS_VMS)
 50                  # include "DynamicLibraryVms.cpp"
 51 chip        1.1  #else
 52                  # error "Unsupported platform"
 53                  #endif
 54                  
 55                  PEGASUS_NAMESPACE_BEGIN
 56                  
 57 chip        1.3  DynamicLibrary::DynamicLibrary(void) : _handle(0)
 58                  {
 59                  }
 60                  
 61                  DynamicLibrary::DynamicLibrary(const DynamicLibrary & library) : _handle(0)
 62                  {
 63                      _fileName = library._fileName;
 64                  
 65                      // load the module again, if necessary. this effectively increments the
 66                      // operating system's reference count for the module.
 67 chip        1.6      if(library.isLoaded())
 68 chip        1.3      {
 69                          load();
 70                      }
 71                  }
 72                  
 73                  DynamicLibrary::DynamicLibrary(const String & fileName) : _fileName(fileName), _handle(0)
 74                  {
 75                  }
 76                  
 77                  DynamicLibrary::~DynamicLibrary(void)
 78                  {
 79                      // unload the module, if necessary. this ensures 1) the module is released in the
 80                      // event the caller did not explicity unload it, and 2) the operating system's
 81                      // reference count is accurate.
 82 chip        1.6      if(isLoaded())
 83 chip        1.3      {
 84                          unload();
 85                      }
 86                  }
 87                  
 88                  DynamicLibrary & DynamicLibrary::operator=(const DynamicLibrary & library)
 89                  {
 90 chip        1.8      //cout << "DynamicLibrary::operator=(const DynamicLibrary &)" << endl;
 91 chip        1.7  
 92 chip        1.3      if(this == &library)
 93                      {
 94                          return(*this);
 95                      }
 96                  
 97 chip        1.4      if(isLoaded())
 98                      {
 99                          unload();
100                      }
101                  
102 chip        1.3      _fileName = library._fileName;
103                  
104                      // load the module again, if necessary. this effectively increments the
105                      // operating system's reference count for the module.
106 chip        1.4      if(library.isLoaded())
107 chip        1.3      {
108                          load();
109                      }
110                  
111                      return(*this);
112                  }
113                  
114                  String DynamicLibrary::getFileName(void) const
115                  {
116                      return(_fileName);
117                  }
118                  
119                  DynamicLibrary::LIBRARY_HANDLE DynamicLibrary::getHandle(void) const
120                  {
121                      return(_handle);
122                  }
123                  
124 chip        1.1  PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2