MessageList.cpp 703 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "MessageList.h"
  2. namespace midi {
  3. bool MessageList::contains(const Message& message) const
  4. {
  5. return find(message) != end();
  6. }
  7. MessageList::const_iterator MessageList::find(const Message& message) const
  8. {
  9. for(const_iterator it = begin(); it != end(); it++) {
  10. if(message == **it) {
  11. return it;
  12. }
  13. }
  14. return end();
  15. }
  16. void MessageList::print(std::ostream& stream) const
  17. {
  18. stream << "midi message list:\n";
  19. unsigned int i = 0;
  20. for(const_iterator msg_it = begin(); msg_it != end(); msg_it++, i++) {
  21. stream << "#" << i << " ";
  22. (*msg_it)->print(stream);
  23. }
  24. stream << "\n";
  25. stream.flush();
  26. }
  27. }; // namespace