tesseract  4.0.0-1-g2a2b
tesseract::NetworkScratch::IO Class Reference

#include <networkscratch.h>

Public Member Functions

 IO (const NetworkIO &src, NetworkScratch *scratch)
 
 IO ()
 
 ~IO ()
 
void Resize (const NetworkIO &src, int num_features, NetworkScratch *scratch)
 
void Resize2d (bool int_mode, int width, int num_features, NetworkScratch *scratch)
 
void ResizeFloat (const NetworkIO &src, int num_features, NetworkScratch *scratch)
 
NetworkIOoperator* ()
 
NetworkIOoperator-> ()
 
 operator NetworkIO * ()
 

Detailed Description

Definition at line 53 of file networkscratch.h.

Constructor & Destructor Documentation

◆ IO() [1/2]

tesseract::NetworkScratch::IO::IO ( const NetworkIO src,
NetworkScratch scratch 
)
inline

Definition at line 56 of file networkscratch.h.

57  : int_mode_(scratch->int_mode_ && src.int_mode()),
58  scratch_space_(scratch) {
59  network_io_ = int_mode_ ? scratch_space_->int_stack_.Borrow()
60  : scratch_space_->float_stack_.Borrow();
61  }

◆ IO() [2/2]

tesseract::NetworkScratch::IO::IO ( )
inline

Definition at line 64 of file networkscratch.h.

64 : int_mode_(false), network_io_(nullptr), scratch_space_(nullptr) {}

◆ ~IO()

tesseract::NetworkScratch::IO::~IO ( )
inline

Definition at line 66 of file networkscratch.h.

66  {
67  if (scratch_space_ == nullptr) {
68  ASSERT_HOST(network_io_ == nullptr);
69  } else if (int_mode_) {
70  scratch_space_->int_stack_.Return(network_io_);
71  } else {
72  scratch_space_->float_stack_.Return(network_io_);
73  }
74  }
#define ASSERT_HOST(x)
Definition: errcode.h:84

Member Function Documentation

◆ operator NetworkIO *()

tesseract::NetworkScratch::IO::operator NetworkIO * ( )
inline

Definition at line 119 of file networkscratch.h.

119  {
120  return network_io_;
121  }

◆ operator*()

NetworkIO& tesseract::NetworkScratch::IO::operator* ( )
inline

Definition at line 113 of file networkscratch.h.

113  {
114  return *network_io_;
115  }

◆ operator->()

NetworkIO* tesseract::NetworkScratch::IO::operator-> ( )
inline

Definition at line 116 of file networkscratch.h.

116  {
117  return network_io_;
118  }

◆ Resize()

void tesseract::NetworkScratch::IO::Resize ( const NetworkIO src,
int  num_features,
NetworkScratch scratch 
)
inline

Definition at line 78 of file networkscratch.h.

79  {
80  if (scratch_space_ == nullptr) {
81  int_mode_ = scratch->int_mode_ && src.int_mode();
82  scratch_space_ = scratch;
83  network_io_ = int_mode_ ? scratch_space_->int_stack_.Borrow()
84  : scratch_space_->float_stack_.Borrow();
85  }
86  network_io_->Resize(src, num_features);
87  }
void Resize(const NetworkIO &src, int num_features)
Definition: networkio.h:45

◆ Resize2d()

void tesseract::NetworkScratch::IO::Resize2d ( bool  int_mode,
int  width,
int  num_features,
NetworkScratch scratch 
)
inline

Definition at line 89 of file networkscratch.h.

90  {
91  if (scratch_space_ == nullptr) {
92  int_mode_ = scratch->int_mode_ && int_mode;
93  scratch_space_ = scratch;
94  network_io_ = int_mode_ ? scratch_space_->int_stack_.Borrow()
95  : scratch_space_->float_stack_.Borrow();
96  }
97  network_io_->Resize2d(int_mode, width, num_features);
98  }
void Resize2d(bool int_mode, int width, int num_features)
Definition: networkio.cpp:40

◆ ResizeFloat()

void tesseract::NetworkScratch::IO::ResizeFloat ( const NetworkIO src,
int  num_features,
NetworkScratch scratch 
)
inline

Definition at line 101 of file networkscratch.h.

102  {
103  if (scratch_space_ == nullptr) {
104  int_mode_ = false;
105  scratch_space_ = scratch;
106  network_io_ = scratch_space_->float_stack_.Borrow();
107  }
108  network_io_->ResizeFloat(src, num_features);
109  }
void ResizeFloat(const NetworkIO &src, int num_features)
Definition: networkio.h:52

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