tesseract v5.3.3.20231005
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 50 of file networkscratch.h.

Constructor & Destructor Documentation

◆ IO() [1/2]

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

Definition at line 53 of file networkscratch.h.

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

◆ IO() [2/2]

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

Definition at line 60 of file networkscratch.h.

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

◆ ~IO()

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

Definition at line 62 of file networkscratch.h.

62 {
63 if (scratch_space_ == nullptr) {
64 ASSERT_HOST(network_io_ == nullptr);
65 } else if (int_mode_) {
66 scratch_space_->int_stack_.Return(network_io_);
67 } else {
68 scratch_space_->float_stack_.Return(network_io_);
69 }
70 }
#define ASSERT_HOST(x)
Definition: errcode.h:54

Member Function Documentation

◆ operator NetworkIO *()

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

Definition at line 112 of file networkscratch.h.

112 {
113 return network_io_;
114 }

◆ operator*()

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

Definition at line 106 of file networkscratch.h.

106 {
107 return *network_io_;
108 }

◆ operator->()

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

Definition at line 109 of file networkscratch.h.

109 {
110 return network_io_;
111 }

◆ Resize()

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

Definition at line 74 of file networkscratch.h.

74 {
75 if (scratch_space_ == nullptr) {
76 int_mode_ = scratch->int_mode_ && src.int_mode();
77 scratch_space_ = scratch;
78 network_io_ =
79 int_mode_ ? scratch_space_->int_stack_.Borrow() : scratch_space_->float_stack_.Borrow();
80 }
81 network_io_->Resize(src, num_features);
82 }
void Resize(const NetworkIO &src, int num_features)
Definition: networkio.h:44

◆ Resize2d()

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

Definition at line 84 of file networkscratch.h.

84 {
85 if (scratch_space_ == nullptr) {
86 int_mode_ = scratch->int_mode_ && int_mode;
87 scratch_space_ = scratch;
88 network_io_ =
89 int_mode_ ? scratch_space_->int_stack_.Borrow() : scratch_space_->float_stack_.Borrow();
90 }
91 network_io_->Resize2d(int_mode, width, num_features);
92 }
void Resize2d(bool int_mode, int width, int num_features)
Definition: networkio.cpp:35

◆ ResizeFloat()

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

Definition at line 95 of file networkscratch.h.

95 {
96 if (scratch_space_ == nullptr) {
97 int_mode_ = false;
98 scratch_space_ = scratch;
99 network_io_ = scratch_space_->float_stack_.Borrow();
100 }
101 network_io_->ResizeFloat(src, num_features);
102 }
void ResizeFloat(const NetworkIO &src, int num_features)
Definition: networkio.h:51

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