fix8  version 1.4.0
Open Source C++ FIX Framework
FIX8::FieldTrait Struct Reference

Used for static trait interrogation. More...

#include <traits.hpp>

Classes

struct  Compare
 Binary comparitor functor. More...
 
struct  PosCompare
 Binary position comparitor functor. More...
 

Public Types

enum  FieldType {
  ft_untyped, ft_int, ft_Length, ft_TagNum,
  ft_SeqNum, ft_NumInGroup, ft_DayOfMonth, ft_end_int =ft_DayOfMonth,
  ft_char, ft_Boolean, ft_end_char =ft_Boolean, ft_float,
  ft_Qty, ft_Price, ft_PriceOffset, ft_Amt,
  ft_Percentage, ft_end_float =ft_Percentage, ft_string, ft_MultipleCharValue,
  ft_MultipleStringValue, ft_Country, ft_Currency, ft_Exchange,
  ft_MonthYear, ft_UTCTimestamp, ft_UTCTimeOnly, ft_UTCDateOnly,
  ft_LocalMktDate, ft_TZTimeOnly, ft_TZTimestamp, ft_data,
  ft_XMLData, ft_pattern, ft_Tenor, ft_Reserved100Plus,
  ft_Reserved1000Plus, ft_Reserved4000Plus, ft_Language, ft_end_string =ft_Language
}
 
enum  TraitTypes {
  mandatory, present, position, group,
  component, suppress, automatic, count
}
 Trait bits. More...
 

Public Member Functions

 FieldTrait ()=default
 Ctor. More...
 
 FieldTrait (const FieldTrait &from)
 Copy Ctor. More...
 
 FieldTrait (unsigned short fnum, unsigned ftype, unsigned short pos, unsigned short compon, unsigned short field_traits)
 
 FieldTrait (const unsigned short field)
 
 FieldTrait (const unsigned short field, const FieldType ftype, const unsigned short pos=0, bool ismandatory=false, bool isgroup=false, const unsigned compon=0, bool ispresent=false)
 

Static Public Member Functions

static bool is_int (FieldType ftype)
 
static bool is_char (FieldType ftype)
 
static bool is_float (FieldType ftype)
 
static bool is_string (FieldType ftype)
 
static FieldType underlying_type (FieldType ftype)
 
static F8API std::string & get_type_string (FieldType ftype, std::string &to)
 

Public Attributes

unsigned short _fnum
 
FieldType _ftype
 
unsigned short _pos
 
unsigned short _component
 
ebitset< TraitTypes, unsigned short > _field_traits
 

Friends

F8API std::ostream & operator<< (std::ostream &os, const FieldTrait &what)
 

Detailed Description

Used for static trait interrogation.

FIX field traits - hold specific traits for each field.

Definition at line 57 of file traits.hpp.

Member Enumeration Documentation

Enumerator
ft_untyped 
ft_int 
ft_Length 
ft_TagNum 
ft_SeqNum 
ft_NumInGroup 
ft_DayOfMonth 
ft_end_int 
ft_char 
ft_Boolean 
ft_end_char 
ft_float 
ft_Qty 
ft_Price 
ft_PriceOffset 
ft_Amt 
ft_Percentage 
ft_end_float 
ft_string 
ft_MultipleCharValue 
ft_MultipleStringValue 
ft_Country 
ft_Currency 
ft_Exchange 
ft_MonthYear 
ft_UTCTimestamp 
ft_UTCTimeOnly 
ft_UTCDateOnly 
ft_LocalMktDate 
ft_TZTimeOnly 
ft_TZTimestamp 
ft_data 
ft_XMLData 
ft_pattern 
ft_Tenor 
ft_Reserved100Plus 
ft_Reserved1000Plus 
ft_Reserved4000Plus 
ft_Language 
ft_end_string 

Definition at line 59 of file traits.hpp.

60  {
61  ft_untyped,
62  ft_int,
64  ft_char,
66  ft_float,
68  ft_string,
72  ft_pattern,
74  ft_Language, ft_end_string=ft_Language
75  };

Constructor & Destructor Documentation

FIX8::FieldTrait::FieldTrait ( )
default

Ctor.

FIX8::FieldTrait::FieldTrait ( const FieldTrait from)
inline

Copy Ctor.

Definition at line 112 of file traits.hpp.

112  : _fnum(from._fnum), _ftype(from._ftype), _pos(from._pos),
113  _component(from._component), _field_traits(from._field_traits) {}
unsigned short _component
Definition: traits.hpp:154
unsigned short _fnum
Definition: traits.hpp:152
ebitset< TraitTypes, unsigned short > _field_traits
Definition: traits.hpp:155
unsigned short _pos
Definition: traits.hpp:154
FieldType _ftype
Definition: traits.hpp:153
FIX8::FieldTrait::FieldTrait ( unsigned short  fnum,
unsigned  ftype,
unsigned short  pos,
unsigned short  compon,
unsigned short  field_traits 
)
inline

Ctor.

Parameters
fnumfield num (tag number)
ftypefield type
posfield position (in FIX message)
componcomponent idx
field_traitsbitmap of TraitTypes
groupptr ot traits if group
fieldcntnumber of fields in group if group

Definition at line 123 of file traits.hpp.

References group.

128  : _fnum(fnum), _ftype(FieldType(ftype)), _pos(pos), _component(compon), _field_traits(field_traits)
129 #if defined FIX8_HAVE_EXTENDED_METADATA
130  , _group(TraitHelper{group, fieldcnt})
131 #endif
132  {}
unsigned short _component
Definition: traits.hpp:154
unsigned short _fnum
Definition: traits.hpp:152
ebitset< TraitTypes, unsigned short > _field_traits
Definition: traits.hpp:155
unsigned short _pos
Definition: traits.hpp:154
FieldType _ftype
Definition: traits.hpp:153
FIX8::FieldTrait::FieldTrait ( const unsigned short  field)
inline

Ctor.

Parameters
fieldfield num (tag number)

Definition at line 136 of file traits.hpp.

136 : _fnum(field) {}
unsigned short _fnum
Definition: traits.hpp:152
FIX8::FieldTrait::FieldTrait ( const unsigned short  field,
const FieldType  ftype,
const unsigned short  pos = 0,
bool  ismandatory = false,
bool  isgroup = false,
const unsigned  compon = 0,
bool  ispresent = false 
)
inline

Ctor.

Parameters
fieldfield num (tag number)
ftypefield type
posfield position (in FIX message)
ismandatorytrue if mandatory
isgrouptrue if this is a group
componcomponent idx
ispresenttrue if field is present (should be false until set).

Definition at line 146 of file traits.hpp.

147  :
148  _fnum(field), _ftype(ftype), _pos(pos), _component(compon),
149  _field_traits((ismandatory ? 1 : 0) | (ispresent ? 1 : 0) << present
150  | (pos ? 1 : 0) << position | (isgroup ? 1 : 0) << group | (compon ? 1 : 0) << component) {}
unsigned short _component
Definition: traits.hpp:154
unsigned short _fnum
Definition: traits.hpp:152
ebitset< TraitTypes, unsigned short > _field_traits
Definition: traits.hpp:155
unsigned short _pos
Definition: traits.hpp:154
FieldType _ftype
Definition: traits.hpp:153

Member Function Documentation

string & FieldTrait::get_type_string ( FieldType  ftype,
std::string &  to 
)
static

Print the FieldType to the supplied string

Parameters
ftypeFieldType
totarget string
Returns
reference to target string

Definition at line 69 of file traits.cpp.

References is_char(), is_float(), is_int(), and is_string().

Referenced by FIX8::operator<<().

70 {
71  return to = FieldTrait::is_int(ftype) ? "int" : FieldTrait::is_char(ftype) ? "char"
72  : FieldTrait::is_float(ftype) ? "double" : FieldTrait::is_string(ftype) ? "f8String" : f8String();
73 }
static bool is_char(FieldType ftype)
Definition: traits.hpp:88
static bool is_float(FieldType ftype)
Definition: traits.hpp:93
static bool is_int(FieldType ftype)
Definition: traits.hpp:83
static bool is_string(FieldType ftype)
Definition: traits.hpp:98
std::string f8String
Definition: f8types.hpp:47
static bool FIX8::FieldTrait::is_char ( FieldType  ftype)
inlinestatic

Check if this FieldType is a char.

Parameters
ftypefield to check
Returns
true if a char

Definition at line 88 of file traits.hpp.

References ft_char, and ft_end_char.

Referenced by get_type_string(), FIX8::RealmBase::print(), and underlying_type().

88 { return ft_char <= ftype && ftype <= ft_end_char; }
static bool FIX8::FieldTrait::is_float ( FieldType  ftype)
inlinestatic

Check if this FieldType is a float.

Parameters
ftypefield to check
Returns
true if a float

Definition at line 93 of file traits.hpp.

References ft_end_float, and ft_float.

Referenced by get_type_string(), FIX8::RealmBase::print(), and underlying_type().

static bool FIX8::FieldTrait::is_int ( FieldType  ftype)
inlinestatic

Check if this FieldType is an int.

Parameters
ftypefield to check
Returns
true if an int

Definition at line 83 of file traits.hpp.

References ft_end_int, and ft_int.

Referenced by get_type_string(), FIX8::RealmBase::print(), and underlying_type().

83 { return ft_int <= ftype && ftype <= ft_end_int; }
static bool FIX8::FieldTrait::is_string ( FieldType  ftype)
inlinestatic

Check if this FieldType is a string.

Parameters
ftypefield to check
Returns
true if a string

Definition at line 98 of file traits.hpp.

References ft_end_string, and ft_string.

Referenced by get_type_string(), FIX8::RealmBase::print(), and underlying_type().

static FieldType FIX8::FieldTrait::underlying_type ( FieldType  ftype)
inlinestatic

Return the underlying field type of a given FieldType

Parameters
ftypefield to check
Returns
underlying FieldType

Definition at line 103 of file traits.hpp.

References ft_char, ft_float, ft_int, ft_string, ft_untyped, is_char(), is_float(), is_int(), and is_string().

104  {
105  return is_int(ftype) ? ft_int : is_char(ftype) ? ft_char : is_float(ftype) ? ft_float : is_string(ftype) ? ft_string : ft_untyped;
106  }
static bool is_char(FieldType ftype)
Definition: traits.hpp:88
static bool is_float(FieldType ftype)
Definition: traits.hpp:93
static bool is_int(FieldType ftype)
Definition: traits.hpp:83
static bool is_string(FieldType ftype)
Definition: traits.hpp:98

Friends And Related Function Documentation

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

Inserter friend.

Parameters
osstream to send to
whatFieldTrait
Returns
stream

Member Data Documentation

unsigned short FIX8::FieldTrait::_component
mutable

Definition at line 154 of file traits.hpp.

Referenced by FIX8::FieldTraits::getComp(), and FIX8::operator<<().

FieldType FIX8::FieldTrait::_ftype

Definition at line 153 of file traits.hpp.

Referenced by FIX8::operator<<().

unsigned short FIX8::FieldTrait::_pos
mutable

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