#include <iostream>
#include "Cell.h"
#include "defun.h"
#include "error.h"
#include "gripes.h"
#include "oct-lvalue.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-ascii.h"
#include "ls-oct-binary.h"
#include "ls-hdf5.h"
#include "ls-utils.h"
#include "pr-output.h"
Go to the source code of this file.
Functions | |
DEFINE_OCTAVE_ALLOCATOR (octave_struct) | |
DEFINE_OCTAVE_ALLOCATOR (octave_scalar_struct) | |
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_struct,"struct","struct") | |
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_scalar_struct,"scalar struct","struct") | |
DEFUN (struct_levels_to_print, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} struct_levels_to_print ()\n\ @deftypefnx {Built-in Function} {@var{old_val} =} struct_levels_to_print (@var{new_val})\n\ @deftypefnx {Built-in Function} {} struct_levels_to_print (@var{new_val}, \"local\")\n\ Query or set the internal variable that specifies the number of\n\ structure levels to display.\n\ \n\ When called from inside a function with the \"local\" option, the variable is\n\ changed locally for the function and any subroutines it calls. The original\n\ variable value is restored when exiting the function.\n\ @end deftypefn") | |
DEFUN (rmfield, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} rmfield (@var{s}, @var{f})\n\ Return a copy of the structure (array) @var{s} with the field @var{f}\n\ removed. If @var{f} is a cell array of strings or a character array, remove\n\ the named fields.\n\ @seealso{cellstr, iscellstr, setfield}\n\ @end deftypefn") | |
DEFUN (nfields, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} nfields (@var{s})\n\ Return the number of fields of the structure @var{s}.\n\ @end deftypefn") | |
DEFUN (struct, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} struct (\"field\", @var{value}, \"field\", @var{value}, @dots{})\n\ \n\ Create a structure and initialize its value.\n\ \n\ If the values are cell arrays, create a structure array and initialize\n\ its values. The dimensions of each cell array of values must match.\n\ Singleton cells and non-cell values are repeated so that they fill\n\ the entire array. If the cells are empty, create an empty structure\n\ array with the specified field names.\n\ \n\ If the argument is an object, return the underlying struct.\n\ @end deftypefn") | |
DEFUN (isstruct, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} isstruct (@var{x})\n\ Return true if @var{x} is a structure or a structure array.\n\ @seealso{ismatrix, iscell, isa}\n\ @end deftypefn") | |
DEFUN (fieldnames, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} fieldnames (@var{struct})\n\ Return a cell array of strings naming the elements of the structure\n\ @var{struct}. It is an error to call @code{fieldnames} with an\n\ argument that is not a structure.\n\ @end deftypefn") | |
DEFUN (print_struct_array_contents, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} print_struct_array_contents ()\n\ @deftypefnx {Built-in Function} {@var{old_val} =} print_struct_array_contents (@var{new_val})\n\ @deftypefnx {Built-in Function} {} print_struct_array_contents (@var{new_val}, \"local\")\n\ Query or set the internal variable that specifies whether to print struct\n\ array contents. If true, values of struct array elements are printed.\n\ This variable does not affect scalar structures. Their elements\n\ are always printed. In both cases, however, printing will be limited to\n\ the number of levels specified by @var{struct_levels_to_print}.\n\ \n\ When called from inside a function with the \"local\" option, the variable is\n\ changed locally for the function and any subroutines it calls. The original\n\ variable value is restored when exiting the function.\n\ @end deftypefn") | |
DEFUN (isfield, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} isfield (@var{x}, @var{name})\n\ Return true if the @var{x} is a structure and it\n\ includes an element named @var{name}. If @var{name} is a cell\n\ array of strings then a logical array of equal dimension is returned.\n\ @end deftypefn") | |
DEFUN (cell2struct, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} cell2struct (@var{cell}, @var{fields}, @var{dim})\n\ Convert @var{cell} to a structure. The number of fields in @var{fields}\n\ must match the number of elements in @var{cell} along dimension @var{dim},\n\ that is @code{numel (@var{fields}) == size (@var{cell}, @var{dim})}.\n\ If @var{dim} is omitted, a value of 1 is assumed.\n\ \n\ @example\n\ @group\n\ A = cell2struct (@{'Peter', 'Hannah', 'Robert';\n\ 185, 170, 168@},\n\ @{'Name','Height'@}, 1);\n\ A(1)\n\ @result{} ans =\n\ @{\n\ Name = Peter\n\ Height = 185\n\ @}\n\ \n\ @end group\n\ @end example\n\ @end deftypefn") | |
octave_value_list | Fcellstr (const octave_value_list &args, int) |
static void | gripe_failed_assignment (void) |
static void | gripe_invalid_index_for_assignment (void) |
static void | gripe_invalid_index_type (const std::string &nm, char t) |
static bool | scalar (const dim_vector &dims) |
Variables | |
static bool | Vprint_struct_array_contents = false |
static int | Vstruct_levels_to_print = 2 |
DEFINE_OCTAVE_ALLOCATOR | ( | octave_struct | ) |
DEFINE_OCTAVE_ALLOCATOR | ( | octave_scalar_struct | ) |
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA | ( | octave_struct | , | |
"struct" | , | |||
"struct" | ||||
) |
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA | ( | octave_scalar_struct | , | |
"scalar struct" | , | |||
"struct" | ||||
) |
DEFUN | ( | struct_levels_to_print | , | |
args | , | |||
nargout | ||||
) |
Definition at line 2217 of file ov-struct.cc.
References SET_INTERNAL_VARIABLE_WITH_LIMITS.
DEFUN | ( | rmfield | , | |
args | ||||
) |
Definition at line 2160 of file ov-struct.cc.
References octave_value_list::cell_value(), error(), error_state, Fcellstr(), octave_map::isfield(), Array< T >::numel(), print_usage(), and octave_map::rmfield().
DEFUN | ( | nfields | , | |
args | ||||
) |
Definition at line 1994 of file ov-struct.cc.
References print_usage().
DEFUN | ( | struct | , | |
args | ||||
) |
Definition at line 1735 of file ov-struct.cc.
References Array< T >::dims(), error(), error_state, octave_value::map_value(), octave_value(), scalar, octave_map::setfield(), and valid_identifier().
DEFUN | ( | isstruct | , | |
args | ||||
) |
Definition at line 1877 of file ov-struct.cc.
References octave_value::is_map(), and print_usage().
DEFUN | ( | fieldnames | , | |
args | ||||
) |
Definition at line 1894 of file ov-struct.cc.
References arg(), octave_map::fieldnames(), gripe_wrong_type_arg(), octave_value::is_map(), octave_value::is_object(), Array< T >::length(), octave_value::map_value(), and print_usage().
DEFUN | ( | print_struct_array_contents | , | |
args | , | |||
nargout | ||||
) |
Definition at line 2234 of file ov-struct.cc.
References SET_INTERNAL_VARIABLE.
DEFUN | ( | isfield | , | |
args | ||||
) |
Definition at line 1937 of file ov-struct.cc.
References Array< T >::dims(), octave_map::isfield(), and print_usage().
DEFUN | ( | cell2struct | , | |
args | ||||
) |
Definition at line 2026 of file ov-struct.cc.
References octave_value::cell_value(), Cell::cellstr_value(), idx_vector::colon, Array< T >::dims(), error(), error_state, Cell::index(), max(), Array< T >::ndims(), Array< T >::numel(), print_usage(), dim_vector::redim(), Cell::reshape(), and octave_map::setfield().
octave_value_list Fcellstr | ( | const octave_value_list & | args, | |
int | ||||
) |
Referenced by DEFUN().
static void gripe_failed_assignment | ( | void | ) | [static] |
Definition at line 113 of file ov-struct.cc.
References error().
Referenced by octave_scalar_struct::subsasgn(), and octave_struct::subsasgn().
static void gripe_invalid_index_for_assignment | ( | void | ) | [static] |
Definition at line 101 of file ov-struct.cc.
References error().
Referenced by octave_struct::subsasgn().
static void gripe_invalid_index_type | ( | const std::string & | nm, | |
char | t | |||
) | [static] |
Definition at line 107 of file ov-struct.cc.
References error().
Referenced by octave_struct::subsasgn(), and octave_struct::subsref().
static bool scalar | ( | const dim_vector & | dims | ) | [static] |
Definition at line 689 of file ov-struct.cc.
References dim_vector::length().
bool Vprint_struct_array_contents = false [static] |
Definition at line 58 of file ov-struct.cc.
Referenced by octave_struct::print_raw().
int Vstruct_levels_to_print = 2 [static] |
Definition at line 54 of file ov-struct.cc.