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

#include <parse_example_json.h>

Inheritance diagram for BaseState< audit >:
ArrayState< audit > ArrayToVectorState< audit, T > ArrayToVectorState< audit, float > ArrayToVectorState< audit, unsigned > BoolToBoolState< audit > CCBOutcomeList< audit > DecisionServiceState< audit > DefaultState< audit > FloatToFloatState< audit > IgnoreState< audit > LabelIndexState< audit > LabelObjectState< audit > LabelSinglePropertyState< audit > LabelState< audit > MultiState< audit > SlotsState< audit > StringToStringState< audit > TagState< audit > TextState< audit >

Public Member Functions

 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 > * StartObject (Context< audit > &ctx)
 
virtual BaseState< audit > * Key (Context< audit > &ctx, const char *str, rapidjson::SizeType len, bool)
 
virtual BaseState< audit > * EndObject (Context< audit > &ctx, rapidjson::SizeType)
 
virtual BaseState< audit > * StartArray (Context< audit > &ctx)
 
virtual BaseState< audit > * EndArray (Context< audit > &ctx, rapidjson::SizeType)
 

Public Attributes

const char * name
 

Detailed Description

template<bool audit>
struct BaseState< audit >

Definition at line 48 of file parse_example_json.h.

Constructor & Destructor Documentation

◆ BaseState()

template<bool audit>
BaseState< audit >::BaseState ( const char *  pname)
inline

Definition at line 91 of file parse_example_json.h.

91 : name(pname) {}
const char * name

Member Function Documentation

◆ Bool()

template<bool audit>
virtual BaseState<audit>* BaseState< audit >::Bool ( Context< audit > &  ctx,
bool  b 
)
inlinevirtual

Reimplemented in BoolToBoolState< audit >, and DefaultState< audit >.

Definition at line 99 of file parse_example_json.h.

References Context< audit >::error().

100  {
101  ctx.error() << "Unexpected token: bool (" << (b ? "true" : "false") << ")";
102  return nullptr;
103  }
std::stringstream & error()

◆ EndArray()

template<bool audit>
virtual BaseState<audit>* BaseState< audit >::EndArray ( Context< audit > &  ctx,
rapidjson::SizeType   
)
inlinevirtual

Reimplemented in CCBOutcomeList< audit >, ArrayToVectorState< audit, T >, ArrayToVectorState< audit, float >, ArrayToVectorState< audit, unsigned >, ArrayState< audit >, SlotsState< audit >, and MultiState< audit >.

Definition at line 147 of file parse_example_json.h.

References Context< audit >::error().

148  {
149  ctx.error() << "Unexpected token: ]";
150  return nullptr;
151  }
std::stringstream & error()

◆ EndObject()

template<bool audit>
virtual BaseState<audit>* BaseState< audit >::EndObject ( Context< audit > &  ctx,
rapidjson::SizeType   
)
inlinevirtual

Reimplemented in DecisionServiceState< audit >, DefaultState< audit >, and LabelObjectState< audit >.

Definition at line 135 of file parse_example_json.h.

References Context< audit >::error().

136  {
137  ctx.error() << "Unexpected token: }";
138  return nullptr;
139  }
std::stringstream & error()

◆ Float()

template<bool audit>
virtual BaseState<audit>* BaseState< audit >::Float ( Context< audit > &  ctx,
float  v 
)
inlinevirtual

◆ Key()

template<bool audit>
virtual BaseState<audit>* BaseState< audit >::Key ( Context< audit > &  ctx,
const char *  str,
rapidjson::SizeType  len,
bool   
)
inlinevirtual

Reimplemented in DecisionServiceState< audit >, DefaultState< audit >, and LabelObjectState< audit >.

Definition at line 129 of file parse_example_json.h.

References Context< audit >::error().

130  {
131  ctx.error() << "Unexpected token: key('" << str << "' len: " << len << ")";
132  return nullptr;
133  }
std::stringstream & error()

◆ Null()

template<bool audit>
virtual BaseState<audit>* BaseState< audit >::Null ( Context< audit > &  ctx)
inlinevirtual

Reimplemented in FloatToFloatState< audit >, StringToStringState< audit >, ArrayToVectorState< audit, T >, ArrayToVectorState< audit, float >, ArrayToVectorState< audit, unsigned >, and ArrayState< audit >.

Definition at line 93 of file parse_example_json.h.

References Context< audit >::previous_state.

94  {
95  // ignore Null by default and stay in the current state
96  return ctx.previous_state == nullptr ? this : ctx.previous_state;
97  }
BaseState< audit > * previous_state

◆ StartArray()

template<bool audit>
virtual BaseState<audit>* BaseState< audit >::StartArray ( Context< audit > &  ctx)
inlinevirtual

Reimplemented in CCBOutcomeList< audit >, ArrayToVectorState< audit, T >, ArrayToVectorState< audit, float >, ArrayToVectorState< audit, unsigned >, DefaultState< audit >, ArrayState< audit >, SlotsState< audit >, and MultiState< audit >.

Definition at line 141 of file parse_example_json.h.

References Context< audit >::error().

142  {
143  ctx.error() << "Unexpected token: [";
144  return nullptr;
145  }
std::stringstream & error()

◆ StartObject()

template<bool audit>
virtual BaseState<audit>* BaseState< audit >::StartObject ( Context< audit > &  ctx)
inlinevirtual

Reimplemented in DecisionServiceState< audit >, CCBOutcomeList< audit >, DefaultState< audit >, ArrayState< audit >, SlotsState< audit >, MultiState< audit >, LabelState< audit >, and LabelObjectState< audit >.

Definition at line 123 of file parse_example_json.h.

References Context< audit >::error().

124  {
125  ctx.error() << "Unexpected token: {";
126  return nullptr;
127  }
std::stringstream & error()

◆ String()

template<bool audit>
virtual BaseState<audit>* BaseState< audit >::String ( Context< audit > &  ctx,
const char *  str,
rapidjson::SizeType  len,
bool   
)
inlinevirtual

Reimplemented in StringToStringState< audit >, DefaultState< audit >, TextState< audit >, and LabelState< audit >.

Definition at line 117 of file parse_example_json.h.

References Context< audit >::error().

118  {
119  ctx.error() << "Unexpected token: std::string('" << str << "' len: " << len << ")";
120  return nullptr;
121  }
std::stringstream & error()

◆ Uint()

template<bool audit>
virtual BaseState<audit>* BaseState< audit >::Uint ( Context< audit > &  ctx,
unsigned  v 
)
inlinevirtual

Member Data Documentation

◆ name

template<bool audit>
const char* BaseState< audit >::name

Definition at line 89 of file parse_example_json.h.

Referenced by VW::read_line_decision_service_json(), and VW::read_line_json().


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