Xmipp  v3.23.11-Nereus
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
alglib::ae_vector_wrapper Class Reference

#include <ap.h>

Inheritance diagram for alglib::ae_vector_wrapper:
Inheritance graph
[legend]
Collaboration diagram for alglib::ae_vector_wrapper:
Collaboration graph
[legend]

Public Member Functions

 ae_vector_wrapper ()
 
virtual ~ae_vector_wrapper ()
 
void setlength (ae_int_t iLen)
 
ae_int_t length () const
 
void attach_to (alglib_impl::ae_vector *ptr)
 
void allocate_own (ae_int_t size, alglib_impl::ae_datatype datatype)
 
const alglib_impl::ae_vectorc_ptr () const
 
alglib_impl::ae_vectorc_ptr ()
 

Protected Member Functions

void create (const ae_vector_wrapper &rhs)
 
void create (const char *s, alglib_impl::ae_datatype datatype)
 
void assign (const ae_vector_wrapper &rhs)
 

Protected Attributes

alglib_impl::ae_vectorp_vec
 
alglib_impl::ae_vector vec
 

Detailed Description

Definition at line 1054 of file ap.h.

Constructor & Destructor Documentation

◆ ae_vector_wrapper()

alglib::ae_vector_wrapper::ae_vector_wrapper ( )

Definition at line 5861 of file ap.cpp.

5862 {
5863  p_vec = NULL;
5864 }
alglib_impl::ae_vector * p_vec
Definition: ap.h:1103

◆ ~ae_vector_wrapper()

alglib::ae_vector_wrapper::~ae_vector_wrapper ( )
virtual

Definition at line 5866 of file ap.cpp.

5867 {
5868  if( p_vec==&vec )
5870 }
alglib_impl::ae_vector * p_vec
Definition: ap.h:1103
void ae_vector_clear(ae_vector *dst)
Definition: ap.cpp:692
alglib_impl::ae_vector vec
Definition: ap.h:1104

Member Function Documentation

◆ allocate_own()

void alglib::ae_vector_wrapper::allocate_own ( ae_int_t  size,
alglib_impl::ae_datatype  datatype 
)

Definition at line 5898 of file ap.cpp.

5899 {
5900  if( p_vec==&vec )
5902  p_vec = &vec;
5903  if( !ae_vector_init(p_vec, size, datatype, NULL, false) )
5904  throw alglib::ap_error("ALGLIB: malloc error");
5905 }
alglib_impl::ae_vector * p_vec
Definition: ap.h:1103
void ae_vector_clear(ae_vector *dst)
Definition: ap.cpp:692
ae_bool ae_vector_init(ae_vector *dst, ae_int_t size, ae_datatype datatype, ae_state *state, ae_bool make_automatic)
Definition: ap.cpp:580
alglib_impl::ae_vector vec
Definition: ap.h:1104

◆ assign()

void alglib::ae_vector_wrapper::assign ( const ae_vector_wrapper rhs)
protected

Definition at line 5962 of file ap.cpp.

5963 {
5964  if( this==&rhs )
5965  return;
5966  if( p_vec==&vec || p_vec==NULL )
5967  {
5968  //
5969  // Assignment to non-proxy object
5970  //
5972  if( rhs.p_vec!=NULL )
5973  {
5974  p_vec = &vec;
5975  if( !ae_vector_init_copy(p_vec, rhs.p_vec, NULL, ae_false) )
5976  throw alglib::ap_error("ALGLIB: malloc error!");
5977  }
5978  else
5979  p_vec = NULL;
5980  }
5981  else
5982  {
5983  //
5984  // Assignment to proxy object
5985  //
5986  if( rhs.p_vec==NULL )
5987  throw alglib::ap_error("ALGLIB: incorrect assignment to array (sizes do not match)");
5988  if( rhs.p_vec->datatype!=p_vec->datatype )
5989  throw alglib::ap_error("ALGLIB: incorrect assignment to array (types do not match)");
5990  if( rhs.p_vec->cnt!=p_vec->cnt )
5991  throw alglib::ap_error("ALGLIB: incorrect assignment to array (sizes do not match)");
5992  memcpy(p_vec->ptr.p_ptr, rhs.p_vec->ptr.p_ptr, p_vec->cnt*alglib_impl::ae_sizeof(p_vec->datatype));
5993  }
5994 }
#define ae_false
Definition: ap.h:196
alglib_impl::ae_vector * p_vec
Definition: ap.h:1103
void ae_vector_clear(ae_vector *dst)
Definition: ap.cpp:692
ae_int_t ae_sizeof(ae_datatype datatype)
Definition: ap.cpp:273
ae_datatype datatype
Definition: ap.h:430
union alglib_impl::ae_vector::@11 ptr
ae_bool ae_vector_init_copy(ae_vector *dst, ae_vector *src, ae_state *state, ae_bool make_automatic)
Definition: ap.cpp:614
ae_int_t cnt
Definition: ap.h:429
alglib_impl::ae_vector vec
Definition: ap.h:1104

◆ attach_to()

void alglib::ae_vector_wrapper::attach_to ( alglib_impl::ae_vector ptr)

Definition at line 5889 of file ap.cpp.

5890 {
5891  if( ptr==&vec )
5892  throw alglib::ap_error("ALGLIB: attempt to attach vector to itself");
5893  if( p_vec==&vec )
5895  p_vec = ptr;
5896 }
alglib_impl::ae_vector * p_vec
Definition: ap.h:1103
void ae_vector_clear(ae_vector *dst)
Definition: ap.cpp:692
alglib_impl::ae_vector vec
Definition: ap.h:1104

◆ c_ptr() [1/2]

const alglib_impl::ae_vector * alglib::ae_vector_wrapper::c_ptr ( ) const

Definition at line 5907 of file ap.cpp.

5908 {
5909  return p_vec;
5910 }
alglib_impl::ae_vector * p_vec
Definition: ap.h:1103

◆ c_ptr() [2/2]

alglib_impl::ae_vector * alglib::ae_vector_wrapper::c_ptr ( )

Definition at line 5912 of file ap.cpp.

5913 {
5914  return p_vec;
5915 }
alglib_impl::ae_vector * p_vec
Definition: ap.h:1103

◆ create() [1/2]

void alglib::ae_vector_wrapper::create ( const ae_vector_wrapper rhs)
protected

Definition at line 5917 of file ap.cpp.

5918 {
5919  if( rhs.p_vec!=NULL )
5920  {
5921  p_vec = &vec;
5922  if( !ae_vector_init_copy(p_vec, rhs.p_vec, NULL, ae_false) )
5923  throw alglib::ap_error("ALGLIB: malloc error!");
5924  }
5925  else
5926  p_vec = NULL;
5927 }
#define ae_false
Definition: ap.h:196
alglib_impl::ae_vector * p_vec
Definition: ap.h:1103
ae_bool ae_vector_init_copy(ae_vector *dst, ae_vector *src, ae_state *state, ae_bool make_automatic)
Definition: ap.cpp:614
alglib_impl::ae_vector vec
Definition: ap.h:1104

◆ create() [2/2]

void alglib::ae_vector_wrapper::create ( const char *  s,
alglib_impl::ae_datatype  datatype 
)
protected

Definition at line 5929 of file ap.cpp.

5930 {
5931  std::vector<const char*> svec;
5932  size_t i;
5933  char *p = filter_spaces(s);
5934  try
5935  {
5936  str_vector_create(p, true, &svec);
5937  allocate_own((ae_int_t)(svec.size()), datatype);
5938  for(i=0; i<svec.size(); i++)
5939  {
5940  if( datatype==alglib_impl::DT_BOOL )
5941  p_vec->ptr.p_bool[i] = parse_bool_delim(svec[i],",]");
5942  if( datatype==alglib_impl::DT_INT )
5943  p_vec->ptr.p_int[i] = parse_int_delim(svec[i],",]");
5944  if( datatype==alglib_impl::DT_REAL )
5945  p_vec->ptr.p_double[i] = parse_real_delim(svec[i],",]");
5946  if( datatype==alglib_impl::DT_COMPLEX )
5947  {
5948  alglib::complex t = parse_complex_delim(svec[i],",]");
5949  p_vec->ptr.p_complex[i].x = t.x;
5950  p_vec->ptr.p_complex[i].y = t.y;
5951  }
5952  }
5954  }
5955  catch(...)
5956  {
5958  throw;
5959  }
5960 }
ae_bool parse_bool_delim(const char *s, const char *delim)
Definition: ap.cpp:6921
alglib::complex parse_complex_delim(const char *s, const char *delim)
Definition: ap.cpp:7086
double * p_double
Definition: ap.h:437
double parse_real_delim(const char *s, const char *delim)
Definition: ap.cpp:7077
#define i
alglib_impl::ae_vector * p_vec
Definition: ap.h:1103
void str_vector_create(const char *src, bool match_head_only, std::vector< const char *> *p_vec)
Definition: ap.cpp:6848
ae_complex * p_complex
Definition: ap.h:438
union alglib_impl::ae_vector::@11 ptr
char * filter_spaces(const char *s)
Definition: ap.cpp:6830
ae_int_t * p_int
Definition: ap.h:436
alglib_impl::ae_int_t ae_int_t
Definition: ap.h:889
void allocate_own(ae_int_t size, alglib_impl::ae_datatype datatype)
Definition: ap.cpp:5898
ae_bool * p_bool
Definition: ap.h:435
double y
Definition: ap.h:941
double x
Definition: ap.h:941
void ae_free(void *p)
Definition: ap.cpp:237
ae_int_t parse_int_delim(const char *s, const char *delim)
Definition: ap.cpp:6952

◆ length()

alglib::ae_int_t alglib::ae_vector_wrapper::length ( ) const

Definition at line 5882 of file ap.cpp.

5883 {
5884  if( p_vec==NULL )
5885  return 0;
5886  return p_vec->cnt;
5887 }
alglib_impl::ae_vector * p_vec
Definition: ap.h:1103
ae_int_t cnt
Definition: ap.h:429

◆ setlength()

void alglib::ae_vector_wrapper::setlength ( ae_int_t  iLen)

Definition at line 5872 of file ap.cpp.

5873 {
5874  if( p_vec==NULL )
5875  throw alglib::ap_error("ALGLIB: setlength() error, p_vec==NULL (array was not correctly initialized)");
5876  if( p_vec!=&vec )
5877  throw alglib::ap_error("ALGLIB: setlength() error, p_vec!=&vec (attempt to resize frozen array)");
5878  if( !ae_vector_set_length(p_vec, iLen, NULL) )
5879  throw alglib::ap_error("ALGLIB: malloc error");
5880 }
alglib_impl::ae_vector * p_vec
Definition: ap.h:1103
ae_bool ae_vector_set_length(ae_vector *dst, ae_int_t newsize, ae_state *state)
Definition: ap.cpp:658
alglib_impl::ae_vector vec
Definition: ap.h:1104

Member Data Documentation

◆ p_vec

alglib_impl::ae_vector* alglib::ae_vector_wrapper::p_vec
protected

Definition at line 1103 of file ap.h.

◆ vec

alglib_impl::ae_vector alglib::ae_vector_wrapper::vec
protected

Definition at line 1104 of file ap.h.


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