Vowpal Wabbit
Public Member Functions | Private Attributes | List of all members
vw_slim::namespace_copy_guard Class Reference

#include <vw_slim_predict.h>

Public Member Functions

 namespace_copy_guard (example_predict &ex, unsigned char ns)
 
 ~namespace_copy_guard ()
 
void feature_push_back (feature_value v, feature_index idx)
 

Private Attributes

example_predict_ex
 
unsigned char _ns
 
bool _remove_ns
 

Detailed Description

Definition at line 181 of file vw_slim_predict.h.

Constructor & Destructor Documentation

◆ namespace_copy_guard()

vw_slim::namespace_copy_guard::namespace_copy_guard ( example_predict ex,
unsigned char  ns 
)

Definition at line 16 of file vw_slim_predict.cc.

References _ex, _ns, _remove_ns, recall_tree_ns::find(), example_predict::indices, and v_array< T >::push_back().

16  : _ex(ex), _ns(ns)
17 {
18  if (std::end(_ex.indices) == std::find(std::begin(_ex.indices), std::end(_ex.indices), ns))
19  {
21  _remove_ns = true;
22  }
23  else
24  _remove_ns = false;
25 }
v_array< namespace_index > indices
void push_back(const T &new_ele)
Definition: v_array.h:107
node_pred * find(recall_tree &b, uint32_t cn, example &ec)
Definition: recall_tree.cc:126

◆ ~namespace_copy_guard()

vw_slim::namespace_copy_guard::~namespace_copy_guard ( )

Definition at line 27 of file vw_slim_predict.cc.

References _ex, _ns, _remove_ns, example_predict::feature_space, example_predict::indices, and v_array< T >::pop().

28 {
29  _ex.indices.pop();
30  if (_remove_ns)
31  _ex.feature_space[_ns].clear();
32 }
v_array< namespace_index > indices
T pop()
Definition: v_array.h:58
std::array< features, NUM_NAMESPACES > feature_space

Member Function Documentation

◆ feature_push_back()

void vw_slim::namespace_copy_guard::feature_push_back ( feature_value  v,
feature_index  idx 
)

Definition at line 34 of file vw_slim_predict.cc.

References _ex, _ns, and example_predict::feature_space.

35 {
36  _ex.feature_space[_ns].push_back(v, idx);
37 }
std::array< features, NUM_NAMESPACES > feature_space

Member Data Documentation

◆ _ex

example_predict& vw_slim::namespace_copy_guard::_ex
private

◆ _ns

unsigned char vw_slim::namespace_copy_guard::_ns
private

◆ _remove_ns

bool vw_slim::namespace_copy_guard::_remove_ns
private

Definition at line 185 of file vw_slim_predict.h.

Referenced by namespace_copy_guard(), and ~namespace_copy_guard().


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