GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-struct.cc File Reference
#include <iostream>
#include "Cell.h"
#include "builtin-defun-decls.h"
#include "defun.h"
#include "error.h"
#include "errwarn.h"
#include "mxarray.h"
#include "oct-lvalue.h"
#include "oct-hdf5.h"
#include "ov-struct.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"
#include "Array-util.h"
#include "oct-locbuf.h"
#include "byte-swap.h"
#include "ls-oct-text.h"
#include "ls-oct-binary.h"
#include "ls-hdf5.h"
#include "ls-utils.h"
#include "pr-output.h"
Include dependency graph for ov-struct.cc:

Go to the source code of this file.

Classes

struct  ode
 
struct  trong
 

Functions

 A (1) esult
 
static void err_invalid_index_for_assignment (void)
 
static void err_invalid_index_type (const std::string &nm, char t)
 
OCTAVE_EXPORT octave_value_list F__fieldnames__ (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fcell2struct (const octave_value_list &args, int) that is ode
 
OCTAVE_EXPORT octave_value_list Fisfield (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fisstruct (const octave_value_list &args, int) iscell
 
OCTAVE_EXPORT octave_value_list Fnumfields (const octave_value_list &args, int)
 
 for (int i=0;i< nargin;i+=2)
 
OCTAVE_EXPORT octave_value_list Fstruct (const octave_value_list &args, int) ar
 
 if (nargin==1 &&args(0).isstruct()) return ovl(args(0))
 
 if ((nargin==1||nargin==2) &&args(0).isempty() &&args(0).is_real_matrix())
 
static void maybe_warn_invalid_field_name (const std::string &key, const char *who)
 
return ovl (map)
 
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl (args(0).isstruct())
 
static bool scalar (const dim_vector &dims)
 
create a structure array and initialize its values The dimensions of each cell array of values must match Singleton cells and non cell values are repeated so that they fill the entire array If the cells are create an empty structure array with the specified field names If the argument is an return the underlying struct Observe that the syntax is optimized for struct trong struct ("foo", 1) esult
 

Variables

If a value of is assumed xample roup A = cell2struct ("Peter", "Hannah", "Robert"; 185, 170, 168, "Name","Height", 1)
 
 ar {value2}
 
scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode cell2struct
 
dim_vector dims (1, 1)
 
create a structure array and initialize its values The dimensions of each cell array of values must match Singleton cells and non cell values are repeated so that they fill the entire array If the cells are empty
 
scalar structure containing the esult {} 0x0 struct array containing the fields: foo struct ("foo", ) esult{} scalar structure containing the fields: foo = (0x0) struct ("foo", 1, 2, 3) esult{} 1x3 struct array containing the fields: foo nd group nd example oindent The first case is an ordinary scalar struct---one field
 
scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode fieldnames
 
scalar structure containing the fields
 
int first_dimensioned_value = 0
 
scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode getfield
 
scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode isfield
 
scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode isstruct
 
octave_map map (dims)
 
scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode nargin = args.length ()
 
create a structure array and initialize its values The dimensions of each cell array of values must match Singleton cells and non cell values are repeated so that they fill the entire array If the cells are create an empty structure array with the specified field names If the argument is an object
 
scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode orderfields
 
 ots {} variables are strings specifying the names of the fields and the ar{value1}
 
scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode rmfield
 
scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode setfield
 
static bool Vprint_struct_array_contents = false
 
static int Vstruct_levels_to_print = 2
 

Function Documentation

◆ A()

A ( )

Definition at line 2006 of file ov-struct.cc.

◆ err_invalid_index_for_assignment()

static void err_invalid_index_for_assignment ( void  )
static

Definition at line 96 of file ov-struct.cc.

References error().

Referenced by octave_struct::subsasgn().

◆ err_invalid_index_type()

static void err_invalid_index_type ( const std::string nm,
char  t 
)
static

Definition at line 102 of file ov-struct.cc.

References error(), nm, and t.

Referenced by octave_struct::subsasgn(), and octave_struct::subsref().

◆ F__fieldnames__()

OCTAVE_EXPORT octave_value_list F__fieldnames__ ( const octave_value_list args,
int   
)

◆ Fcell2struct()

◆ Fisfield()

OCTAVE_EXPORT octave_value_list Fisfield ( const octave_value_list args,
int   
)

Definition at line 1908 of file ov-struct.cc.

References c, i, octave_map::isfield(), print_usage(), retval, and string.

◆ Fisstruct()

OCTAVE_EXPORT octave_value_list Fisstruct ( const octave_value_list args,
int   
)

◆ Fnumfields()

OCTAVE_EXPORT octave_value_list Fnumfields ( const octave_value_list args,
int   
)

Definition at line 1957 of file ov-struct.cc.

References error(), ovl(), and print_usage().

◆ for()

◆ Fstruct()

OCTAVE_EXPORT octave_value_list Fstruct ( const octave_value_list args,
int   
)

Definition at line 1736 of file ov-struct.cc.

◆ if() [1/2]

◆ if() [2/2]

if ( (nargin==1||nargin==2) &&args(0).isempty() &&args(0).is_real_matrix()  )

Definition at line 1754 of file ov-struct.cc.

References dims, and ovl().

◆ maybe_warn_invalid_field_name()

static void maybe_warn_invalid_field_name ( const std::string key,
const char *  who 
)
static

◆ ovl() [1/2]

return ovl ( map  )

Referenced by Fcell2struct(), Fnumfields(), if(), and struct().

◆ ovl() [2/2]

OCTAVE_EXPORT octave_value_list isa nd deftypefn* return ovl ( args(0).isstruct()  )

◆ scalar()

static bool scalar ( const dim_vector dims)
static

Definition at line 654 of file ov-struct.cc.

References dims, and dim_vector::ndims().

◆ struct()

create a structure array and initialize its values The dimensions of each cell array of values must match Singleton cells and non cell values are repeated so that they fill the entire array If the cells are create an empty structure array with the specified field names If the argument is an return the underlying struct Observe that the syntax is optimized for struct trong struct ( "foo"  ,
 
)

Variable Documentation

◆ A

If a value of is assumed xample roup A = cell2struct ("Peter", "Hannah", "Robert"; 185, 170, 168, "Name","Height", 1)

Definition at line 2006 of file ov-struct.cc.

◆ ar

If ar {value2}

Definition at line 1736 of file ov-struct.cc.

◆ cell2struct

scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode cell2struct

◆ dims

dim_vector dims(1, 1)

Referenced by if(), and scalar().

◆ empty

create a structure array and initialize its values The dimensions of each cell array of values must match Singleton cells and non cell values are repeated so that they fill the entire array If the cells are empty

Definition at line 1736 of file ov-struct.cc.

Referenced by octave::lexical_feedback::token_cache::at(), octave::lexical_feedback::token_cache::back(), octave::ListDialog::buttonCancel_clicked(), octave::InputDialog::buttonCancel_clicked(), octave::lexical_feedback::token_cache::clear(), octave::event_queue::discard_first(), octave::unwind_protect::discard_first(), octave::lexical_feedback::token_cache::front(), uibuttongroup::properties::get_boundingbox(), uipanel::properties::get_boundingbox(), octave_sparse_bool_matrix::load_hdf5(), octave_sparse_complex_matrix::load_hdf5(), octave_sparse_matrix::load_hdf5(), octave_float_complex_matrix::load_hdf5(), octave_cell::load_hdf5(), octave_char_matrix_str::load_hdf5(), octave_complex_matrix::load_hdf5(), octave_float_matrix::load_hdf5(), octave_bool_matrix::load_hdf5(), octave_matrix::load_hdf5(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::load_hdf5_internal(), main(), octave::unwind_protect::operator bool(), octave::action_container::operator bool(), octave::lexical_feedback::token_cache::pop(), octave::FileDialog::rejectSelection(), octave::event_queue::run_first(), octave::unwind_protect::run_first(), octave_sparse_bool_matrix::save_hdf5(), octave_sparse_complex_matrix::save_hdf5(), octave_sparse_matrix::save_hdf5(), octave_float_complex_matrix::save_hdf5(), octave_cell::save_hdf5(), octave_char_matrix_str::save_hdf5(), octave_complex_matrix::save_hdf5(), octave_float_matrix::save_hdf5(), octave_bool_matrix::save_hdf5(), octave_matrix::save_hdf5(), save_hdf5_empty(), octave_base_int_matrix< intNDArray< OCTAVE_INT_T > >::save_hdf5_internal(), TerminalImageFilterChain::setImage(), octave::event_queue_safe::~event_queue_safe(), text_element_list::~text_element_list(), and octave::unwind_protect_safe::~unwind_protect_safe().

◆ esult

scalar structure containing the esult {} 0x0 struct array containing the fields: foo struct ("foo", ) esult{} scalar structure containing the fields: foo = (0x0) struct ("foo", 1, 2, 3) esult{} 1x3 struct array containing the fields: foo nd group nd example oindent The first case is an ordinary scalar struct---one field

Definition at line 1736 of file ov-struct.cc.

◆ fieldnames

scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode fieldnames

◆ fields

◆ first_dimensioned_value

int first_dimensioned_value = 0

Definition at line 1779 of file ov-struct.cc.

◆ getfield

scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode getfield

◆ isfield

scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode isfield

◆ isstruct

scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode isstruct

◆ map

◆ nargin

scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode nargin = args.length ()

◆ object

create a structure array and initialize its values The dimensions of each cell array of values must match Singleton cells and non cell values are repeated so that they fill the entire array If the cells are create an empty structure array with the specified field names If the argument is an object

◆ orderfields

scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode orderfields

◆ ots

ots {} variables are strings specifying the names of the fields and the ar{value1}

Definition at line 1736 of file ov-struct.cc.

◆ rmfield

scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode rmfield

◆ setfield

scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode setfield

◆ Vprint_struct_array_contents

bool Vprint_struct_array_contents = false
static

Definition at line 60 of file ov-struct.cc.

Referenced by octave_struct::print_raw().

◆ Vstruct_levels_to_print

int Vstruct_levels_to_print = 2
static