MatrixBerryCore
Namespaces | Classes | Functions
mxberry::core::obj Namespace Reference

Namespaces

 test
 

Classes

class  HandleObjectCloner
 HANDLEOBJECTCLONER provides some simple functionality for clonable objects. More...
 
class  ObjectComparisonMode
 
class  ReflectionHelper
 REFLECTIONHELPER - serves a single purpose: retrieving a name of currently constructed object. More...
 
class  StaticPropStorage
 

Functions

function processpropvalue (in objSizeVec, in value, in fTypeCheckFunc)
 PROCESSPROPVALUE is a helper function for assigning property values especially when a set of values should be assigned to an array of objects in a vectorial manner. More...
 

Function Documentation

◆ processpropvalue()

function mxberry::core::obj::processpropvalue ( in  objSizeVec,
in  value,
in  fTypeCheckFunc 
)

PROCESSPROPVALUE is a helper function for assigning property values especially when a set of values should be assigned to an array of objects in a vectorial manner.

*  Input:
*    regular:
*        sizeVec: numeric[1,k]= [n1,n2,. . .,n_k] - size of the target object
*           array to which the value should be assigned
*        value: any[]/cell[n1,n2,. . .,n_k] - a value to be assigned to self
*           array (please note that it is acceptable for value and self to
*           be of a different size, but in the latter case value should
*           either contain the same number of elements or be a property
*           value that is to be propogated to all the elements of self array
* 
*        fTypeCheckFunc: function_handle[1,1] - a function that checks if
*           the value type corresponds to the object field type
* 
*  Output:
*    valueArray: cell[n1,n2,. . .,n_k] - an array of property values
* 
*  Example1:
*    valueArray=processpropvalue([10 20 30],{'cell','char'},@iscellstr)
*        in this example {'cell','char'} is a single property value because it
*        passes @iscellstr check; thus the function replicates this value
*        for for all elements of valueArray where size(valueArray)=[10 20 30]
* 
*  Example2:
*    valueArray=processpropvalue([10 20 30],{{'cell','char'}},@iscellstr)
*        in this example the function automatically figures out that it is
*        {'cell','char'}, not {{'cell','char'}} that is a property value.
*        Thus {'cell','char'} is replicated to form valueArray
* 
*  Example3: (using the function to implement assignValue method of some handle class:
* 
*          function valueList=assignValue(self,value,fTypeCheckFunc,fieldName)
*              % ASSIGN value is a thin wrapper for processvalue which allows
*              % a vectorial property assignment
*              %
*              valueList=mxberry.core.obj.processvalue(size(self),value,fTypeCheckFunc);
*              [self.(fieldName)]=deal(valueList{:});
*              %
*          end
*    In this example self is an object array
* 
Author
Peter Gagarinov, PhD pgaga.nosp@m.rino.nosp@m.v@gma.nosp@m.il.c.nosp@m.om