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

#include <parse_example_json.h>

Inheritance diagram for ArrayToVectorState< audit, T >:
BaseState< audit >

Public Member Functions

 ArrayToVectorState ()
 
BaseState< audit > * StartArray (Context< audit > &ctx) override
 
BaseState< audit > * Uint (Context< audit > &, unsigned f) override
 
BaseState< audit > * Float (Context< audit > &, float f) override
 
BaseState< audit > * Null (Context< audit > &) override
 
BaseState< audit > * EndArray (Context< audit > &, rapidjson::SizeType) override
 
- Public Member Functions inherited from BaseState< audit >
 BaseState (const char *pname)
 
virtual BaseState< audit > * Bool (Context< audit > &ctx, bool b)
 
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)
 

Public Attributes

std::vector< T > * output_array
 
BaseState< audit > * return_state
 
bool has_seen_array_start = false
 
- Public Attributes inherited from BaseState< audit >
const char * name
 

Detailed Description

template<bool audit, typename T>
class ArrayToVectorState< audit, T >

Definition at line 867 of file parse_example_json.h.

Constructor & Destructor Documentation

◆ ArrayToVectorState()

template<bool audit, typename T>
ArrayToVectorState< audit, T >::ArrayToVectorState ( )
inline

Definition at line 870 of file parse_example_json.h.

870 : BaseState<audit>("ArrayToVectorState") {}

Member Function Documentation

◆ EndArray()

template<bool audit, typename T>
BaseState<audit>* ArrayToVectorState< audit, T >::EndArray ( Context< audit > &  ,
rapidjson::SizeType   
)
inlineoverridevirtual

Reimplemented from BaseState< audit >.

Definition at line 929 of file parse_example_json.h.

930  {
931  has_seen_array_start = false;
932  return return_state;
933  }
BaseState< audit > * return_state

◆ Float()

template<bool audit, typename T>
BaseState<audit>* ArrayToVectorState< audit, T >::Float ( Context< audit > &  ,
float  f 
)
inlineoverridevirtual

Reimplemented from BaseState< audit >.

Definition at line 904 of file parse_example_json.h.

905  {
906  output_array->push_back(static_cast<T>(f));
907 
909  {
910  has_seen_array_start = false;
911  return return_state;
912  }
913 
914  return this;
915  }
BaseState< audit > * return_state
float f
Definition: cache.cc:40
std::vector< T > * output_array

◆ Null()

template<bool audit, typename T>
BaseState<audit>* ArrayToVectorState< audit, T >::Null ( Context< audit > &  )
inlineoverridevirtual

Reimplemented from BaseState< audit >.

Definition at line 917 of file parse_example_json.h.

918  {
920  {
921  has_seen_array_start = false;
922  return return_state;
923  }
924 
925  // ignore null values and stay in current state
926  return this;
927  }
BaseState< audit > * return_state

◆ StartArray()

template<bool audit, typename T>
BaseState<audit>* ArrayToVectorState< audit, T >::StartArray ( Context< audit > &  ctx)
inlineoverridevirtual

Reimplemented from BaseState< audit >.

Definition at line 878 of file parse_example_json.h.

879  {
880  if (ctx.previous_state == this)
881  {
882  ctx.error() << "Nested arrays are not supported";
883  return nullptr;
884  }
885 
886  has_seen_array_start = true;
887 
888  return this;
889  }
std::stringstream & error()
BaseState< audit > * previous_state

◆ Uint()

template<bool audit, typename T>
BaseState<audit>* ArrayToVectorState< audit, T >::Uint ( Context< audit > &  ,
unsigned  f 
)
inlineoverridevirtual

Reimplemented from BaseState< audit >.

Definition at line 891 of file parse_example_json.h.

892  {
893  output_array->push_back(static_cast<T>(f));
894 
896  {
897  has_seen_array_start = false;
898  return return_state;
899  }
900 
901  return this;
902  }
BaseState< audit > * return_state
float f
Definition: cache.cc:40
std::vector< T > * output_array

Member Data Documentation

◆ has_seen_array_start

template<bool audit, typename T>
bool ArrayToVectorState< audit, T >::has_seen_array_start = false

Definition at line 876 of file parse_example_json.h.

◆ output_array

template<bool audit, typename T>
std::vector<T>* ArrayToVectorState< audit, T >::output_array

◆ return_state

template<bool audit, typename T>
BaseState<audit>* ArrayToVectorState< audit, T >::return_state

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