ctkBinaryFileDescriptor.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) 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.apache.org/licenses/LICENSE-2.0.txt
  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. /*=========================================================================
  15. Portions (c) Copyright Brigham and Women's Hospital (BWH)
  16. All Rights Reserved.
  17. See http://www.slicer.org/copyright/copyright.txt for details.
  18. Program: Module Description Parser
  19. =========================================================================*/
  20. #ifndef __ctkBinaryFileDescriptor_h
  21. #define __ctkBinaryFileDescriptor_h
  22. // Qt includes
  23. #include <QString>
  24. #include <QScopedPointer>
  25. #include "ctkCoreExport.h"
  26. class ctkBinaryFileDescriptorPrivate;
  27. /// \ingroup Core
  28. /// Allows to resolve global symbols contained into an executable.
  29. /// Implementation valid only for unix-like systems (Linux, Mac, ...)
  30. class CTK_CORE_EXPORT ctkBinaryFileDescriptor
  31. {
  32. public:
  33. ctkBinaryFileDescriptor();
  34. ctkBinaryFileDescriptor(const QString& _fileName);
  35. virtual ~ctkBinaryFileDescriptor();
  36. QString fileName()const;
  37. void setFileName(const QString& _fileName);
  38. /// Load the object file containing the symbols
  39. bool load();
  40. /// Unload / close the object file
  41. bool unload();
  42. bool isLoaded() const;
  43. /// Get the address of a symbol in memory
  44. void* resolve(const char * symbol);
  45. protected:
  46. QScopedPointer<ctkBinaryFileDescriptorPrivate> d_ptr;
  47. private:
  48. Q_DECLARE_PRIVATE(ctkBinaryFileDescriptor);
  49. Q_DISABLE_COPY(ctkBinaryFileDescriptor);
  50. };
  51. #endif