Vowpal Wabbit
Public Member Functions | Public Attributes | List of all members
DecisionServiceState< audit > Class Template Reference

#include <parse_example_json.h>

Inheritance diagram for DecisionServiceState< audit >:
BaseState< audit >

Public Member Functions

 DecisionServiceState ()
 
BaseState< audit > * StartObject (Context< audit > &) override
 
BaseState< audit > * EndObject (Context< audit > &, rapidjson::SizeType) override
 
BaseState< audit > * Key (Context< audit > &ctx, const char *str, rapidjson::SizeType length, bool) override
 
- Public Member Functions inherited from BaseState< audit >
 BaseState (const char *pname)
 
virtual BaseState< audit > * Null (Context< audit > &ctx)
 
virtual BaseState< audit > * Bool (Context< audit > &ctx, bool b)
 
virtual BaseState< audit > * Float (Context< audit > &ctx, float v)
 
virtual BaseState< audit > * Uint (Context< audit > &ctx, unsigned v)
 
virtual BaseState< audit > * String (Context< audit > &ctx, const char *str, rapidjson::SizeType len, bool)
 
virtual BaseState< audit > * StartArray (Context< audit > &ctx)
 
virtual BaseState< audit > * EndArray (Context< audit > &ctx, rapidjson::SizeType)
 

Public Attributes

DecisionServiceInteractiondata
 
- Public Attributes inherited from BaseState< audit >
const char * name
 

Detailed Description

template<bool audit>
class DecisionServiceState< audit >

Definition at line 1078 of file parse_example_json.h.

Constructor & Destructor Documentation

◆ DecisionServiceState()

template<bool audit>
DecisionServiceState< audit >::DecisionServiceState ( )
inline

Definition at line 1081 of file parse_example_json.h.

1081 : BaseState<audit>("DecisionService") {}

Member Function Documentation

◆ EndObject()

template<bool audit>
BaseState<audit>* DecisionServiceState< audit >::EndObject ( Context< audit > &  ,
rapidjson::SizeType   
)
inlineoverridevirtual

Reimplemented from BaseState< audit >.

Definition at line 1091 of file parse_example_json.h.

1092  {
1093  // TODO: improve validation
1094  return this;
1095  }

◆ Key()

template<bool audit>
BaseState<audit>* DecisionServiceState< audit >::Key ( Context< audit > &  ctx,
const char *  str,
rapidjson::SizeType  length,
bool   
)
inlineoverridevirtual

Reimplemented from BaseState< audit >.

Definition at line 1097 of file parse_example_json.h.

References _stricmp, DecisionServiceInteraction::actions, Context< audit >::array_float_state, Context< audit >::array_uint_state, Context< audit >::bool_state, Context< audit >::ccb_outcome_list_state, Context< audit >::default_state, DecisionServiceInteraction::eventId, Context< audit >::float_state, Context< audit >::key, Context< audit >::key_length, Context< audit >::label_index_state, Context< audit >::label_single_property_state, Context< audit >::label_state, ArrayToVectorState< audit, T >::output_array, DecisionServiceInteraction::probabilities, DecisionServiceInteraction::probabilityOfDrop, ArrayToVectorState< audit, T >::return_state, DecisionServiceInteraction::skipLearn, and Context< audit >::string_state.

1098  {
1099  if (length == 1)
1100  {
1101  switch (str[0])
1102  {
1103  case 'a':
1105  ctx.array_uint_state.return_state = this;
1106  return &ctx.array_uint_state;
1107  case 'p':
1109  ctx.array_float_state.return_state = this;
1110  return &ctx.array_float_state;
1111  case 'c':
1112  ctx.key = " ";
1113  ctx.key_length = 1;
1114  return &ctx.default_state;
1115  }
1116  }
1117  else if (length == 5 && !strcmp(str, "pdrop"))
1118  {
1119  ctx.float_state.output_float = &data->probabilityOfDrop;
1120  ctx.float_state.return_state = this;
1121  return &ctx.float_state;
1122  }
1123  else if (length == 7 && !strcmp(str, "EventId"))
1124  {
1125  ctx.string_state.output_string = &data->eventId;
1126  ctx.string_state.return_state = this;
1127  return &ctx.string_state;
1128  }
1129  else if (length > 0 && str[0] == '_')
1130  {
1131  // match _label*
1132  if (length >= 6 && !strncmp(str, "_label", 6))
1133  {
1134  ctx.key = str;
1135  ctx.key_length = length;
1136  if (length >= 7 && ctx.key[6] == '_')
1137  return &ctx.label_single_property_state;
1138  else if (length == 6)
1139  return &ctx.label_state;
1140  else if (length == 11 && !_stricmp(str, "_labelIndex"))
1141  return &ctx.label_index_state;
1142  }
1143  else if (length == 10 && !strncmp(str, "_skipLearn", 10))
1144  {
1145  ctx.bool_state.output_bool = &data->skipLearn;
1146  ctx.bool_state.return_state = this;
1147  return &ctx.bool_state;
1148  }
1149  else if (length == 9 && !strncmp(str, "_outcomes", 9))
1150  {
1151  ctx.ccb_outcome_list_state.interactions = data;
1152  return &ctx.ccb_outcome_list_state;
1153  }
1154  }
1155 
1156  // ignore unknown properties
1157  return ctx.default_state.Ignore(ctx, length);
1158  }
const char * key
rapidjson::SizeType key_length
ArrayToVectorState< audit, float > array_float_state
LabelIndexState< audit > label_index_state
LabelState< audit > label_state
LabelSinglePropertyState< audit > label_single_property_state
ArrayToVectorState< audit, unsigned > array_uint_state
#define _stricmp
StringToStringState< audit > string_state
CCBOutcomeList< audit > ccb_outcome_list_state
FloatToFloatState< audit > float_state
BoolToBoolState< audit > bool_state
DecisionServiceInteraction * data
DefaultState< audit > default_state
BaseState< audit > * return_state
std::vector< float > probabilities
std::vector< unsigned > actions
std::vector< T > * output_array

◆ StartObject()

template<bool audit>
BaseState<audit>* DecisionServiceState< audit >::StartObject ( Context< audit > &  )
inlineoverridevirtual

Reimplemented from BaseState< audit >.

Definition at line 1085 of file parse_example_json.h.

1086  {
1087  // TODO: improve validation
1088  return this;
1089  }

Member Data Documentation

◆ data

template<bool audit>
DecisionServiceInteraction* DecisionServiceState< audit >::data

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