fix8  version 1.4.0
Open Source C++ FIX Framework
FIX8::BaseField Class Referenceabstract

The base field class (ABC) for all fields. More...

#include <field.hpp>

Inheritance diagram for FIX8::BaseField:
FIX8::Field< f8String, Common_BeginString > FIX8::Field< f8String, Common_DefaultApplVerID > FIX8::Field< f8String, Common_SenderCompID > FIX8::Field< f8String, Common_TargetCompID > FIX8::Field< T, field > FIX8::Field< Boolean, field > FIX8::Field< char *, field > FIX8::Field< char, field > FIX8::Field< f8String, field > FIX8::Field< fp_type, field > FIX8::Field< int, field > FIX8::Field< LocalMktDate, field > FIX8::Field< MonthYear, field > FIX8::Field< TZTimeOnly, field > FIX8::Field< TZTimestamp, field > FIX8::Field< UTCDateOnly, field > FIX8::Field< UTCTimeOnly, field > FIX8::Field< UTCTimestamp, field >

Public Member Functions

 BaseField (unsigned short fnum, const RealmBase *rlm=nullptr)
 
virtual ~BaseField ()
 Dtor. More...
 
unsigned short get_tag () const
 
virtual std::ostream & print (std::ostream &os) const =0
 
virtual size_t print (char *to) const =0
 
virtual FieldTrait::FieldType get_underlying_type () const =0
 
virtual BaseFieldcopy ()=0
 
virtual int get_rlm_idx () const
 
template<typename T >
T & from ()
 
template<typename T >
const T * as () const
 
size_t encode (std::ostream &os) const
 
size_t encode (char *to) const
 
bool same_base (const BaseField &that) const
 BaseField Equivalence test. More...
 
virtual bool operator== (const BaseField &that) const =0
 Equivalence operator. More...
 
virtual bool operator< (const BaseField &that) const =0
 Less than operator. More...
 
virtual bool operator> (const BaseField &that) const =0
 Greater than operator. More...
 
bool operator!= (const BaseField &that) const
 Inequivalence operator. More...
 
bool operator<= (const BaseField &that) const
 Less or equal to operator. More...
 
bool operator>= (const BaseField &that) const
 Greater or equal to operator. More...
 
const RealmBaseget_realm () const
 

Protected Attributes

const RealmBase_rlm
 

Private Attributes

const unsigned short _fnum
 

Friends

class MessageBase
 
std::ostream & operator<< (std::ostream &os, const BaseField &what)
 

Detailed Description

The base field class (ABC) for all fields.

Definition at line 127 of file field.hpp.

Constructor & Destructor Documentation

FIX8::BaseField::BaseField ( unsigned short  fnum,
const RealmBase rlm = nullptr 
)
inline

Ctor.

Parameters
fnumfield num for this field
rlmpointer to the realmbase for this field (if available)

Definition at line 138 of file field.hpp.

138 : _fnum(fnum), _rlm(rlm) {}
const RealmBase * _rlm
Definition: field.hpp:132
const unsigned short _fnum
Definition: field.hpp:129
virtual FIX8::BaseField::~BaseField ( )
inlinevirtual

Dtor.

Definition at line 141 of file field.hpp.

141 {}

Member Function Documentation

template<typename T >
const T* FIX8::BaseField::as ( ) const
inline

Cast this field to the supplied type.

Template Parameters
Ttarget type
Returns
pointer to the cast field

Definition at line 179 of file field.hpp.

179 { return static_cast<T*>(this); }
size_t FIX8::BaseField::encode ( std::ostream &  os) const
inline

Encode this field to the supplied stream.

Parameters
osstream to encode to
Returns
the number of bytes encoded

Definition at line 184 of file field.hpp.

References FIX8::default_assignment_separator(), and FIX8::default_field_separator().

185  {
186  const std::ios::pos_type where(os.tellp());
188  return os.tellp() - where;
189  }
const unsigned char default_assignment_separator('=')
default FIX assignment separator (=)
const unsigned short _fnum
Definition: field.hpp:129
const unsigned char default_field_separator(0x1)
default FIX field separator (^A)
size_t FIX8::BaseField::encode ( char *  to) const
inline

Encode this field to the supplied stream. ULL version.

Parameters
tobuffer to encode to
Returns
the number of bytes encoded

Definition at line 194 of file field.hpp.

References FIX8::default_assignment_separator(), FIX8::default_field_separator(), FIX8::itoa(), and print().

195  {
196  const char *cur_ptr(to);
197  to += itoa(_fnum, to, 10);
199  to += print(to);
200  *to++ = default_field_separator;
201  return to - cur_ptr;
202  }
size_t itoa(T value, char *result, int base)
Fast itoa.
Definition: f8utils.hpp:647
const unsigned char default_assignment_separator('=')
default FIX assignment separator (=)
const unsigned short _fnum
Definition: field.hpp:129
const unsigned char default_field_separator(0x1)
default FIX field separator (^A)
virtual std::ostream & print(std::ostream &os) const =0
const RealmBase* FIX8::BaseField::get_realm ( ) const
inline

Get the realm pointer for this field.

Returns
the realm pointer

Definition at line 241 of file field.hpp.

References _rlm.

241 { return _rlm; }
const RealmBase * _rlm
Definition: field.hpp:132
virtual int FIX8::BaseField::get_rlm_idx ( ) const
inlinevirtual

Get the realm index of this field.

Returns
the realm index

Reimplemented in FIX8::Field< Boolean, field >, FIX8::Field< char, field >, FIX8::Field< fp_type, field >, FIX8::Field< f8String, field >, FIX8::Field< char *, field >, and FIX8::Field< int, field >.

Definition at line 167 of file field.hpp.

167 { return -1; }
unsigned short FIX8::BaseField::get_tag ( ) const
inline

Get the fix tag id of this field.

Returns
fix tag id (field num)

Definition at line 145 of file field.hpp.

References _fnum.

Referenced by FIX8::ConsoleMenu::EditMsg().

145 { return _fnum; }
const unsigned short _fnum
Definition: field.hpp:129
bool FIX8::BaseField::operator!= ( const BaseField that) const
inline

Inequivalence operator.

Parameters
thatfield to compare
Returns
true if not the same

Definition at line 227 of file field.hpp.

227 { return !(*this == that); }
bool FIX8::BaseField::operator<= ( const BaseField that) const
inline

Less or equal to operator.

Parameters
thatfield to compare
Returns
true if less than or equal to

Definition at line 232 of file field.hpp.

232 { return *this < that || *this == that; }
bool FIX8::BaseField::operator>= ( const BaseField that) const
inline

Greater or equal to operator.

Parameters
thatfield to compare
Returns
true if greater than or equal to

Definition at line 237 of file field.hpp.

237 { return *this > that || *this == that; }
bool FIX8::BaseField::same_base ( const BaseField that) const
inline

BaseField Equivalence test.

Parameters
thatfield to compare
Returns
true if same

Definition at line 207 of file field.hpp.

References _fnum.

Referenced by FIX8::Field< int, field >::operator<(), FIX8::Field< f8String, field >::operator<(), FIX8::Field< fp_type, field >::operator<(), FIX8::Field< char, field >::operator<(), FIX8::Field< UTCTimestamp, field >::operator<(), FIX8::Field< UTCTimeOnly, field >::operator<(), FIX8::Field< UTCDateOnly, field >::operator<(), FIX8::Field< LocalMktDate, field >::operator<(), FIX8::Field< MonthYear, field >::operator<(), FIX8::Field< TZTimeOnly, field >::operator<(), FIX8::Field< TZTimestamp, field >::operator<(), FIX8::Field< Boolean, field >::operator<(), FIX8::Field< int, field >::operator==(), FIX8::Field< f8String, field >::operator==(), FIX8::Field< fp_type, field >::operator==(), FIX8::Field< char, field >::operator==(), FIX8::Field< UTCTimestamp, field >::operator==(), FIX8::Field< UTCTimeOnly, field >::operator==(), FIX8::Field< UTCDateOnly, field >::operator==(), FIX8::Field< LocalMktDate, field >::operator==(), FIX8::Field< MonthYear, field >::operator==(), FIX8::Field< TZTimeOnly, field >::operator==(), FIX8::Field< TZTimestamp, field >::operator==(), FIX8::Field< Boolean, field >::operator==(), FIX8::Field< int, field >::operator>(), FIX8::Field< f8String, field >::operator>(), FIX8::Field< fp_type, field >::operator>(), FIX8::Field< char, field >::operator>(), FIX8::Field< UTCTimestamp, field >::operator>(), FIX8::Field< UTCTimeOnly, field >::operator>(), FIX8::Field< UTCDateOnly, field >::operator>(), FIX8::Field< LocalMktDate, field >::operator>(), FIX8::Field< MonthYear, field >::operator>(), FIX8::Field< TZTimeOnly, field >::operator>(), FIX8::Field< TZTimestamp, field >::operator>(), and FIX8::Field< Boolean, field >::operator>().

207 { return that._fnum == _fnum; }
const unsigned short _fnum
Definition: field.hpp:129

Friends And Related Function Documentation

friend class MessageBase
friend

Definition at line 248 of file field.hpp.

std::ostream& operator<< ( std::ostream &  os,
const BaseField what 
)
friend

Inserter friend.

Parameters
osstream to send to
whatBaseField reference
Returns
stream

Definition at line 247 of file field.hpp.

247 { return what.print(os); }

Member Data Documentation

const unsigned short FIX8::BaseField::_fnum
private

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