ctkBinaryFileDescriptor.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) 2010 Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.commontk.org/LICENSE
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. /*=auto=========================================================================
  15. Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH)
  16. All Rights Reserved.
  17. See Doc/copyright/copyright.txt
  18. or http://www.slicer.org/copyright/copyright.txt for details.
  19. Program: Module Description Parser
  20. =========================================================================auto=*/
  21. #ifndef __ctkBinaryFileDescriptor_h
  22. #define __ctkBinaryFileDescriptor_h
  23. // Qt includes
  24. #include <QString>
  25. // CTK includes
  26. #include "ctkPimpl.h"
  27. #include "CTKWidgetsExport.h"
  28. /// Allows to resolve global symbols contained into an executable.
  29. /// Implementation valid only for unix-like systems (Linux, Mac, ...)
  30. class ctkBinaryFileDescriptorPrivate;
  31. class CTK_WIDGETS_EXPORT ctkBinaryFileDescriptor
  32. {
  33. public:
  34. ctkBinaryFileDescriptor();
  35. ctkBinaryFileDescriptor(const QString& _fileName);
  36. virtual ~ctkBinaryFileDescriptor();
  37. QString fileName()const;
  38. void setFileName(const QString& _fileName);
  39. /// Load the object file containing the symbols
  40. bool load();
  41. /// Unload / close the object file
  42. bool unload();
  43. bool isLoaded() const;
  44. /// Get the address of a symbol in memory
  45. void* resolve(const char * symbol);
  46. private:
  47. CTK_DECLARE_PRIVATE(ctkBinaryFileDescriptor);
  48. };
  49. #endif