FIX::FieldMap Class Reference

Stores and organizes a collection of Fields. More...

`#include <FieldMap.h>`

Inheritance diagram for FIX::FieldMap:
[legend]

## Public Types

typedef std::multimap< int, FieldBase, message_order, ALLOCATOR< std::pair< const int, FieldBase > > > | Fields
typedef std::map< int, std::vector< FieldMap *>, std::less< int >, ALLOCATOR< std::pair< const int, std::vector< FieldMap *> > > > | Groups
typedef Fields::const_iterator | iterator
typedef iterator | const_iterator
typedef Groups::const_iterator | g_iterator
typedef Groups::const_iterator | g_const_iterator

## Public Member Functions

| FieldMap (const message_order &order=message_order(message_order::normal))
| FieldMap (const int order[])
| FieldMap (const FieldMap &copy)
virtual | ~FieldMap ()
FieldMap & | operator= (const FieldMap &rhs)
void | setField (const FieldBase &field, bool overwrite=true) throw ( RepeatedTag )
| Set a field without type checking. More...
void | setField (int field, const std::string &value) throw ( RepeatedTag, NoTagValue )
| Set a field without a field class. More...
bool | getFieldIfSet (FieldBase &field) const
| Get a field if set. More...
FieldBase & | getField (FieldBase &field) const throw ( FieldNotFound )
| Get a field without type checking. More...
const std::string & | getField (int field) const throw ( FieldNotFound )
| Get a field without a field class. More...
const FieldBase & | getFieldRef (int field) const throw ( FieldNotFound )
| Get direct access to a field through a reference. More...
const FieldBase *const | getFieldPtr (int field) const throw ( FieldNotFound )
| Get direct access to a field through a pointer. More...
bool | isSetField (const FieldBase &field) const
| Check to see if a field is set. More...
bool | isSetField (int field) const
| Check to see if a field is set by referencing its number. More...
void | removeField (int field)
| Remove a field. If field is not present, this is a no-op. More...
void | addGroup (int field, const FieldMap &group, bool setCount=true)
| Add a group. More...
void | addGroupPtr (int field, FieldMap *group, bool setCount=true)
| Acquire ownership of Group object. More...
void | replaceGroup (int num, int field, const FieldMap &group)
| Replace a specific instance of a group. More...
FieldMap & | getGroup (int num, int field, FieldMap &group) const throw ( FieldNotFound )
| Get a specific instance of a group. More...
FieldMap & | getGroupRef (int num, int field) const throw ( FieldNotFound )
| Get direct access to a field through a reference. More...
FieldMap * | getGroupPtr (int num, int field) const throw ( FieldNotFound )
| Get direct access to a field through a pointer. More...
void | removeGroup (int num, int field)
| Remove a specific instance of a group. More...
void | removeGroup (int field)
| Remove all instances of a group. More...
bool | hasGroup (int field) const
| Check to see any instance of a group exists. More...
bool | hasGroup (int num, int field) const
| Check to see if a specific instance of a group exists. More...
size_t | groupCount (int field) const
| Count the number of instance of a group. More...
void | clear ()
| Clear all fields from the map. More...
bool | isEmpty ()
| Check if map contains any fields. More...
size_t | totalFields () const
std::string & | calculateString (std::string &) const
int | calculateLength (int beginStringField=FIELD::BeginString, int bodyLengthField=FIELD::BodyLength, int checkSumField=FIELD::CheckSum) const
int | calculateTotal (int checkSumField=FIELD::CheckSum) const
iterator | begin () const
iterator | end () const
g_iterator | g_begin () const
g_iterator | g_end () const

## Private Attributes

Fields | m_fields
Groups | m_groups

## Detailed Description

Stores and organizes a collection of Fields.

This is the basis for a message, header, and trailer. This collection class uses a sorter to keep the fields in a particular order.

Definition at line 46 of file FieldMap.h.

## Member Typedef Documentation

## const_iterator

typedef iterator FIX::FieldMap::const_iterator

Definition at line 60 of file FieldMap.h.

## Fields

typedef std::multimap< int, FieldBase, message_order, ALLOCATOR<std::pair<const int,FieldBase> > > FIX::FieldMap::Fields

Definition at line 54 of file FieldMap.h.

## g_const_iterator

typedef Groups::const_iterator FIX::FieldMap::g_const_iterator

Definition at line 62 of file FieldMap.h.

## g_iterator

typedef Groups::const_iterator FIX::FieldMap::g_iterator

Definition at line 61 of file FieldMap.h.

## Groups

typedef std::map< int, std::vector < FieldMap* >, std::less<int>, ALLOCATOR<std::pair<const int, std::vector< FieldMap* > > > > FIX::FieldMap::Groups

Definition at line 56 of file FieldMap.h.

## iterator

typedef Fields::const_iterator FIX::FieldMap::iterator

Definition at line 59 of file FieldMap.h.

## Constructor & Destructor Documentation

## FieldMap() [1/3]

FIX::FieldMap::FieldMap | ( | const message_order & | order = `message_order( message_order::normal )` | ) |

inline

Definition at line 64 of file FieldMap.h.

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

: m_fields( order ) {}
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220

## FieldMap() [2/3]

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

inline

Definition at line 68 of file FieldMap.h.

: m_fields( message_order(order) ) {}
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220

## FieldMap() [3/3]

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

inline

Definition at line 71 of file FieldMap.h.

References operator=(), and ~FieldMap().

{ *this = copy; }

## ~FieldMap()

FIX::FieldMap::~FieldMap | ( |  | ) |

virtual

Definition at line 33 of file FieldMap.cpp.

References clear().

Referenced by FieldMap().

{
clear();
}
FIX::FieldMap::clear
void clear()
Clear all fields from the map.
Definition: FieldMap.cpp:143

## Member Function Documentation

## addGroup()

void FIX::FieldMap::addGroup | ( | int | field,
|  | const FieldMap & | group,
|  | bool | setCount = `true`
| ) |  |

Add a group.

Definition at line 58 of file FieldMap.cpp.

References addGroupPtr(), and FieldMap().

Referenced by FIX::Group::addGroup(), FIX::Message::addGroup(), and isSetField().

{
FieldMap * pGroup = new FieldMap( group );
addGroupPtr( field, pGroup, setCount );
}
FIX::FieldMap::addGroupPtr
void addGroupPtr(int field, FieldMap *group, bool setCount=true)
Acquire ownership of Group object.
Definition: FieldMap.cpp:65
FIX::FieldMap::FieldMap
FieldMap(const message_order &order=message_order(message_order::normal))
Definition: FieldMap.h:64

## addGroupPtr()

void FIX::FieldMap::addGroupPtr | ( | int | field,
|  | FieldMap * | group,
|  | bool | setCount = `true`
| ) |  |

Acquire ownership of Group object.

Definition at line 65 of file FieldMap.cpp.

References m_groups, and setField().

Referenced by addGroup(), isSetField(), and FIX::Message::setGroup().

{
if( group == 0 )
return;
std::vector< FieldMap* >& vec = m_groups[ field ];
vec.push_back( group );
if( setCount )
setField( IntField( field, (int)vec.size() ) );
}
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221
FIX::FieldMap::setField
void setField(const FieldBase &field, bool overwrite=true)
Set a field without type checking.
Definition: FieldMap.h:79

## begin()

iterator FIX::FieldMap::begin | ( |  | ) | const

inline

Definition at line 214 of file FieldMap.h.

References m_fields.

Referenced by FIX::Message::extractField(), FIX::DataDictionary::iterate(), and FIX::Message::toXMLFields().

{ return m_fields.begin(); }
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220

## calculateLength()

int FIX::FieldMap::calculateLength | ( | int | beginStringField = `FIELD::BeginString`,
|  | int | bodyLengthField = `FIELD::BodyLength`,
|  | int | checkSumField = `FIELD::CheckSum`
| ) |  | const

Definition at line 194 of file FieldMap.cpp.

References m_fields, and m_groups.

Referenced by FIX::Message::bodyLength(), and getGroupPtr().

{
int result = 0;
Fields::const_iterator i;
for ( i = m_fields.begin(); i != m_fields.end(); ++i )
{
if ( i->first != beginStringField
&& i->first != bodyLengthField
&& i->first != checkSumField )
{ result += i->second.getLength(); }
}
Groups::const_iterator j;
for ( j = m_groups.begin(); j != m_groups.end(); ++j )
{
std::vector < FieldMap* > ::const_iterator k;
for ( k = j->second.begin(); k != j->second.end(); ++k )
result += ( *k ) ->calculateLength();
}
return result;
}
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221
FIX::FieldMap::const_iterator
iterator const_iterator
Definition: FieldMap.h:60

## calculateString()

std::string & FIX::FieldMap::calculateString | ( | std::string & | result | ) | const

Definition at line 176 of file FieldMap.cpp.

References m_fields, and m_groups.

Referenced by getGroupPtr(), and FIX::Message::toString().

{
Fields::const_iterator i;
for ( i = m_fields.begin(); i != m_fields.end(); ++i )
{
result += i->second.getFixString();
// add groups if they exist
if( !m_groups.size() ) continue;
Groups::const_iterator j = m_groups.find( i->first );
if ( j == m_groups.end() ) continue;
std::vector < FieldMap* > ::const_iterator k;
for ( k = j->second.begin(); k != j->second.end(); ++k )
( *k ) ->calculateString( result );
}
return result;
}
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221
FIX::FieldMap::const_iterator
iterator const_iterator
Definition: FieldMap.h:60

## calculateTotal()

int FIX::FieldMap::calculateTotal | ( | int | checkSumField = `FIELD::CheckSum` | ) | const

Definition at line 218 of file FieldMap.cpp.

References m_fields, and m_groups.

Referenced by FIX::Message::checkSum(), and getGroupPtr().

{
int result = 0;
Fields::const_iterator i;
for ( i = m_fields.begin(); i != m_fields.end(); ++i )
{
if ( i->first != checkSumField )
result += i->second.getTotal();
}
Groups::const_iterator j;
for ( j = m_groups.begin(); j != m_groups.end(); ++j )
{
std::vector < FieldMap* > ::const_iterator k;
for ( k = j->second.begin(); k != j->second.end(); ++k )
result += ( *k ) ->calculateTotal();
}
return result;
}
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221
FIX::FieldMap::const_iterator
iterator const_iterator
Definition: FieldMap.h:60

## clear()

void FIX::FieldMap::clear | ( |  | ) |

Clear all fields from the map.

Definition at line 143 of file FieldMap.cpp.

References m_fields, and m_groups.

Referenced by FIX::Message::clear(), FIX::Message::getGroup(), getGroupPtr(), operator=(), and ~FieldMap().

{
m_fields.clear();
Groups::iterator i;
for ( i = m_groups.begin(); i != m_groups.end(); ++i )
{
std::vector < FieldMap* > ::iterator j;
for ( j = i->second.begin(); j != i->second.end(); ++j )
delete *j;
}
m_groups.clear();
}
FIX::FieldMap::iterator
Fields::const_iterator iterator
Definition: FieldMap.h:59
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221

## end()

iterator FIX::FieldMap::end | ( |  | ) | const

inline

Definition at line 215 of file FieldMap.h.

References m_fields.

Referenced by FIX::DataDictionary::iterate(), and FIX::Message::toXMLFields().

{ return m_fields.end(); }
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220

## g_begin()

g_iterator FIX::FieldMap::g_begin | ( |  | ) | const

inline

Definition at line 216 of file FieldMap.h.

References m_groups.

Referenced by FIX::DataDictionary::checkHasRequired(), and FIX::Message::toXMLFields().

{ return m_groups.begin(); }
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221

## g_end()

g_iterator FIX::FieldMap::g_end | ( |  | ) | const

inline

Definition at line 217 of file FieldMap.h.

References m_groups.

Referenced by FIX::DataDictionary::checkHasRequired(), and FIX::Message::toXMLFields().

{ return m_groups.end(); }
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221

## getField() [1/2]

FieldBase& FIX::FieldMap::getField | ( | FieldBase & | field | ) | const
throw | ( | FieldNotFound
| ) |  |

inline

Get a field without type checking.

Definition at line 112 of file FieldMap.h.

References getFieldRef().

Referenced by FIX::Session::doPossDup(), FIX::Session::doTargetTooHigh(), FIX::Session::doTargetTooLow(), FIX::Message::extractField(), FIX::Session::generateBusinessReject(), FIX::Session::generateHeartbeat(), FIX::Session::generateLogon(), FIX::Session::generateReject(), FIX::Session::generateSequenceReset(), FIX::Acceptor::getSession(), FIX::Message::getSessionID(), FIX::Session::next(), FIX::Session::nextLogon(), FIX::Session::nextQueued(), FIX::Session::nextResendRequest(), FIX::Session::populateRejectReason(), and FIX::Session::resend().

{
field = getFieldRef( field.getField() );
return field;
}
FIX::FieldMap::getFieldRef
const FieldBase & getFieldRef(int field) const
Get direct access to a field through a reference.
Definition: FieldMap.h:127

## getField() [2/2]

const std::string& FIX::FieldMap::getField | ( | int | field | ) | const
throw | ( | FieldNotFound
| ) |  |

inline

Get a field without a field class.

Definition at line 120 of file FieldMap.h.

References getFieldRef(), and FIX::FieldBase::getString().

{
return getFieldRef( field ).getString();
}
FIX::FieldBase::getString
const std::string & getString() const
Get the string representation of the fields value.
Definition: Field.h:112
FIX::FieldMap::getFieldRef
const FieldBase & getFieldRef(int field) const
Get direct access to a field through a reference.
Definition: FieldMap.h:127

## getFieldIfSet()

bool FIX::FieldMap::getFieldIfSet | ( | FieldBase & | field | ) | const

inline

Get a field if set.

Definition at line 102 of file FieldMap.h.

References FIX::FieldBase::getField(), and m_fields.

Referenced by FIX::MessageCracker::crack(), FIX::Session::doPossDup(), FIX::Session::doTargetTooLow(), FIX::Session::generateReject(), FIX::Session::next(), FIX::Session::nextLogon(), FIX::Session::nextResendRequest(), FIX::Session::nextSequenceReset(), FIX::Message::reverseRoute(), and FIX::Session::sendRaw().

{
Fields::const_iterator iter = m_fields.find( field.getField() );
if ( iter == m_fields.end() )
return false;
field = iter->second;
return true;
}
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220

## getFieldPtr()

const FieldBase* const FIX::FieldMap::getFieldPtr | ( | int | field | ) | const
throw | ( | FieldNotFound
| ) |  |

inline

Get direct access to a field through a pointer.

Definition at line 137 of file FieldMap.h.

References getFieldRef().

{
return &getFieldRef( field );
}
FIX::FieldMap::getFieldRef
const FieldBase & getFieldRef(int field) const
Get direct access to a field through a reference.
Definition: FieldMap.h:127

## getFieldRef()

const FieldBase& FIX::FieldMap::getFieldRef | ( | int | field | ) | const
throw | ( | FieldNotFound
| ) |  |

inline

Get direct access to a field through a reference.

Definition at line 127 of file FieldMap.h.

References m_fields.

Referenced by getField(), and getFieldPtr().

{
Fields::const_iterator iter = m_fields.find( field );
if ( iter == m_fields.end() )
throw FieldNotFound( field );
return iter->second;
}
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220

## getGroup()

FieldMap& FIX::FieldMap::getGroup | ( | int | num,
|  | int | field,
|  | FieldMap & | group
| ) |  | const
throw | ( | FieldNotFound
| ) |  |

inline

Get a specific instance of a group.

Definition at line 163 of file FieldMap.h.

References getGroupRef().

Referenced by FIX::Group::getGroup(), and FIX::Message::getGroup().

{
return group = getGroupRef( num, field );
}
FIX::FieldMap::getGroupRef
FieldMap & getGroupRef(int num, int field) const
Get direct access to a field through a reference.
Definition: FieldMap.h:170

## getGroupPtr()

FieldMap* FIX::FieldMap::getGroupPtr | ( | int | num,
|  | int | field
| ) |  | const
throw | ( | FieldNotFound
| ) |  |

inline

Get direct access to a field through a pointer.

Definition at line 181 of file FieldMap.h.

References FIX::FIELD::BeginString, FIX::FIELD::BodyLength, calculateLength(), calculateString(), calculateTotal(), FIX::FIELD::CheckSum, clear(), getGroupRef(), groupCount(), hasGroup(), isEmpty(), removeGroup(), and totalFields().

{
return &getGroupRef( num, field );
}
FIX::FieldMap::getGroupRef
FieldMap & getGroupRef(int num, int field) const
Get direct access to a field through a reference.
Definition: FieldMap.h:170

## getGroupRef()

FieldMap& FIX::FieldMap::getGroupRef | ( | int | num,
|  | int | field
| ) |  | const
throw | ( | FieldNotFound
| ) |  |

inline

Get direct access to a field through a reference.

Definition at line 170 of file FieldMap.h.

References m_groups.

Referenced by getGroup(), and getGroupPtr().

{
Groups::const_iterator i = m_groups.find( field );
if( i == m_groups.end() ) throw FieldNotFound( field );
if( num <= 0 ) throw FieldNotFound( field );
if( i->second.size() < (unsigned)num ) throw FieldNotFound( field );
return *( *(i->second.begin() + (num-1) ) );
}
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221

## groupCount()

size_t FIX::FieldMap::groupCount | ( | int | field | ) | const

Count the number of instance of a group.

Definition at line 135 of file FieldMap.cpp.

References m_groups.

Referenced by FIX::DataDictionary::checkGroupCount(), getGroupPtr(), hasGroup(), and removeGroup().

{
Groups::const_iterator i = m_groups.find( field );
if( i == m_groups.end() )
return 0;
return i->second.size();
}
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221

## hasGroup() [1/2]

bool FIX::FieldMap::hasGroup | ( | int | field | ) | const

Check to see any instance of a group exists.

Definition at line 129 of file FieldMap.cpp.

References m_groups.

Referenced by getGroupPtr(), FIX::Group::hasGroup(), and FIX::Message::hasGroup().

{
Groups::const_iterator i = m_groups.find( field );
return i != m_groups.end();
}
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221

## hasGroup() [2/2]

bool FIX::FieldMap::hasGroup | ( | int | num,
|  | int | field
| ) |  | const

Check to see if a specific instance of a group exists.

Definition at line 124 of file FieldMap.cpp.

References groupCount().

{
return (int)groupCount(field) >= num;
}
FIX::FieldMap::groupCount
size_t groupCount(int field) const
Count the number of instance of a group.
Definition: FieldMap.cpp:135

## isEmpty()

bool FIX::FieldMap::isEmpty | ( |  | ) |

Check if map contains any fields.

Definition at line 157 of file FieldMap.cpp.

References m_fields.

Referenced by getGroupPtr(), and FIX::Message::isEmpty().

{
return m_fields.size() == 0;
}
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220

## isSetField() [1/2]

bool FIX::FieldMap::isSetField | ( | const FieldBase & | field | ) | const

inline

Check to see if a field is set.

Definition at line 144 of file FieldMap.h.

References FIX::FieldBase::getField().

Referenced by FIX::DataDictionary::checkHasRequired(), and FIX::Message::extractField().

{ return isSetField( field.getField() ); }
FIX::FieldMap::isSetField
bool isSetField(const FieldBase &field) const
Check to see if a field is set.
Definition: FieldMap.h:144

## isSetField() [2/2]

bool FIX::FieldMap::isSetField | ( | int | field | ) | const

inline

Check to see if a field is set by referencing its number.

Definition at line 147 of file FieldMap.h.

References addGroup(), addGroupPtr(), m_fields, removeField(), and replaceGroup().

{ return m_fields.find( field ) != m_fields.end(); }
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220

## operator=()

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

Definition at line 38 of file FieldMap.cpp.

References clear(), FieldMap(), m_fields, and m_groups.

Referenced by FieldMap().

{
clear();
m_fields = rhs.m_fields;
Groups::const_iterator i;
for ( i = rhs.m_groups.begin(); i != rhs.m_groups.end(); ++i )
{
std::vector < FieldMap* > ::const_iterator j;
for ( j = i->second.begin(); j != i->second.end(); ++j )
{
FieldMap * pGroup = new FieldMap( **j );
m_groups[ i->first ].push_back( pGroup );
}
}
return *this;
}
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221
FIX::FieldMap::const_iterator
iterator const_iterator
Definition: FieldMap.h:60
FIX::FieldMap::FieldMap
FieldMap(const message_order &order=message_order(message_order::normal))
Definition: FieldMap.h:64
FIX::FieldMap::clear
void clear()
Clear all fields from the map.
Definition: FieldMap.cpp:143

## removeField()

void FIX::FieldMap::removeField | ( | int | field | ) |

Remove a field. If field is not present, this is a no-op.

Definition at line 117 of file FieldMap.cpp.

References m_fields.

Referenced by isSetField(), removeGroup(), FIX::Message::reverseRoute(), and FIX::Session::send().

{
Fields::iterator i = m_fields.find( field );
if ( i != m_fields.end() )
m_fields.erase( i );
}
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220

## removeGroup() [1/2]

void FIX::FieldMap::removeGroup | ( | int | num,
|  | int | field
| ) |  |

Remove a specific instance of a group.

Definition at line 86 of file FieldMap.cpp.

References groupCount(), m_groups, removeField(), and setField().

Referenced by getGroupPtr(), FIX::Group::removeGroup(), FIX::Message::removeGroup(), and removeGroup().

{
Groups::iterator i = m_groups.find( field );
if ( i == m_groups.end() ) return;
if ( num <= 0 ) return;
std::vector< FieldMap* >& vector = i->second;
if ( vector.size() < ( unsigned ) num ) return;
std::vector< FieldMap* >::iterator iter = vector.begin();
std::advance( iter, ( num - 1 ) );
delete (*iter);
vector.erase( iter );
if( vector.size() == 0 )
{
m_groups.erase( field );
removeField( field );
}
else
{
IntField groupCount( field, (int)vector.size() );
setField( groupCount, true );
}
}
FIX::FieldMap::groupCount
size_t groupCount(int field) const
Count the number of instance of a group.
Definition: FieldMap.cpp:135
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221
FIX::FieldMap::setField
void setField(const FieldBase &field, bool overwrite=true)
Set a field without type checking.
Definition: FieldMap.h:79
FIX::FieldMap::removeField
void removeField(int field)
Remove a field. If field is not present, this is a no-op.
Definition: FieldMap.cpp:117

## removeGroup() [2/2]

void FIX::FieldMap::removeGroup | ( | int | field | ) |

Remove all instances of a group.

Definition at line 112 of file FieldMap.cpp.

References groupCount(), and removeGroup().

{
removeGroup( (int)groupCount(field), field );
}
FIX::FieldMap::removeGroup
void removeGroup(int num, int field)
Remove a specific instance of a group.
Definition: FieldMap.cpp:86
FIX::FieldMap::groupCount
size_t groupCount(int field) const
Count the number of instance of a group.
Definition: FieldMap.cpp:135

## replaceGroup()

void FIX::FieldMap::replaceGroup | ( | int | num,
|  | int | field,
|  | const FieldMap & | group
| ) |  |

Replace a specific instance of a group.

Definition at line 77 of file FieldMap.cpp.

References m_groups.

Referenced by isSetField(), FIX::Group::replaceGroup(), and FIX::Message::replaceGroup().

{
Groups::const_iterator i = m_groups.find( field );
if ( i == m_groups.end() ) return;
if ( num <= 0 ) return;
if ( i->second.size() < ( unsigned ) num ) return;
*( *( i->second.begin() + ( num - 1 ) ) ) = group;
}
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221

## setField() [1/2]

void FIX::FieldMap::setField | ( | const FieldBase & | field,
|  | bool | overwrite = `true`
| ) |  |
throw | ( | RepeatedTag
| ) |  |

inline

Set a field without type checking.

Definition at line 79 of file FieldMap.h.

References FIX::FieldBase::getField(), and m_fields.

Referenced by addGroupPtr(), FIX::Session::fill(), FIX::Session::generateBusinessReject(), FIX::Session::generateHeartbeat(), FIX::Session::generateLogon(), FIX::Session::generateLogout(), FIX::Session::generateReject(), FIX::Session::generateResendRequest(), FIX::Session::generateSequenceReset(), FIX::Session::generateTestRequest(), FIX::Session::insertOrigSendingTime(), FIX::Session::insertSendingTime(), FIX::Session::populateRejectReason(), removeGroup(), FIX::Session::resend(), FIX::Message::reverseRoute(), FIX::Session::sendRaw(), FIX::Session::sendToTarget(), setField(), FIX::Message::setSessionID(), FIX::Message::setString(), FIX::Message::setStringHeader(), and FIX::Message::toString().

{
if(!overwrite)
m_fields.insert( Fields::value_type( field.getField(), field ) );
else
{
Fields::iterator i = m_fields.find( field.getField() );
if( i == m_fields.end() )
m_fields.insert( Fields::value_type( field.getField(), field ) );
else
i->second = field;
}
}
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220

## setField() [2/2]

void FIX::FieldMap::setField | ( | int | field,
|  | const std::string & | value
| ) |  |
throw | ( | RepeatedTag,
|  | NoTagValue
| ) |  |

inline

Set a field without a field class.

Definition at line 94 of file FieldMap.h.

References setField().

{
FieldBase fieldBase( field, value );
setField( fieldBase );
}
FIX::FieldMap::setField
void setField(const FieldBase &field, bool overwrite=true)
Set a field without type checking.
Definition: FieldMap.h:79

## totalFields()

size_t FIX::FieldMap::totalFields | ( |  | ) | const

Definition at line 162 of file FieldMap.cpp.

References m_fields, and m_groups.

Referenced by getGroupPtr().

{
size_t result = m_fields.size();
Groups::const_iterator i;
for ( i = m_groups.begin(); i != m_groups.end(); ++i )
{
std::vector < FieldMap* > ::const_iterator j;
for ( j = i->second.begin(); j != i->second.end(); ++j )
result += ( *j ) ->totalFields();
}
return result;
}
FIX::FieldMap::m_fields
Fields m_fields
Definition: FieldMap.h:220
FIX::FieldMap::m_groups
Groups m_groups
Definition: FieldMap.h:221
FIX::FieldMap::const_iterator
iterator const_iterator
Definition: FieldMap.h:60

## Member Data Documentation

## m_fields

Fields FIX::FieldMap::m_fields

private

Definition at line 220 of file FieldMap.h.

Referenced by begin(), calculateLength(), calculateString(), calculateTotal(), clear(), end(), getFieldIfSet(), getFieldRef(), isEmpty(), isSetField(), operator=(), removeField(), setField(), and totalFields().

## m_groups

Groups FIX::FieldMap::m_groups

private

Definition at line 221 of file FieldMap.h.

Referenced by addGroupPtr(), calculateLength(), calculateString(), calculateTotal(), clear(), g_begin(), g_end(), getGroupRef(), groupCount(), hasGroup(), operator=(), removeGroup(), replaceGroup(), and totalFields().

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

- FieldMap.h
- FieldMap.cpp