WorkInfo.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ///
  2. /// \file Framework/WorkInfo.hpp
  3. ///
  4. /// WorkInfo provides information about a Worker's work() session.
  5. ///
  6. /// \copyright
  7. /// Copyright (c) 2014-2014 Josh Blum
  8. /// SPDX-License-Identifier: BSL-1.0
  9. ///
  10. #pragma once
  11. #include <Pothos/Config.hpp>
  12. #include <cstddef> //size_t
  13. #include <vector>
  14. namespace Pothos {
  15. /*!
  16. * Information about a work session.
  17. * The worker can query this info from calls to work().
  18. * This information is not specific to a single port.
  19. */
  20. struct POTHOS_API WorkInfo
  21. {
  22. //! Default constructor -- zeros out members
  23. WorkInfo(void);
  24. /*!
  25. * A vector of input pointers for indexable ports.
  26. * inputPointers[i] == worker->input(i).buffer.as<const void>();
  27. * This is a convenience for APIs that use a vector of pointers.
  28. */
  29. std::vector<const void *> inputPointers;
  30. /*!
  31. * A vector of output pointers for indexable ports.
  32. * outputPointers[i] == worker->output(i).buffer.as<void>();
  33. * This is a convenience for APIs that use a vector of pointers.
  34. */
  35. std::vector<void *> outputPointers;
  36. //! The minimum number of elements of all indexed ports
  37. size_t minElements;
  38. //! The minimum number of elements of input indexed ports
  39. size_t minInElements;
  40. //! The minimum number of elements of output indexed ports
  41. size_t minOutElements;
  42. //! The minimum number of elements of all ports
  43. size_t minAllElements;
  44. //! The minimum number of elements of input ports
  45. size_t minAllInElements;
  46. //! The minimum number of elements of output ports
  47. size_t minAllOutElements;
  48. /*!
  49. * The maximum time a call in work() is allowed to block.
  50. * The maxTimeoutNs member is in units of nanoseconds.
  51. * This is for workers that use blocking calls like select.
  52. * Always use blocking calls with a timeout to be safe.
  53. */
  54. long long maxTimeoutNs;
  55. };
  56. } //namespace Pothos