Group.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* -*- C++ -*- */
  2. /****************************************************************************
  3. ** Copyright (c) 2001-2014
  4. **
  5. ** This file is part of the QuickFIX FIX Engine
  6. **
  7. ** This file may be distributed under the terms of the quickfixengine.org
  8. ** license as defined by quickfixengine.org and appearing in the file
  9. ** LICENSE included in the packaging of this file.
  10. **
  11. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  12. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  13. **
  14. ** See http://www.quickfixengine.org/LICENSE for licensing information.
  15. **
  16. ** Contact ask@quickfixengine.org if any conditions of this licensing are
  17. ** not clear to you.
  18. **
  19. ****************************************************************************/
  20. #ifndef FIX_GROUP
  21. #define FIX_GROUP
  22. #ifdef _MSC_VER
  23. #pragma warning( disable: 4786 )
  24. #endif
  25. #include "FieldMap.h"
  26. #include "Fields.h"
  27. #include <vector>
  28. namespace FIX
  29. {
  30. /**
  31. * Base class for all %FIX repeating groups.
  32. *
  33. * A group consists of a count field, deliminator, and a sorting order.
  34. */
  35. class Group : public FieldMap
  36. {
  37. public:
  38. Group( int field, int delim )
  39. : FieldMap( message_order( delim, 0 ) ),
  40. m_field( field ), m_delim( delim ) {}
  41. Group( int field, int delim, const int order[] )
  42. : FieldMap( order ), m_field( field ), m_delim( delim ) {}
  43. Group( int field, int delim, const message_order& order )
  44. : FieldMap( order ), m_field( field ), m_delim( delim ) {}
  45. Group( const Group& copy )
  46. : FieldMap( copy ), m_field( copy.m_field ), m_delim( copy.m_delim ) {}
  47. int field() const { return m_field; }
  48. int delim() const { return m_delim; }
  49. void addGroup( const Group& group );
  50. void replaceGroup( unsigned num, const Group& group );
  51. Group& getGroup( unsigned num, Group& group ) const throw( FieldNotFound );
  52. void removeGroup( unsigned num, const Group& group );
  53. void removeGroup( const Group& group );
  54. bool hasGroup( const Group& group );
  55. bool hasGroup( unsigned num, const Group& group );
  56. private:
  57. int m_field;
  58. int m_delim;
  59. };
  60. }
  61. #endif //FIX_GROUP