Init.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ///
  2. /// \file Pothos/Init.hpp
  3. ///
  4. /// Initialization calls for library
  5. ///
  6. /// \copyright
  7. /// Copyright (c) 2013-2016 Josh Blum
  8. /// SPDX-License-Identifier: BSL-1.0
  9. ///
  10. #pragma once
  11. #include <Pothos/Config.hpp>
  12. namespace Pothos {
  13. /*!
  14. * Perform initialization routines.
  15. * This call will check the integrity of the installation.
  16. * This looks for the root directory, the runtime library,
  17. * permissions on user configuration and data directories.
  18. * Also, the runtime modules will be loaded into the system.
  19. * This call will throw if any of the above fails.
  20. * Subsequent calls to init() are safe and result in NOP.
  21. */
  22. POTHOS_API void init(void);
  23. /*!
  24. * Perform cleanup routines before application exit.
  25. * The deinit() call unloads plugin modules loaded by init()
  26. * Match any calls to init() with to deinit() before application exit.
  27. */
  28. POTHOS_API void deinit(void);
  29. /*!
  30. * Scoped initializer with automatic cleanup.
  31. */
  32. class POTHOS_API ScopedInit
  33. {
  34. public:
  35. //! Call init() on object construction.
  36. ScopedInit(void);
  37. //! Call deinit() when going out of scope.
  38. ~ScopedInit(void);
  39. };
  40. } //namespace Pothos