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

#include <parse_example_json.h>

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

Public Member Functions

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

Public Attributes

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

Detailed Description

template<bool audit>
struct SlotsState< audit >

Definition at line 488 of file parse_example_json.h.

Constructor & Destructor Documentation

◆ SlotsState()

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

Definition at line 490 of file parse_example_json.h.

490 : BaseState<audit>("Slots") {}

Member Function Documentation

◆ EndArray()

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

Reimplemented from BaseState< audit >.

Definition at line 522 of file parse_example_json.h.

References Context< audit >::default_state, Context< audit >::ex, Context< audit >::examples, Context< audit >::PushNamespace(), and Context< audit >::root_state.

523  {
524  // return to shared example
525  ctx.ex = (*ctx.examples)[0];
526 
527  ctx.PushNamespace(" ", saved);
529 
530  return &ctx.default_state;
531  }
BaseState< audit > * root_state
BaseState< audit > * saved_root_state
example * ex
v_array< example * > * examples
DefaultState< audit > default_state
BaseState< audit > * saved
void PushNamespace(const char *ns, BaseState< audit > *return_state)

◆ StartArray()

template<bool audit>
BaseState<audit>* SlotsState< audit >::StartArray ( Context< audit > &  ctx)
inlineoverridevirtual

Reimplemented from BaseState< audit >.

Definition at line 494 of file parse_example_json.h.

References Context< audit >::PopNamespace(), and Context< audit >::root_state.

495  {
496  // drain existing added namespace
497  // todo check bounds
498  saved = ctx.PopNamespace();
500  ctx.root_state = this;
501  return this;
502  }
BaseState< audit > * root_state
BaseState< audit > * saved_root_state
BaseState< audit > * PopNamespace()
BaseState< audit > * saved

◆ StartObject()

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

Reimplemented from BaseState< audit >.

Definition at line 504 of file parse_example_json.h.

References Context< audit >::all, polylabel::conditional_contextual_bandit, label_parser::default_label, Context< audit >::default_state, Context< audit >::ex, Context< audit >::example_factory, Context< audit >::example_factory_context, Context< audit >::examples, example::l, Context< audit >::label_index_state, parser::lp, vw::p, v_array< T >::push_back(), Context< audit >::PushNamespace(), v_array< T >::size(), CCB::slot, and CCB::label::type.

505  {
506  // allocate new example
507  ctx.ex = &(*ctx.example_factory)(ctx.example_factory_context);
508  ctx.all->p->lp.default_label(&ctx.ex->l);
510 
511  ctx.examples->push_back(ctx.ex);
512 
513  // The end object logic assumes shared example so we need to take an extra one here.
514  ctx.label_index_state.index = static_cast<int>(ctx.examples->size()) - 2;
515 
516  // setup default namespace
517  ctx.PushNamespace(" ", this);
518 
519  return &ctx.default_state;
520  }
LabelIndexState< audit > label_index_state
void(* default_label)(void *)
Definition: label_parser.h:12
example * ex
size_t size() const
Definition: v_array.h:68
void * example_factory_context
parser * p
Definition: global_data.h:377
VW::example_factory_t example_factory
void push_back(const T &new_ele)
Definition: v_array.h:107
v_array< example * > * examples
DefaultState< audit > default_state
example_type type
Definition: ccb_label.h:32
polylabel l
Definition: example.h:57
CCB::label conditional_contextual_bandit
Definition: example.h:32
label_parser lp
Definition: parser.h:102
void PushNamespace(const char *ns, BaseState< audit > *return_state)

Member Data Documentation

◆ saved

template<bool audit>
BaseState<audit>* SlotsState< audit >::saved

Definition at line 491 of file parse_example_json.h.

◆ saved_root_state

template<bool audit>
BaseState<audit>* SlotsState< audit >::saved_root_state

Definition at line 492 of file parse_example_json.h.


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