ctkBinaryFileDescriptor.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. All rights reserved.
  5. Distributed under a BSD License. See LICENSE.txt file.
  6. This software is distributed "AS IS" WITHOUT ANY WARRANTY; without even
  7. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the above copyright notice for more information.
  9. =========================================================================*/
  10. /*=auto=========================================================================
  11. Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH)
  12. All Rights Reserved.
  13. See Doc/copyright/copyright.txt
  14. or http://www.slicer.org/copyright/copyright.txt for details.
  15. Program: Module Description Parser
  16. =========================================================================auto=*/
  17. #ifndef __ctkBinaryFileDescriptor_h
  18. #define __ctkBinaryFileDescriptor_h
  19. // Qt includes
  20. #include <QString>
  21. // CTK includes
  22. #include "ctkPimpl.h"
  23. #include "CTKWidgetsExport.h"
  24. /// Allows to resolve global symbols contained into an executable.
  25. /// Implementation valid only for unix-like systems (Linux, Mac, ...)
  26. class ctkBinaryFileDescriptorPrivate;
  27. class CTK_WIDGETS_EXPORT ctkBinaryFileDescriptor
  28. {
  29. public:
  30. ctkBinaryFileDescriptor();
  31. ctkBinaryFileDescriptor(const QString& _fileName);
  32. virtual ~ctkBinaryFileDescriptor();
  33. QString fileName()const;
  34. void setFileName(const QString& _fileName);
  35. /// Load the object file containing the symbols
  36. bool load();
  37. /// Unload / close the object file
  38. bool unload();
  39. bool isLoaded() const;
  40. /// Get the address of a symbol in memory
  41. void* resolve(const char * symbol);
  42. private:
  43. CTK_DECLARE_PRIVATE(ctkBinaryFileDescriptor);
  44. };
  45. #endif