resetcontainer.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Reset container
  3. *
  4. * Copyright (c) 2024 Linaro, Ltd
  5. *
  6. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  7. * See the COPYING file in the top-level directory.
  8. */
  9. #ifndef HW_RESETCONTAINER_H
  10. #define HW_RESETCONTAINER_H
  11. /*
  12. * The "reset container" is an object which implements the Resettable
  13. * interface. It contains a list of arbitrary other objects which also
  14. * implement Resettable. Resetting the reset container resets all the
  15. * objects in it.
  16. */
  17. #include "qom/object.h"
  18. #define TYPE_RESETTABLE_CONTAINER "resettable-container"
  19. OBJECT_DECLARE_TYPE(ResettableContainer, ResettableContainerClass, RESETTABLE_CONTAINER)
  20. /**
  21. * resettable_container_add: Add a resettable object to the container
  22. * @rc: container
  23. * @obj: object to add to the container
  24. *
  25. * Add @obj to the ResettableContainer @rc. @obj must implement the
  26. * Resettable interface.
  27. *
  28. * When @rc is reset, it will reset every object that has been added
  29. * to it, in the order they were added.
  30. */
  31. void resettable_container_add(ResettableContainer *rc, Object *obj);
  32. /**
  33. * resettable_container_remove: Remove an object from the container
  34. * @rc: container
  35. * @obj: object to remove from the container
  36. *
  37. * Remove @obj from the ResettableContainer @rc. @obj must have been
  38. * previously added to this container.
  39. */
  40. void resettable_container_remove(ResettableContainer *rc, Object *obj);
  41. #endif