![]() |
![]() |
|
Index
Source Files
Annotated Class List
Alphabetical Class List
Class Hierarchy
Graphical Class Hierarchy
|
||
![]() |
![]() |
#include <FieldMap.h>
Inheritance diagram for FIX::FieldMap:

Public Types | |
| typedef std::multimap< int, FieldBase, message_order > | Fields |
| typedef std::map< 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 ©) | |
| virtual | ~FieldMap () |
| FieldMap & | operator= (const FieldMap &rhs) |
| void | setField (const FieldBase &field, bool overwrite=true) throw ( RepeatedTag ) |
| Set a field without type checking. | |
| void | setField (int field, const std::string &value) throw ( RepeatedTag, NoTagValue ) |
| Set a field without a field class. | |
| FieldBase & | getField (FieldBase &field) const throw ( FieldNotFound ) |
| Get a field without type checking. | |
| std::string | getField (int field) const throw ( FieldNotFound ) |
| Get a field without a field class. | |
| bool | isSetField (const FieldBase &field) const |
| Check to see if a field is set. | |
| bool | isSetField (int field) const |
| Check to see if a field is set by referencing its number. | |
| void | removeField (int field) |
| Remove a field. If field is not present, this is a no-op. | |
| void | addGroup (int field, const FieldMap &group, bool setCount=true) |
| Add a group. | |
| void | replaceGroup (int num, int field, FieldMap &group) |
| Replace a specific instanct of a group. | |
| FieldMap & | getGroup (int num, int field, FieldMap &group) const throw ( FieldNotFound ) |
| Get a specific instance of a group. | |
| void | removeGroup (int num, int field) |
| Remove a specific instance of a group. | |
| void | removeGroup (int field) |
| Remove all instances of a group. | |
| bool | hasGroup (int field) const |
| Check to see any instance of a group exists. | |
| bool | hasGroup (int num, int field) const |
| Check to see if a specific instance of a group exists. | |
| int | groupCount (int field) const |
| Count the number of instance of a group. | |
| void | clear () |
| Clear all fields from the map. | |
| bool | isEmpty () |
| Check if map contains any fields. | |
| std::string & | calculateString (std::string &, bool clear=true) 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 |
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.
|
|
Definition at line 52 of file FieldMap.h. |
|
|
Definition at line 49 of file FieldMap.h. |
|
|
Definition at line 54 of file FieldMap.h. |
|
|
Definition at line 53 of file FieldMap.h. Referenced by FIX::DataDictionary::checkHasRequired(), g_begin(), g_end(), and FIX::Message::toXMLFields(). |
|
|
Definition at line 50 of file FieldMap.h. |
|
|
Definition at line 51 of file FieldMap.h. Referenced by begin(), end(), FIX::DataDictionary::iterate(), and FIX::Message::toXMLFields(). |
|
|
Definition at line 56 of file FieldMap.h. Referenced by addGroup().
00058 : m_fields( order ) {} |
|
|
Definition at line 60 of file FieldMap.h.
00061 : m_fields( message_order(order) ) {} |
|
|
Definition at line 63 of file FieldMap.h.
00064 { *this = copy; }
|
|
|
Definition at line 33 of file FieldMap.cpp. References clear(), QF_STACK_IGNORE_BEGIN, and QF_STACK_IGNORE_END.
00034 { QF_STACK_IGNORE_BEGIN
00035 clear();
00036 QF_STACK_IGNORE_END
00037 }
|
|
||||||||||||||||
|
Add a group.
Definition at line 60 of file FieldMap.cpp. References FieldMap(), m_fields, QF_STACK_POP, QF_STACK_PUSH, and setField(). Referenced by operator=(), and FIX::Message::setGroup().
00061 { QF_STACK_PUSH(FieldMap::addGroup)
00062
00063 FieldMap * pGroup = new FieldMap( group.m_fields.key_comp() );
00064 *pGroup = group;
00065 m_groups[ field ].push_back( pGroup );
00066 Groups::iterator i = m_groups.find( field );
00067 if( setCount )
00068 setField( IntField( field, i->second.size() ) );
00069
00070 QF_STACK_POP
00071 }
|
|
|
Definition at line 157 of file FieldMap.h. References iterator. Referenced by FIX::DataDictionary::iterate(), and FIX::Message::toXMLFields().
00157 { return m_fields.begin(); }
|
|
||||||||||||||||
|
Definition at line 226 of file FieldMap.cpp. Referenced by FIX::Message::bodyLength().
00229 {
00230 int result = 0;
00231 Fields::const_iterator i;
00232 for ( i = m_fields.begin(); i != m_fields.end(); ++i )
00233 {
00234 if ( i->first != beginStringField
00235 && i->first != bodyLengthField
00236 && i->first != checkSumField )
00237 { result += i->second.getLength(); }
00238 }
00239
00240 Groups::const_iterator j;
00241 for ( j = m_groups.begin(); j != m_groups.end(); ++j )
00242 {
00243 std::vector < FieldMap* > ::const_iterator k;
00244 for ( k = j->second.begin(); k != j->second.end(); ++k )
00245 result += ( *k ) ->calculateLength();
00246 }
00247 return result;
00248 }
|
|
||||||||||||
|
Definition at line 199 of file FieldMap.cpp. References QF_STACK_POP, and QF_STACK_PUSH. Referenced by FIX::Message::toString().
00200 { QF_STACK_PUSH(FieldMap::calculateString)
00201
00202 #if defined(_MSC_VER) && _MSC_VER < 1300
00203 if( clear ) result = "";
00204 #else
00205 if( clear ) result.clear();
00206 #endif
00207
00208 Fields::const_iterator i;
00209 for ( i = m_fields.begin(); i != m_fields.end(); ++i )
00210 {
00211 result += i->second.getValue();
00212
00213 // add groups if they exist
00214 if( !m_groups.size() ) continue;
00215 Groups::const_iterator j = m_groups.find( i->first );
00216 if ( j == m_groups.end() ) continue;
00217 std::vector < FieldMap* > ::const_iterator k;
00218 for ( k = j->second.begin(); k != j->second.end(); ++k )
00219 ( *k ) ->calculateString( result, false );
00220 }
00221 return result;
00222
00223 QF_STACK_POP
00224 }
|
|
|
Definition at line 250 of file FieldMap.cpp. References QF_STACK_POP, and QF_STACK_PUSH. Referenced by FIX::Message::checkSum().
00251 { QF_STACK_PUSH(FieldMap::calculateTotal)
00252
00253 int result = 0;
00254 Fields::const_iterator i;
00255 for ( i = m_fields.begin(); i != m_fields.end(); ++i )
00256 {
00257 if ( i->first != checkSumField )
00258 result += i->second.getTotal();
00259 }
00260
00261 Groups::const_iterator j;
00262 for ( j = m_groups.begin(); j != m_groups.end(); ++j )
00263 {
00264 std::vector < FieldMap* > ::const_iterator k;
00265 for ( k = j->second.begin(); k != j->second.end(); ++k )
00266 result += ( *k ) ->calculateTotal();
00267 }
00268 return result;
00269
00270 QF_STACK_POP
00271 }
|
|
|
Clear all fields from the map.
Reimplemented in FIX::Message. Definition at line 176 of file FieldMap.cpp. References QF_STACK_POP, and QF_STACK_PUSH. Referenced by FIX::Message::clear(), FIX::Message::getGroup(), operator=(), and ~FieldMap().
00177 { QF_STACK_PUSH(FieldMap::clear)
00178
00179 m_fields.clear();
00180
00181 Groups::iterator i;
00182 for ( i = m_groups.begin(); i != m_groups.end(); ++i )
00183 {
00184 std::vector < FieldMap* > ::iterator j;
00185 for ( j = i->second.begin(); j != i->second.end(); ++j )
00186 delete *j;
00187 }
00188 m_groups.clear();
00189
00190 QF_STACK_POP
00191 }
|
|
|
Definition at line 158 of file FieldMap.h. References iterator. Referenced by FIX::DataDictionary::iterate(), and FIX::Message::toXMLFields().
00158 { return m_fields.end(); }
|
|
|
Definition at line 159 of file FieldMap.h. References g_iterator. Referenced by FIX::Message::toXMLFields().
00159 { return m_groups.begin(); }
|
|
|
Definition at line 160 of file FieldMap.h. References g_iterator. Referenced by FIX::Message::toXMLFields().
00160 { return m_groups.end(); }
|
|
|
Get a field without a field class.
Definition at line 104 of file FieldMap.h. References getField(), and FIX::FieldBase::getString().
00106 {
00107 FieldBase fieldBase( field, "" );
00108 getField( fieldBase );
00109 return fieldBase.getString();
00110 }
|
|
|
||||||||||||||||
|
Get a specific instance of a group.
Definition at line 85 of file FieldMap.cpp. References QF_STACK_POP, and QF_STACK_PUSH.
00087 { QF_STACK_PUSH(FieldMap::getGroup)
00088
00089 Groups::const_iterator i = m_groups.find( field );
00090 if ( i == m_groups.end() ) throw FieldNotFound( field );
00091 if ( num <= 0 ) throw FieldNotFound( field );
00092 if ( i->second.size() < ( unsigned ) num ) throw FieldNotFound( field );
00093 group = *( *( i->second.begin() + ( num - 1 ) ) );
00094 return group;
00095
00096 QF_STACK_POP
00097 }
|
|
|
Count the number of instance of a group.
Definition at line 165 of file FieldMap.cpp. References QF_STACK_POP, and QF_STACK_PUSH. Referenced by hasGroup(), and removeGroup().
00166 { QF_STACK_PUSH(FieldMap::groupCount)
00167
00168 Groups::const_iterator i = m_groups.find( field );
00169 if( i == m_groups.end() )
00170 return 0;
00171 return i->second.size();
00172
00173 QF_STACK_POP
00174 }
|
|
||||||||||||
|
Check to see if a specific instance of a group exists.
Definition at line 148 of file FieldMap.cpp. References groupCount(), QF_STACK_POP, and QF_STACK_PUSH.
00149 { QF_STACK_PUSH(FieldMap::hasGroup)
00150
00151 return groupCount(field) >= num;
00152
00153 QF_STACK_POP
00154 }
|
|
|
Check to see any instance of a group exists.
Definition at line 156 of file FieldMap.cpp. References QF_STACK_POP, and QF_STACK_PUSH.
00157 { QF_STACK_PUSH(FieldMap::hasGroup)
00158
00159 Groups::const_iterator i = m_groups.find( field );
00160 return i != m_groups.end();
00161
00162 QF_STACK_POP
00163 }
|
|
|
Check if map contains any fields.
Reimplemented in FIX::Message. Definition at line 193 of file FieldMap.cpp. References QF_STACK_POP, and QF_STACK_PUSH. Referenced by FIX::Message::isEmpty().
00194 { QF_STACK_PUSH(FieldMap::isEmpty)
00195 return m_fields.size() == 0;
00196 QF_STACK_POP
00197 }
|
|
|
Check to see if a field is set by referencing its number.
Definition at line 116 of file FieldMap.h.
|
|
|
Check to see if a field is set.
Definition at line 113 of file FieldMap.h. References FIX::FieldBase::getField(). Referenced by FIX::Session::doPossDup(), FIX::Session::doTargetTooLow(), FIX::Session::generateReject(), FIX::Message::isAdmin(), FIX::Message::isApp(), FIX::Message::Message::extractField(), FIX::Session::nextLogon(), FIX::Session::nextSequenceReset(), FIX::Message::reverseRoute(), and FIX::Session::sendRaw().
|
|
|
Definition at line 39 of file FieldMap.cpp. References addGroup(), clear(), m_fields, m_groups, QF_STACK_POP, and QF_STACK_PUSH.
00040 { QF_STACK_PUSH(FieldMap::operator=)
00041
00042 clear();
00043
00044 std::copy( rhs.m_fields.begin (), rhs.m_fields.end(),
00045 std::inserter(m_fields, m_fields.begin()) );
00046
00047 Groups::const_iterator i;
00048 for ( i = rhs.m_groups.begin(); i != rhs.m_groups.end(); ++i )
00049 {
00050 std::vector < FieldMap* > ::const_iterator j;
00051 for ( j = i->second.begin(); j != i->second.end(); ++j )
00052 addGroup( i->first, **j );
00053 }
00054
00055 return *this;
00056
00057 QF_STACK_POP
00058 }
|
|
|
Remove a field. If field is not present, this is a no-op.
Definition at line 138 of file FieldMap.cpp. References QF_STACK_POP, and QF_STACK_PUSH. Referenced by FIX::Message::reverseRoute(), and FIX::Session::send().
00139 { QF_STACK_PUSH(FieldMap::removeField)
00140
00141 Fields::iterator i = m_fields.find( field );
00142 if ( i != m_fields.end() )
00143 m_fields.erase( i );
00144
00145 QF_STACK_POP
00146 }
|
|
|
Remove all instances of a group.
Definition at line 132 of file FieldMap.cpp. References groupCount(), QF_STACK_POP, QF_STACK_PUSH, and removeGroup().
00133 { QF_STACK_PUSH(FieldMap::removeGroup)
00134 removeGroup( groupCount(field), field );
00135 QF_STACK_POP
00136 }
|
|
||||||||||||
|
Remove a specific instance of a group.
Definition at line 99 of file FieldMap.cpp. References groupCount(), and setField(). Referenced by removeGroup().
00100 {
00101 Groups::iterator i = m_groups.find( field );
00102 if ( i == m_groups.end() ) return;
00103 if ( num <= 0 ) return;
00104 std::vector< FieldMap* >& vector = i->second;
00105 if ( vector.size() < ( unsigned ) num ) return;
00106
00107 std::deque< FieldMap* > queue;
00108 while( vector.size() > (unsigned)num )
00109 {
00110 queue.push_back( vector.back() );
00111 vector.pop_back();
00112 }
00113 delete vector.back();
00114 vector.pop_back();
00115 while( queue.size() )
00116 {
00117 vector.push_back( queue.front() );
00118 queue.pop_front();
00119 }
00120
00121 if( vector.size() == 0 )
00122 {
00123 m_groups.erase( field );
00124 }
00125 else
00126 {
00127 IntField groupCount( field, vector.size() );
00128 setField( groupCount, true );
00129 }
00130 }
|
|
||||||||||||||||
|
Replace a specific instanct of a group.
Definition at line 73 of file FieldMap.cpp. References QF_STACK_POP, and QF_STACK_PUSH.
00074 { QF_STACK_PUSH(FieldMap::replaceGroup)
00075
00076 Groups::const_iterator i = m_groups.find( field );
00077 if ( i == m_groups.end() ) return;
00078 if ( num <= 0 ) return;
00079 if ( i->second.size() < ( unsigned ) num ) return;
00080 *( *( i->second.begin() + ( num - 1 ) ) ) = group;
00081
00082 QF_STACK_POP
00083 }
|
|
||||||||||||
|
Set a field without a field class.
Definition at line 86 of file FieldMap.h. References setField().
00088 {
00089 FieldBase fieldBase( field, value );
00090 setField( fieldBase );
00091 }
|
|
||||||||||||
|
|
Definition at line 163 of file FieldMap.h. Referenced by addGroup(), and operator=(). |
|
|
Definition at line 164 of file FieldMap.h. Referenced by operator=(). |
1.3.6-20040222 written by Dimitri van Heesch,
© 1997-2001