tesseract  5.0.0-alpha-619-ge9db
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 51 of file networkscratch.h.

Constructor & Destructor Documentation

◆ IO() [1/2]

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

Definition at line 54 of file networkscratch.h.

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

◆ IO() [2/2]

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

Definition at line 62 of file networkscratch.h.

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

◆ ~IO()

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

Definition at line 64 of file networkscratch.h.

64  {
65  if (scratch_space_ == nullptr) {
66  ASSERT_HOST(network_io_ == nullptr);
67  } else if (int_mode_) {
68  scratch_space_->int_stack_.Return(network_io_);
69  } else {
70  scratch_space_->float_stack_.Return(network_io_);
71  }
72  }

Member Function Documentation

◆ operator NetworkIO *()

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

Definition at line 117 of file networkscratch.h.

117  {
118  return network_io_;
119  }

◆ operator*()

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

Definition at line 111 of file networkscratch.h.

111  {
112  return *network_io_;
113  }

◆ operator->()

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

Definition at line 114 of file networkscratch.h.

114  {
115  return network_io_;
116  }

◆ Resize()

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

Definition at line 76 of file networkscratch.h.

77  {
78  if (scratch_space_ == nullptr) {
79  int_mode_ = scratch->int_mode_ && src.int_mode();
80  scratch_space_ = scratch;
81  network_io_ = int_mode_ ? scratch_space_->int_stack_.Borrow()
82  : scratch_space_->float_stack_.Borrow();
83  }
84  network_io_->Resize(src, num_features);
85  }

◆ Resize2d()

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

Definition at line 87 of file networkscratch.h.

88  {
89  if (scratch_space_ == nullptr) {
90  int_mode_ = scratch->int_mode_ && int_mode;
91  scratch_space_ = scratch;
92  network_io_ = int_mode_ ? scratch_space_->int_stack_.Borrow()
93  : scratch_space_->float_stack_.Borrow();
94  }
95  network_io_->Resize2d(int_mode, width, num_features);
96  }

◆ ResizeFloat()

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

Definition at line 99 of file networkscratch.h.

100  {
101  if (scratch_space_ == nullptr) {
102  int_mode_ = false;
103  scratch_space_ = scratch;
104  network_io_ = scratch_space_->float_stack_.Borrow();
105  }
106  network_io_->ResizeFloat(src, num_features);
107  }

The documentation for this class was generated from the following file:
ASSERT_HOST
#define ASSERT_HOST(x)
Definition: errcode.h:87
tesseract::NetworkIO::ResizeFloat
void ResizeFloat(const NetworkIO &src, int num_features)
Definition: networkio.h:52
tesseract::NetworkIO::Resize2d
void Resize2d(bool int_mode, int width, int num_features)
Definition: networkio.cpp:35
tesseract::NetworkIO::Resize
void Resize(const NetworkIO &src, int num_features)
Definition: networkio.h:45