fix8  version 1.4.0
Open Source C++ FIX Framework
FIX8::Field< MonthYear, field > Class Template Reference

Partial specialisation for MonthYear field type. More...

#include <field.hpp>

Inheritance diagram for FIX8::Field< MonthYear, field >:
FIX8::BaseField

Public Member Functions

FieldTrait::FieldType get_underlying_type () const
 The FieldType. More...
 
 Field ()
 Ctor. More...
 
 Field (const Field &from)
 Copy Ctor. More...
 
 Field (const f8String &from, const RealmBase *rlm=nullptr)
 
 Field (const char *from, const RealmBase *rlm=nullptr)
 
 Field (const tm &from, const RealmBase *rlm=nullptr)
 
 ~Field ()
 Dtor. More...
 
Fieldoperator= (const Field &that)
 Assignment operator. More...
 
bool operator== (const BaseField &that) const
 Equivalence operator. More...
 
bool operator< (const BaseField &that) const
 Less than operator. More...
 
virtual bool operator> (const BaseField &that) const
 Greater than operator. More...
 
const Tickvalget () const
 
const Tickvaloperator() () const
 
void set (const Tickval &from)
 
Fieldcopy ()
 
std::ostream & print (std::ostream &os) const
 
size_t print (char *to) const
 
- Public Member Functions inherited from FIX8::BaseField
 BaseField (unsigned short fnum, const RealmBase *rlm=nullptr)
 
virtual ~BaseField ()
 Dtor. More...
 
unsigned short get_tag () const
 
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...
 
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
 

Static Public Member Functions

static unsigned short get_field_id ()
 Get the FIX fieldID (tag number). More...
 

Private Attributes

size_t _sz
 
Tickval _value
 

Static Private Attributes

static const FieldTrait::FieldType _ftype = FieldTrait::ft_string
 

Additional Inherited Members

- Protected Attributes inherited from FIX8::BaseField
const RealmBase_rlm
 

Detailed Description

template<unsigned short field>
class FIX8::Field< MonthYear, field >

Partial specialisation for MonthYear field type.

Template Parameters
fieldfield number (fix tag)

Definition at line 1450 of file field.hpp.

Constructor & Destructor Documentation

template<unsigned short field>
FIX8::Field< MonthYear, field >::Field ( )
inline

Ctor.

Definition at line 1464 of file field.hpp.

1464 : BaseField(field) {}
BaseField(unsigned short fnum, const RealmBase *rlm=nullptr)
Definition: field.hpp:138
template<unsigned short field>
FIX8::Field< MonthYear, field >::Field ( const Field< MonthYear, field > &  from)
inline

Copy Ctor.

Definition at line 1468 of file field.hpp.

1468 : BaseField(field), _sz(from._sz), _value(from._value) {}
BaseField(unsigned short fnum, const RealmBase *rlm=nullptr)
Definition: field.hpp:138
template<unsigned short field>
FIX8::Field< MonthYear, field >::Field ( const f8String from,
const RealmBase rlm = nullptr 
)
inline

Construct from string ctor.

Parameters
fromstring to construct field from
rlmpointer to the realmbase for this field (if available)

Definition at line 1473 of file field.hpp.

1473 : BaseField(field), _sz(from.size()), _value(date_parse(from.data(), _sz)) {}
Tickval::ticks date_parse(const char *ptr, size_t len)
Definition: field.hpp:1010
BaseField(unsigned short fnum, const RealmBase *rlm=nullptr)
Definition: field.hpp:138
template<unsigned short field>
FIX8::Field< MonthYear, field >::Field ( const char *  from,
const RealmBase rlm = nullptr 
)
inline

Construct from char * ctor.

Parameters
fromchar * to construct field from
rlmpointer to the realmbase for this field (if available)

Definition at line 1478 of file field.hpp.

1478 : BaseField(field), _sz(from ? ::strlen(from) : 0), _value(date_parse(from, _sz)) {}
Tickval::ticks date_parse(const char *ptr, size_t len)
Definition: field.hpp:1010
BaseField(unsigned short fnum, const RealmBase *rlm=nullptr)
Definition: field.hpp:138
template<unsigned short field>
FIX8::Field< MonthYear, field >::Field ( const tm &  from,
const RealmBase rlm = nullptr 
)
inline

Construct from tm struct

Parameters
fromstring to construct field from
rlmtm struct with broken out values

Definition at line 1483 of file field.hpp.

BaseField(unsigned short fnum, const RealmBase *rlm=nullptr)
Definition: field.hpp:138
static const ticks billion
Definition: tickval.hpp:77
time_t time_to_epoch(const tm &ltm, int utcdiff=0)
Definition: field.hpp:858
template<unsigned short field>
FIX8::Field< MonthYear, field >::~Field ( )
inline

Dtor.

Definition at line 1486 of file field.hpp.

1486 {}

Member Function Documentation

template<unsigned short field>
Field* FIX8::Field< MonthYear, field >::copy ( )
inlinevirtual

Copy (clone) this field.

Returns
copy of field

Implements FIX8::BaseField.

Definition at line 1530 of file field.hpp.

References FIX8::Field< T, field >::Field().

1530 { return new Field(*this); }
template<unsigned short field>
const Tickval& FIX8::Field< MonthYear, field >::get ( ) const
inline

Get field value.

Returns
value Tickval&

Definition at line 1518 of file field.hpp.

1518 { return _value; }
template<unsigned short field>
static unsigned short FIX8::Field< MonthYear, field >::get_field_id ( )
inlinestatic

Get the FIX fieldID (tag number).

Definition at line 1458 of file field.hpp.

1458 { return field; }
template<unsigned short field>
FieldTrait::FieldType FIX8::Field< MonthYear, field >::get_underlying_type ( ) const
inlinevirtual

The FieldType.

Implements FIX8::BaseField.

Definition at line 1461 of file field.hpp.

1461 { return _ftype; }
static const FieldTrait::FieldType _ftype
Definition: field.hpp:1454
template<unsigned short field>
const Tickval& FIX8::Field< MonthYear, field >::operator() ( ) const
inline

Get field value.

Returns
value Tickval&

Definition at line 1522 of file field.hpp.

1522 { return _value; }
template<unsigned short field>
bool FIX8::Field< MonthYear, field >::operator< ( const BaseField< MonthYear, field > &  that) const
inlinevirtual

Less than operator.

Parameters
thatfield to compare
Returns
true if less than

Implements FIX8::BaseField.

Definition at line 1507 of file field.hpp.

References FIX8::BaseField::same_base().

1508  { return same_base(that) && _value < static_cast<const Field<MonthYear, field>&>(that)._value; }
bool same_base(const BaseField &that) const
BaseField Equivalence test.
Definition: field.hpp:207
template<unsigned short field>
Field& FIX8::Field< MonthYear, field >::operator= ( const Field< MonthYear, field > &  that)
inline

Assignment operator.

Parameters
thatfield to assign from
Returns
field

Definition at line 1491 of file field.hpp.

1492  {
1493  if (this != &that)
1494  _value = that._value;
1495  return *this;
1496  }
f8_time_point _value
Definition: tickval.hpp:85
template<unsigned short field>
bool FIX8::Field< MonthYear, field >::operator== ( const BaseField< MonthYear, field > &  that) const
inlinevirtual

Equivalence operator.

Parameters
thatfield to compare
Returns
true if same

Implements FIX8::BaseField.

Definition at line 1501 of file field.hpp.

References FIX8::BaseField::same_base().

1502  { return same_base(that) && static_cast<const Field<MonthYear, field>&>(that)._value == _value; }
bool same_base(const BaseField &that) const
BaseField Equivalence test.
Definition: field.hpp:207
template<unsigned short field>
virtual bool FIX8::Field< MonthYear, field >::operator> ( const BaseField< MonthYear, field > &  that) const
inlinevirtual

Greater than operator.

Parameters
thatfield to compare
Returns
true if greater than

Implements FIX8::BaseField.

Definition at line 1513 of file field.hpp.

References FIX8::BaseField::same_base().

1514  { return same_base(that) && _value > static_cast<const Field<MonthYear, field>&>(that)._value; }
bool same_base(const BaseField &that) const
BaseField Equivalence test.
Definition: field.hpp:207
template<unsigned short field>
std::ostream& FIX8::Field< MonthYear, field >::print ( std::ostream &  os) const
inlinevirtual

Print this field to the supplied stream. Used to format for FIX output.

Parameters
osstream to insert to
Returns
stream

Implements FIX8::BaseField.

Definition at line 1535 of file field.hpp.

References FIX8::MAX_MSGTYPE_FIELD_LEN(), and FIX8::BaseField::print().

1536  {
1537  char buf[MAX_MSGTYPE_FIELD_LEN] {};
1538  print(buf);
1539  return os << buf;
1540  }
std::ostream & print(std::ostream &os) const
Definition: field.hpp:1535
const size_t MAX_MSGTYPE_FIELD_LEN(32)
template<unsigned short field>
size_t FIX8::Field< MonthYear, field >::print ( char *  to) const
inlinevirtual

Print this field to the supplied buffer.

Parameters
tobuffer to print to
Returns
number bytes encoded

Implements FIX8::BaseField.

Definition at line 1545 of file field.hpp.

References FIX8::_date_only, FIX8::_short_date_only, and FIX8::date_time_format().

1545 { return date_time_format(_value, to, _sz == 6 ? _short_date_only : _date_only); }
size_t date_time_format(const Tickval &tickval, char *to, TimeIndicator ind)
Definition: field.hpp:895
template<unsigned short field>
void FIX8::Field< MonthYear, field >::set ( const Tickval from)
inline

Set field to the supplied value.

Parameters
fromvalue to set

Definition at line 1526 of file field.hpp.

References FIX8::BaseField::from().

1526 { _value = from; }

Member Data Documentation

template<unsigned short field>
const FieldTrait::FieldType FIX8::Field< MonthYear, field >::_ftype = FieldTrait::ft_string
staticprivate

Definition at line 1454 of file field.hpp.

template<unsigned short field>
size_t FIX8::Field< MonthYear, field >::_sz
private

Definition at line 1452 of file field.hpp.

template<unsigned short field>
Tickval FIX8::Field< MonthYear, field >::_value
private

Definition at line 1453 of file field.hpp.


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