tesseract v5.3.3.20231005
tesseract::NetworkScratch::FloatVec Class Reference

#include <networkscratch.h>

Public Member Functions

 FloatVec (int size, NetworkScratch *scratch)
 
 FloatVec ()
 
 ~FloatVec ()
 
void Init (int, int reserve, NetworkScratch *scratch)
 
void Init (int size, NetworkScratch *scratch)
 
 operator TFloat * () const
 
TFloatget ()
 

Detailed Description

Definition at line 129 of file networkscratch.h.

Constructor & Destructor Documentation

◆ FloatVec() [1/2]

tesseract::NetworkScratch::FloatVec::FloatVec ( int  size,
NetworkScratch scratch 
)
inline

Definition at line 132 of file networkscratch.h.

132 : vec_(nullptr), scratch_space_(scratch) {
133 Init(size, scratch);
134 }
void Init(int, int reserve, NetworkScratch *scratch)

◆ FloatVec() [2/2]

tesseract::NetworkScratch::FloatVec::FloatVec ( )
inline

Definition at line 136 of file networkscratch.h.

136: vec_(nullptr), data_(nullptr), scratch_space_(nullptr) {}

◆ ~FloatVec()

tesseract::NetworkScratch::FloatVec::~FloatVec ( )
inline

Definition at line 137 of file networkscratch.h.

137 {
138 if (scratch_space_ != nullptr) {
139 scratch_space_->vec_stack_.Return(vec_);
140 }
141 }

Member Function Documentation

◆ get()

TFloat * tesseract::NetworkScratch::FloatVec::get ( )
inline

Definition at line 163 of file networkscratch.h.

163 {
164 return data_;
165 }

◆ Init() [1/2]

void tesseract::NetworkScratch::FloatVec::Init ( int  size,
NetworkScratch scratch 
)
inline

Definition at line 154 of file networkscratch.h.

154 {
155 Init(size, size, scratch);
156 }

◆ Init() [2/2]

void tesseract::NetworkScratch::FloatVec::Init ( int  ,
int  reserve,
NetworkScratch scratch 
)
inline

Definition at line 143 of file networkscratch.h.

143 {
144 if (scratch_space_ != nullptr && vec_ != nullptr) {
145 scratch_space_->vec_stack_.Return(vec_);
146 }
147 scratch_space_ = scratch;
148 vec_ = scratch_space_->vec_stack_.Borrow();
149 // TODO: optimize.
150 vec_->resize(reserve);
151 data_ = &(*vec_)[0];
152 }

◆ operator TFloat *()

tesseract::NetworkScratch::FloatVec::operator TFloat * ( ) const
inline

Definition at line 160 of file networkscratch.h.

160 {
161 return data_;
162 }

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