scheduleread.hpp 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef __SCHEDULEREAD_HPP_
  14. #define __SCHEDULEREAD_HPP_
  15. #ifdef SCHEDULECTRL_EXPORTS
  16. #define SCHEDULECTRL_API DECL_EXPORT
  17. #else
  18. #define SCHEDULECTRL_API DECL_IMPORT
  19. #endif
  20. #include "jstring.hpp"
  21. #include "jtime.hpp"
  22. interface IScheduleReaderIterator : public IInterface
  23. {
  24. virtual bool isValidEventName() const = 0;
  25. virtual bool isValidEventText() const = 0;
  26. virtual bool isValidWuid() const = 0;
  27. virtual bool nextEventName() = 0;
  28. virtual bool nextEventText() = 0;
  29. virtual bool nextWuid() = 0;
  30. virtual StringBuffer & getEventName(StringBuffer & out) const = 0;
  31. virtual StringBuffer & getEventText(StringBuffer & out) const = 0;
  32. virtual StringBuffer & getWuid(StringBuffer & out) const = 0;
  33. virtual bool queryUpdateLatest(CDateTime const & dt) const = 0;
  34. };
  35. interface IScheduleReader : public IInterface
  36. {
  37. virtual IScheduleReaderIterator * getIterator(char const * eventName = NULL, char const * eventText = NULL) = 0; // use NULL args to iterate over all event names/texts
  38. };
  39. interface IScheduleSubscriber : public IInterface
  40. {
  41. virtual void notify() = 0;
  42. };
  43. interface ISchedulerListIterator : public IInterface
  44. {
  45. virtual void first() = 0;
  46. virtual bool isValid() const = 0;
  47. virtual bool next() = 0;
  48. virtual char const * query() const = 0;
  49. };
  50. extern SCHEDULECTRL_API IScheduleReader * getScheduleReader(char const * serverName, char const * eventName = NULL); // use NULL arg to get reader for whole schedule
  51. extern SCHEDULECTRL_API IScheduleReader * getSubscribingScheduleReader(char const * serverName, IScheduleSubscriber * subscriber, char const * eventName = NULL); // as above, but subscribes, calls subscriber is non-NULL its notify method is called
  52. extern SCHEDULECTRL_API ISchedulerListIterator * getSchedulerList();
  53. /* If you get a subscribing reader, it will keep itself up to date
  54. * with the schedule in SDS. However, if you have any unreleased
  55. * iterators on the reader, it won't update itself and will schedule
  56. * an update to be done when you release the last iterator. And
  57. * conversely, getIterator will be blocked while an update is taking
  58. * place. */
  59. #endif