FIX::message_order Struct Reference

Sorts fields in header, normal, or trailer order. More...

`#include <MessageSorters.h>`

Collaboration diagram for FIX::message_order:
[legend]

## Public Types

enum | cmp_mode { header, trailer, normal, group }

## Public Member Functions

| message_order (cmp_mode mode=normal)
| message_order (int first,...)
| message_order (const int order[])
| message_order (const message_order &copy)
bool | operator() (const int x, const int y) const
message_order & | operator= (const message_order &rhs)
| operator bool () const

## Private Member Functions

void | setOrder (int size, const int order[])

## Private Attributes

cmp_mode | m_mode
int | m_delim
shared_array< int > | m_groupOrder
int | m_largest

## Detailed Description

Sorts fields in header, normal, or trailer order.

Used as a dynamic sorter to create Header, Trailer, and Message FieldMaps while maintaining the same base type.

Definition at line 130 of file MessageSorters.h.

## Member Enumeration Documentation

## cmp_mode

enum FIX::message_order::cmp_mode

Enumerator
header |
trailer |
normal |
group |

Definition at line 133 of file MessageSorters.h.

:
return group_order::compare( x, y, m_groupOrder, m_largest );

## Constructor & Destructor Documentation

## message_order() [1/4]

FIX::message_order::message_order | ( | cmp_mode | mode = `normal` | ) |

inline

Definition at line 135 of file MessageSorters.h.

: default:
return x < y;

## message_order() [2/4]

FIX::message_order::message_order | ( | int | first,
|  |  | ...
| ) |  |

Definition at line 49 of file MessageSorters.cpp.

{
m_groupOrder = shared_array<int>::create(m_largest + 1);
va_start( arguments, first );
field = first;
int i = 0;
while( field != 0 )
{
m_groupOrder[ field ] = ++i;
field = va_arg( arguments, int );
}
}
else
{
m_largest = 0;
m_delim = 0;
}
va_end( arguments );
}
message_order::message_order( const int order[] )
: m_mode( group ), m_delim( 0 ), m_largest( 0 )
{
int size = 0;
while( order[size] != 0 ) { ++size; }
setOrder(size, order);
}
message_order& message_order::operator=( const message_order& rhs )
{
m_mode = rhs.m_mode;
m_delim = rhs.m_delim;
m_largest = rhs.m_largest;
m_groupOrder = rhs.m_groupOrder;
return *this;

References FIX::shared_array< T >::create().

## message_order() [3/4]

FIX::message_order::message_order | ( | const int | order[] | ) |

Definition at line 88 of file MessageSorters.cpp.

{
if(size < 1) return;
m_largest = m_delim = order[0];
// collect all fields and find the largest field number

References m_delim, and m_largest.

## message_order() [4/4]

FIX::message_order::message_order | ( | const message_order & | copy | ) |

inline

Definition at line 139 of file MessageSorters.h.

{ return !m_groupOrder.empty(); }

## Member Function Documentation

## operator bool()

FIX::message_order::operator bool | ( |  | ) | const

inline

Definition at line 159 of file MessageSorters.h.

## operator()()

bool FIX::message_order::operator() | ( | const int | x,
|  | const int | y
| ) |  | const

inline

Definition at line 142 of file MessageSorters.h.

{ return !m_groupOrder.empty(); }
private:
void setOrder( int size, const int order[] );
cmp_mode m_mode;
int m_delim;
shared_array<int> m_groupOrder;
int m_largest;
};
}
#endif //FIX_MESSAGESORTERS_H

References FIX::shared_array< T >::empty(), and m_groupOrder.

## operator=()

message_order & FIX::message_order::operator= | ( | const message_order & | rhs | ) |

Definition at line 96 of file MessageSorters.cpp.

{
int field = order[i];
m_largest = m_largest > field ? m_largest : field;
}
m_groupOrder = shared_array<int>::create(m_largest + 1);
for (int i = 0; i < size; ++i )
m_groupOrder[ order[ i ] ] = i + 1;
}

References m_largest.

## setOrder()

void FIX::message_order::setOrder | ( | int | size,
|  | const int | order[]
| ) |  |

private

Definition at line 106 of file MessageSorters.cpp.

## Member Data Documentation

## m_delim

int FIX::message_order::m_delim

private

Definition at line 166 of file MessageSorters.h.

Referenced by message_order().

## m_groupOrder

shared_array<int> FIX::message_order::m_groupOrder

private

Definition at line 167 of file MessageSorters.h.

Referenced by operator()().

## m_largest

int FIX::message_order::m_largest

private

Definition at line 168 of file MessageSorters.h.

Referenced by message_order(), and operator=().

## m_mode

cmp_mode FIX::message_order::m_mode

private

Definition at line 165 of file MessageSorters.h.

The documentation for this struct was generated from the following files:

- MessageSorters.h
- MessageSorters.cpp

FIX::message_order::m_groupOrder
shared_array< int > m_groupOrder
Definition: MessageSorters.h:167
FIX::shared_array::create
static shared_array create(const std::size_t nSize)
Definition: SharedArray.h:235
FIX::message_order::group
@ group
Definition: MessageSorters.h:133
FIX::message_order::setOrder
void setOrder(int size, const int order[])
Definition: MessageSorters.cpp:106
FIX::message_order::message_order
message_order(cmp_mode mode=normal)
Definition: MessageSorters.h:135
FIX::message_order::m_delim
int m_delim
Definition: MessageSorters.h:166
FIX::message_order::m_mode
cmp_mode m_mode
Definition: MessageSorters.h:165
FIX::shared_array::empty
bool empty() const
Definition: SharedArray.h:228
FIX::message_order::m_largest
int m_largest
Definition: MessageSorters.h:168
FIX::group_order::compare
static bool compare(const int x, const int y, int *order, int largest)
Definition: MessageSorters.h:101
FIX::message_order::cmp_mode
cmp_mode
Definition: MessageSorters.h:133