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

Partial specialisation for Boolean field type. More...

#include <field.hpp>

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

Public Member Functions

FieldTrait::FieldType get_underlying_type () const
 The FieldType. More...
 
 Field ()
 Ctor. More...
 
 Field (const char val, const RealmBase *rlm=nullptr)
 
 Field (const bool val)
 
 Field (const Field &from)
 Copy Ctor. More...
 
 Field (const f8String &from, const RealmBase *rlm=nullptr)
 
 Field (const char *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...
 
bool operator> (const BaseField &that) const
 Greater than operator. More...
 
bool get () const
 
bool operator() () const
 
int get_rlm_idx () const
 
bool set (const bool from)
 
bool set_from_raw (const f8String &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
 
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

bool _value
 

Static Private Attributes

static const FieldTrait::FieldType _ftype = FieldTrait::ft_char
 

Additional Inherited Members

- Protected Attributes inherited from FIX8::BaseField
const RealmBase_rlm
 

Detailed Description

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

Partial specialisation for Boolean field type.

Template Parameters
fieldfield number (fix tag)

Definition at line 1915 of file field.hpp.

Constructor & Destructor Documentation

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

Ctor.

Definition at line 1928 of file field.hpp.

1928 : BaseField(field) {}
BaseField(unsigned short fnum, const RealmBase *rlm=nullptr)
Definition: field.hpp:138
template<unsigned short field>
FIX8::Field< Boolean, field >::Field ( const char  val,
const RealmBase rlm = nullptr 
)
inline

Value ctor.

Parameters
valvalue to set
rlmpointer to the realmbase for this field (if available)

Definition at line 1933 of file field.hpp.

1933 : BaseField(field, rlm), _value(toupper(val) == 'Y') {}
BaseField(unsigned short fnum, const RealmBase *rlm=nullptr)
Definition: field.hpp:138
template<unsigned short field>
FIX8::Field< Boolean, field >::Field ( const bool  val)
inlineexplicit

Value ctor.

Parameters
valvalue to set

Definition at line 1937 of file field.hpp.

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

Copy Ctor.

Definition at line 1941 of file field.hpp.

1941 : BaseField(field), _value(from._value) {}
BaseField(unsigned short fnum, const RealmBase *rlm=nullptr)
Definition: field.hpp:138
template<unsigned short field>
FIX8::Field< Boolean, 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 1946 of file field.hpp.

1946 : BaseField(field, rlm), _value(toupper(from[0]) == 'Y') {}
BaseField(unsigned short fnum, const RealmBase *rlm=nullptr)
Definition: field.hpp:138
template<unsigned short field>
FIX8::Field< Boolean, 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 1951 of file field.hpp.

1951 : BaseField(field, rlm), _value(toupper(*from) == 'Y') {}
BaseField(unsigned short fnum, const RealmBase *rlm=nullptr)
Definition: field.hpp:138
template<unsigned short field>
FIX8::Field< Boolean, field >::~Field ( )
inline

Dtor.

Definition at line 1954 of file field.hpp.

1954 {}

Member Function Documentation

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

Copy (clone) this field.

Returns
copy of field

Implements FIX8::BaseField.

Definition at line 2008 of file field.hpp.

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

2008 { return new Field(*this); }
template<unsigned short field>
bool FIX8::Field< Boolean, field >::get ( ) const
inline

Get field value.

Returns
value (bool)

Definition at line 1986 of file field.hpp.

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

Get the FIX fieldID (tag number).

Definition at line 1922 of file field.hpp.

1922 { return field; }
template<unsigned short field>
int FIX8::Field< Boolean, field >::get_rlm_idx ( ) const
inlinevirtual

Get the realm index of this value in the domain set.

Returns
the index in the domain set of this value

Reimplemented from FIX8::BaseField.

Definition at line 1994 of file field.hpp.

References FIX8::BaseField::_rlm, and FIX8::RealmBase::get_rlm_idx().

1994 { return _rlm ? _rlm->get_rlm_idx(_value ? 'Y' : 'N') : -1; }
const RealmBase * _rlm
Definition: field.hpp:132
int get_rlm_idx(const T &what) const
Definition: field.hpp:94
template<unsigned short field>
FieldTrait::FieldType FIX8::Field< Boolean, field >::get_underlying_type ( ) const
inlinevirtual

The FieldType.

Implements FIX8::BaseField.

Definition at line 1925 of file field.hpp.

1925 { return _ftype; }
static const FieldTrait::FieldType _ftype
Definition: field.hpp:1918
template<unsigned short field>
bool FIX8::Field< Boolean, field >::operator() ( ) const
inline

Get field value.

Returns
value (bool)

Definition at line 1990 of file field.hpp.

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

Less than operator.

Parameters
thatfield to compare
Returns
true if less than

Implements FIX8::BaseField.

Definition at line 1975 of file field.hpp.

References FIX8::BaseField::same_base().

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

Assignment operator.

Parameters
thatfield to assign from
Returns
field

Definition at line 1959 of file field.hpp.

1960  {
1961  if (this != &that)
1962  _value = that._value;
1963  return *this;
1964  }
template<unsigned short field>
bool FIX8::Field< Boolean, field >::operator== ( const BaseField< Boolean, field > &  that) const
inlinevirtual

Equivalence operator.

Parameters
thatfield to compare
Returns
true if same

Implements FIX8::BaseField.

Definition at line 1969 of file field.hpp.

References FIX8::BaseField::same_base().

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

Greater than operator.

Parameters
thatfield to compare
Returns
true if greater than

Implements FIX8::BaseField.

Definition at line 1981 of file field.hpp.

References FIX8::BaseField::same_base().

1982  { return same_base(that) && _value > static_cast<const Field<Boolean, 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< Boolean, 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 2013 of file field.hpp.

2013 { return os << (_value ? 'Y' : 'N'); }
template<unsigned short field>
size_t FIX8::Field< Boolean, 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 2018 of file field.hpp.

2018 { *to = _value ? 'Y' : 'N'; return 1; }
template<unsigned short field>
bool FIX8::Field< Boolean, field >::set ( const bool  from)
inline

Get field value.

Parameters
fromvalue to set
Returns
original value (bool)

Definition at line 1999 of file field.hpp.

References FIX8::BaseField::from().

1999 { return _value = from; }
template<unsigned short field>
bool FIX8::Field< Boolean, field >::set_from_raw ( const f8String from)
inline

Set the value from a string.

Parameters
fromvalue to set
Returns
original value (bool)

Definition at line 2004 of file field.hpp.

2004 { return _value = toupper(from[0]) == 'Y'; }

Member Data Documentation

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

Definition at line 1918 of file field.hpp.

template<unsigned short field>
bool FIX8::Field< Boolean, field >::_value
private

Definition at line 1917 of file field.hpp.


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