44 static const tFlag INTERFACE;
47 static const tFlag BACKUP;
57 WP::CORE_ClassFactory mFactory;
100 inline SP::CORE_ClassFactory getFactory()
const {
101 SP::CORE_ClassFactory f(mFactory.lock());
117 return mInterfaceType;
128 return mIsArrayCopied;
134 if (v.compare(
"")!=0)
saveField(
"version",v);
185 return (
isChar(isVector,isUnsigned) ||
187 isInt(isVector,isUnsigned) ||
418 for (
int i=0;i<n;i++) value[i]=values[i];
419 if (isCopied)
delete[] values;
433 for (
int i=0;i<n;i++) value[i]=values[i];
434 if (isCopied)
delete[] values;
449 for (
int i=0;i<n;i++) value[i]=values[i];
450 if (isCopied)
delete[] values;
466 for (
int i=0;i<n;i++) value[i]=values[i];
467 if (isCopied)
delete[] values;
477 long double *values=
null;
482 for (
int i=0;i<n;i++) value[i]=values[i];
483 if (isCopied)
delete[] values;
519 nRows=(int)(((sqrt(1+8*nRows)-1.)/2.)+0.5);
534 succeeds = succeeds && f->getVector(nRows,rs,isCopied);
539 succeeds = succeeds && f->getVector(n,vs,isCopied);
546 array2D.
setValues(n,vs,nRows,rs,toBeDeleted);
557 template<
class T,
class Q>
564 if (!
hasField(
"keys"))
return false;
565 if (!
hasField(
"values"))
return false;
572 primitiveMap.clear();
576 for (
int i=0;i<n;i++) {
577 primitiveMap[keys[i]]=values[i];
586 template<
class T,
class Q>
591 if (!
hasField(
"keys"))
return false;
592 if (!
hasField(
"values"))
return false;
599 primitiveMap.
clear();
603 for (
int i=0;i<n;i++) {
604 primitiveMap.
put(keys[i],values[i]);
624 virtual void createScalar(
const unsigned char& value)=0;
639 virtual void createScalar(
const long long int& value)=0;
642 virtual void createScalar(
const unsigned long long int& value)=0;
666 virtual void createVector(
const vector<tString>& values)=0;
671 virtual void createVector(
const vector<tBoolean>& values)=0;
675 virtual void createVector(
const vector<unsigned char>& values)=0;
683 virtual void createVector(
const vector<double>& values)=0;
687 virtual void createVector(
const vector<long double>& values)=0;
706 virtual void createVector(
const int& n,
const unsigned char*& values,
const tBoolean& isCopied)=0;
715 virtual void createVector(
const int& n,
const long long int*& values,
const tBoolean& isCopied)=0;
804 int n=nRows*(nRows+1)/2;
835 template<
class T,
class Q>
839 typename::map<T,Q>::const_iterator iter=primitiveMap.begin();
844 while (iter!=primitiveMap.end()) {
845 keys.push_back(iter->first);
846 values.push_back(iter->second);
859 template<
class T,
class Q>
882 SP::CORE_ClassFactory factory=getFactory();
883 if (factory.get()==
null) {
917 return setField(fieldName,isCopied,fieldValue);
977 return f->getScalar(v);
985 return f->getScalar(v);
994 return f->getScalar(v);
1003 return f->getScalar(v);
1011 return f->getScalar(v);
1020 return f->getScalar(v);
1029 return f->getScalar(v);
1038 return f->getScalar(v);
1047 return f->getScalar(v);
1057 return f->getScalar(v);
1066 return f->getScalar(v);
1080 return f->getVector(v);
1089 return f->getVector(v);
1098 return f->getVector(v);
1107 return f->getVector(v);
1116 return f->getVector(v);
1125 return f->getVector(v);
1147 if (isCopied || isArrayCopied) {
1161 return f->getVector2D(array2D,isCopied);
1168 return loadField(name,array2D,isCopied);
1187 return f->getVector(n,v,isCopied);
1195 return f->getVector(n,v,isCopied);
1204 return f->getVector(n,v,isCopied);
1213 return f->getVector(n,v,isCopied);
1223 return f->getVector(n,v,isCopied);
1232 return f->getVector(n,v,isCopied);
1242 return f->getVector(n,v,isCopied);
1278 for (
int i=0;i<n;i++) {
1281 if (isCopied)
delete[] vs;
1289 for (
int i=0;i<n;i++) {
1292 if (isCopied)
delete[] vs;
1300 for (
int i=0;i<n;i++) {
1303 if (isCopied)
delete[] vs;
1310 template<
class T,
class Q>
1315 return f->getPrimitiveMap(primitiveMap);
1319 template<
class T,
class Q>
1321 primitiveMap.
clear();
1325 return f->getPrimitiveMap(primitiveMap);
1337 return f->getFullMatrix(nRows,nCols,values,isCopied);
1350 return f->getFullSymmetricMatrix(nRows,values,isCopied);
1363 return f->getPackedSymmetricMatrix(nRows,values,isCopied);
1474 f->createVector(n,v,isCopied);
1490 template<
class T,
class Q>
1494 f->createPrimitiveMap(primitiveMap);
1512 f->createVector2D(v);
1522 template<
class T,
class Q>
1526 f->createPrimitiveMap(primitiveMap);
1540 f->createFullMatrix(nRows,nCols);
1548 f->createFullMatrix(nRows,nCols,values,isCopied);
1556 f->createFullSymmetricMatrix(nRows,values,isCopied);
1564 f->createPackedSymmetricMatrix(nRows,values,isCopied);
1616 SPC::CORE_Object l_obj(obj.lock());
1623 boost::shared_ptr<T> obj;
1651 template<
class T,
class V>
1658 template<
class K,
class V>
virtual tBoolean setClassIntoList(const tString &fieldName, const int &index, UI_Class &fieldValue)=0
set the index-th element of the classes list supposed to be composite or not depending on isComposite...
virtual tBoolean getVector(int &n, tString *&value, tBoolean &isCopied) const =0
get the vector value of argvalue
tBoolean loadField(const tString &name, int &n, unsigned char *&v, tBoolean &isCopied) const
Definition: UI_Class.h:1199
tBoolean loadField(const tString &name, int &n, tBoolean *&v, tBoolean &isCopied) const
Definition: UI_Class.h:1191
virtual tBoolean getVector(vector< double > &value) const
get the int vector value of argvalue
Definition: UI_Class.h:459
virtual tBoolean isLongLongInt(tBoolean &isVector, tBoolean &isUnsigned) const =0
virtual tBoolean isInteger(tBoolean &isVector, tBoolean &isUnsigned) const
Definition: UI_Class.h:184
tBoolean loadField(const tString &name, int &n, long double *&v, tBoolean &isCopied) const
Definition: UI_Class.h:1237
void saveClass(const UI_Object &obj)
save class obj in the UI class structure
Definition: UI_Class.h:881
tBoolean saveField(const tString &name, const CORE_Map< T, Q > &primitiveMap)
Definition: UI_Class.h:1523
virtual tBoolean getVector(vector< int > &value) const
get the int vector value of argvalue
Definition: UI_Class.h:442
tBoolean saveField(const tString &name, const long double &v)
Definition: UI_Class.h:1451
int getInterfaceType() const
set the interface type
Definition: UI_Class.h:116
virtual tBoolean getString(tString &name) const =0
get the string value of argvalue
void loadAssociation(const tString &name, boost::shared_ptr< T > &object) const
Definition: UI_Class.h:1608
this class describes an array
Definition: CORE_Vector.h:18
class CORE_SharedPointersList is a list of shared pointers
Definition: CORE_SharedPointersList.h:11
tBoolean saveField(const tString &name, const unsigned long long int &v)
Definition: UI_Class.h:1438
tBoolean loadField(const tString &name, int &n, double *&v, tBoolean &isCopied) const
Definition: UI_Class.h:1227
static tString getClassName(const tString &identityString)
return the class name of the object using only the identity string
Definition: CORE_Object.h:128
tBoolean loadField(const tString &name, long int &v) const
Definition: UI_Class.h:1024
virtual tBoolean hasFields(const vector< tString > &fields) const =0
verify the data of the class is a struct with fields
virtual void createFullMatrix(const int &nRows, const int &nCols, const double *values, tBoolean &isCopied)=0
create a matrix values must be of size nRows*nCols
tBoolean getVector2D(CORE_Array2D< T > &array2D, tBoolean &isCopied) const
get a 2D vector (or dynamical matrix with different row size)
Definition: UI_Class.h:525
void setInterfaceType(const tFlag &f)
set the interface type
Definition: UI_Class.h:111
virtual tBoolean getVector(vector< bool > &value) const
get the int vector value of argvalue
Definition: UI_Class.h:411
tBoolean saveField(const tString &name, const int &n, const T *v)
Definition: UI_Class.h:1465
virtual void printErrorMessage(const tString &msg) const =0
print the message & quit
tBoolean saveFullMatrixField(const tString &name, const int &nRows, const int &nCols, const double *values)
Definition: UI_Class.h:1544
tBoolean saveField(const tString &name, const int &v)
Definition: UI_Class.h:1416
This class is the base class of User Interface package.
Definition: UI_Object.h:23
tBoolean loadField(const tString &name, long double &v) const
Definition: UI_Class.h:1061
This class describes the main interface class for a soft user interface (R,matlab,python etc...) class.
Definition: UI_Class.h:38
tBoolean saveField(const tString &name, const tString &v)
Definition: UI_Class.h:1379
tBoolean loadField(const tString &name, int &n, tString *&v, tBoolean &isCopied) const
Definition: UI_Class.h:1183
virtual void createVector(const int &n, const long int *values)
create a vector size of values must be n
Definition: UI_Class.h:744
virtual void createVector(const int &n, const long double *values)
create a vector size of values must be n
Definition: UI_Class.h:758
virtual tBoolean isInt(tBoolean &isVector, tBoolean &isUnsigned) const =0
SP::CORE_Object loadAssociation(const tString &name) const
load the association Note that the factory class must be set to create the class If nit the return ob...
Definition: UI_Class.h:1597
void setValues(const int &nvs, const T *vs, const int &nrs, const int *rs)
set the values
Definition: CORE_Array2D.h:117
tBoolean saveField(const tString &name, const double &v)
Definition: UI_Class.h:1445
tBoolean loadField(const tString &name, short &v) const
Definition: UI_Class.h:1007
virtual tBoolean isClass() const =0
verify if the data of the class is a struct
tBoolean saveField(const tString &name, const unsigned char &v)
Definition: UI_Class.h:1402
virtual tBoolean hasField(const tString &field) const =0
verify if the data of the class is a struct with fields names
void saveAssociation(const tString &name, const boost::weak_ptr< T > &obj)
save the association with single cardiality
Definition: UI_Class.h:1615
void saveAssociation(const tString &name, const boost::shared_ptr< T > &obj)
save the association with single cardiality
Definition: UI_Class.h:1604
#define tBoolean
Definition: types.h:48
void setValuesByReference(const tArrayIndex &n, T *&array, const tBoolean &hasToBeDeleted)
set the the values by reference the values is destroyed at the end if hasToBeDeleted is true ...
Definition: CORE_Array.h:305
const vector< T > & getValues() const
get values
Definition: CORE_Vector.h:399
virtual tBoolean setField(const tString &fieldName, UI_Class &fieldValue)
set the field fieldName of the class
Definition: UI_Class.h:915
tBoolean saveField(const tString &name, const CORE_Vector< T > &v)
Definition: UI_Class.h:1518
tBoolean loadField(const tString &name, vector< int > &v) const
Definition: UI_Class.h:1102
tBoolean loadField(const tString &name, const int &n, int v[]) const
Definition: UI_Class.h:1295
void saveAssociation(const tString &name, const tBoolean &isComposite, const CORE_Object *obj)
save the association with single cardinality
Definition: UI_Class.cpp:40
virtual tBoolean isDoubleFullMatrix() const =0
#define null
Definition: types.h:13
tBoolean saveField(const tString &name, const short int &v)
Definition: UI_Class.h:1409
int getRowsNumber() const
get the rows number
Definition: CORE_Array2D.h:393
tBoolean getPrimitiveMap(map< T, Q > &primitiveMap) const
get a primitive map
Definition: UI_Class.h:558
tBoolean isArrayCopied() const
return true if the array must be copied
Definition: UI_Class.h:127
virtual void createClass(const tString &id)=0
create the empty class with type id
virtual void getFieldNames(vector< tString > &name) const =0
get the field names
virtual tBoolean isShortInt(tBoolean &isVector, tBoolean &isUnsigned) const =0
tBoolean loadField(const tString &name, CORE_Array< T > &v) const
Definition: UI_Class.h:1131
virtual tBoolean isDouble(tBoolean &isVector) const =0
const int * getRowIndices() const
get the row indices
Definition: CORE_Array2D.h:388
virtual tBoolean getScalar(tString &name) const
get the string value of argvalue
Definition: UI_Class.h:254
virtual tBoolean getVector(vector< unsigned char > &value) const
get the int vector value of argvalue
Definition: UI_Class.h:426
tBoolean loadField(const tString &name, vector< double > &v) const
Definition: UI_Class.h:1111
tBoolean saveFullSymmetricMatrixField(const tString &name, const int &nRows, const double *values)
Definition: UI_Class.h:1552
virtual void createVector(const int &n, const tBoolean *values)
create a vector size of values must be n
Definition: UI_Class.h:728
tBoolean loadPackedSymmetricMatrixField(const tString &name, int &nRows, double *&values) const
Definition: UI_Class.h:1367
tBoolean loadField(const tString &name, vector< long double > &v) const
Definition: UI_Class.h:1120
virtual tBoolean isChar(tBoolean &isVector, tBoolean &isUnsigned) const =0
tBoolean getPrimitiveMap(CORE_Map< T, Q > &primitiveMap) const
get a primitive map
Definition: UI_Class.h:587
tString getIdentityString() const
return the identity string of the object of the form className_at_address
Definition: CORE_Object.h:136
virtual tBoolean getVector(vector< long double > &value) const
get the int vector value of argvalue
Definition: UI_Class.h:475
This class describes a map: primitive type of Key -> shared pointer of Value.
Definition: CORE_SharedPointersVMap.h:15
virtual void createString(const tString &value)=0
create a string
virtual ~UI_Class(void)
destroy an object.
Definition: UI_Class.cpp:17
tBoolean loadField(const tString &name, unsigned long long int &v) const
Definition: UI_Class.h:1042
void put(const Key &k, const Value &v)
set the value at the index k
Definition: CORE_Map.h:178
virtual void createVector(const vector< tString > &values)=0
create a vector of string
tBoolean loadField(const tString &name, vector< tString > &v) const
Definition: UI_Class.h:1075
tBoolean loadField(const tString &name, CORE_Array2D< T > &array2D, tBoolean &isCopied) const
Definition: UI_Class.h:1157
virtual tBoolean isBoolean(tBoolean &isVector) const =0
tBoolean loadField(const tString &name, tString &v) const
Definition: UI_Class.h:973
this class describes a map
Definition: CORE_Map.h:18
tBoolean loadField(const tString &name, unsigned char &v) const
Definition: UI_Class.h:989
tBoolean saveField(const tString &name, const int &n, const T *v, const tBoolean &isCopied)
Definition: UI_Class.h:1471
this class describes an array
Definition: CORE_Array.h:18
tBoolean loadField(const tString &name, const int &n, double v[]) const
Definition: UI_Class.h:1284
tBoolean loadField(const tString &name, vector< unsigned char > &v) const
Definition: UI_Class.h:1093
tBoolean loadField(const tString &name, CORE_Array< T > &v, tBoolean &isCopied) const
Definition: UI_Class.h:1139
tBoolean loadField(const tString &name, int &n, int *&v, tBoolean &isCopied) const
Definition: UI_Class.h:1208
void clear()
clear the map
Definition: CORE_Map.h:207
tBoolean saveField(const tString &name, const tBoolean &v)
Definition: UI_Class.h:1387
virtual tBoolean getField(const tString &field, UI_Class &uiClass) const =0
get the field name of the class
virtual void printMessage(const tString &msg) const =0
print the message on screen
tBoolean loadField(const tString &name, int &n, tString *&v) const
Definition: UI_Class.h:1260
this class describes an array of arrays
Definition: CORE_Array2D.h:13
tBoolean loadField(const tString &name, long long int &v) const
Definition: UI_Class.h:1033
virtual void createVector(const int &n, const int *values)
create a vector size of values must be n
Definition: UI_Class.h:736
SP::CORE_Object loadAssociation(const tString &name, const tBoolean &isComposite) const
load the association Note that the factory class must be set to create the class If nit the return ob...
Definition: UI_Class.cpp:86
tBoolean saveField(const tString &name, const long int &v)
Definition: UI_Class.h:1424
virtual int * createIntVector(const int &n)=0
create a vector of int of size n
tBoolean saveField(const tString &name, const vector< T > &v)
Definition: UI_Class.h:1484
tBoolean loadField(const tString &name, const int &n, long double v[]) const
Definition: UI_Class.h:1273
virtual tBoolean isLongInt(tBoolean &isVector, tBoolean &isUnsigned) const =0
void setVersion(const tString &v)
set the version
Definition: UI_Class.h:133
tBoolean loadField(const tString &name, char &v) const
Definition: UI_Class.h:998
void createVector2D(const CORE_Array2D< T > &array2D)
Definition: UI_Class.h:825
virtual tBoolean isFloat(tBoolean &isVector) const =0
tBoolean loadField(const tString &name, CORE_Array2D< T > &array2D) const
Definition: UI_Class.h:1166
virtual SP::UI_Class NewInstance() const =0
create a new instance of class
virtual void createFullMatrix(const int &nRows, const int &nCols, const double *values)
create a matrix values must be of size nRows*nCols
Definition: UI_Class.h:774
void loadAssociation(const tString &name, boost::weak_ptr< T > &object) const
Definition: UI_Class.h:1622
tBoolean loadField(const tString &name, int &v) const
Definition: UI_Class.h:1015
virtual tString getClassName() const =0
get the class name
virtual int getClassesListSize(const tString &fieldName) const =0
get the number of classes of the list
tBoolean loadField(const tString &name, vector< tBoolean > &v) const
Definition: UI_Class.h:1084
virtual void createFullSymmetricMatrix(const int &nRows, const double *values)
create a full symmetric matrix
Definition: UI_Class.h:794
tBoolean loadFullMatrixField(const tString &name, int &nRows, int &nCols, double *&values, tBoolean &isCopied) const
Definition: UI_Class.h:1332
class CORE_WeakPointersList is a list of weak shared pointers
Definition: CORE_WeakPointersList.h:11
void createPrimitiveMap(const map< T, Q > &primitiveMap)
Definition: UI_Class.h:836
tBoolean saveField(const tString &name, const CORE_Array2D< T > &v)
Definition: UI_Class.h:1509
tBoolean saveField(const tString &name, const long long int &v)
Definition: UI_Class.h:1431
void setValues(const CORE_Array< T > &array, const tArrayIndex &fromIndex)
Definition: CORE_Array.hpp:214
virtual tBoolean getFullMatrix(int &nRows, int &nCols, double *&value, tBoolean &isCopied) const =0
get the double full matrix value of argvalue
abstract base class for most classes.
Definition: CORE_Object.h:30
virtual double * createDoubleVector(const int &n)=0
create a vector of double of size n
const T * getValues(tArrayIndex &s) const
get the values of the util vector
Definition: CORE_Array.h:371
tBoolean getPackedSymmetricMatrix(int &nRows, double *&value, tBoolean &isCopied) const
Definition: UI_Class.h:517
#define tString
Definition: types.h:49
void setIsArrayCopied(const tBoolean &v)
set if the arrays must be copied
Definition: UI_Class.h:121
const T * getValues() const
get the values
Definition: CORE_Array2D.h:377
virtual tBoolean setField(const tString &fieldName, const tBoolean &isComposite, UI_Class &fieldValue)=0
set the field fieldName of the class
tBoolean saveField(const tString &name, const char &v)
Definition: UI_Class.h:1395
tBoolean loadField(const tString &name, double &v) const
Definition: UI_Class.h:1052
tBoolean loadField(const tString &name, int &n, unsigned long int *&v, tBoolean &isCopied) const
Definition: UI_Class.h:1218
virtual void createPackedSymmetricMatrix(const int &nRows, const double *values)
create a packed symmetric matrix values must be of size nRows*(nRows+1)/2
Definition: UI_Class.h:810
virtual tBoolean isLongDouble(tBoolean &isVector) const =0
int getValuesNumber() const
return the size of the array
Definition: CORE_Array2D.h:355
virtual void finalize()
method called for finalizing the saving in UI_CLass
Definition: UI_Class.h:1575
static SP::CORE_ClassFactory New()
Definition: CORE_ClassFactory.h:62
tBoolean loadField(const tString &name, bool &v) const
Definition: UI_Class.h:981
tBoolean loadFullSymmetricMatrixField(const tString &name, int &nRows, double *&values) const
Definition: UI_Class.h:1354
tBoolean loadField(const tString &name, CORE_Vector< T > &v) const
Definition: UI_Class.h:1172
void saveAssociation(const tString &name, const CORE_Object *obj)
save the association with single cardinality
Definition: UI_Class.h:1590
tBoolean loadPackedSymmetricMatrixField(const tString &name, int &nRows, double *&values, tBoolean &isCopied) const
Definition: UI_Class.h:1358
virtual void saveToUIClass(UI_Class &mclass) const
how to save the object from a mate model class
Definition: UI_Object.cpp:18
tBoolean loadField(const tString &name, int &n, int *&v) const
Definition: UI_Class.h:1264
virtual void createFullSymmetricMatrix(const int &nRows, const double *values, const tBoolean &isCopied)
create a full symmetric matrix values must be of size nRows*nRows
Definition: UI_Class.h:786
const tArrayIndex & getSize() const
return the size of the array
Definition: CORE_Array.h:223
tBoolean saveField(const tString &name, const CORE_Array< T > &v)
Definition: UI_Class.h:1503
tBoolean loadField(const tString &name, CORE_Map< T, Q > &primitiveMap) const
Definition: UI_Class.h:1320
tBoolean getFullSymmetricMatrix(int &nRows, double *&value, tBoolean &isCopied) const
Definition: UI_Class.h:508
tBoolean loadField(const tString &name, int &n, long double *&v) const
Definition: UI_Class.h:1252
virtual void createScalar(const tString &value)
create a scalar
Definition: UI_Class.h:619
virtual tBoolean getClassFromList(const tString &fieldName, const int &index, UI_Class &uiClass) const =0
get the field of the index-th class in the list
tBoolean loadField(const tString &name, map< T, Q > &primitiveMap) const
Definition: UI_Class.h:1311
void createPrimitiveMap(const CORE_Map< T, Q > &primitiveMap)
Definition: UI_Class.h:860
void setFactory(SP::CORE_ClassFactory fact)
Definition: UI_Class.h:94
virtual void createPackedSymmetricMatrix(const int &nRows, const double *values, const tBoolean &isCopied)
create a packed symmetric matrix values must be of size nRows*(nRows+1)/2
Definition: UI_Class.h:803
tBoolean createFullMatrixField(const tString &name, const int &nRows, const int &nCols)
Definition: UI_Class.h:1537
void createVector2D(const CORE_Array2D< T > &array2D, const tBoolean &isCopied)
Definition: UI_Class.h:818
tBoolean savePackedSymmetricMatrixField(const tString &name, const int &nRows, const double *values)
Definition: UI_Class.h:1560
tBoolean saveField(const tString &name, const map< T, Q > &primitiveMap)
Definition: UI_Class.h:1491
virtual tBoolean isString(tBoolean &isVector) const =0
void getValues(CORE_Vector< Value > &vals) const
return an array of values
Definition: CORE_Map.hpp:67
UI_Class(void)
create an object
Definition: UI_Class.cpp:11
virtual void createVector(const int &n, const double *values)
create a vector size of values must be n
Definition: UI_Class.h:751
tBoolean loadFullMatrixField(const tString &name, int &nRows, int &nCols, double *&values) const
Definition: UI_Class.h:1341
tString getVersion() const
set the version
Definition: UI_Class.h:138
tBoolean loadFullSymmetricMatrixField(const tString &name, int &nRows, double *&values, tBoolean &isCopied) const
Definition: UI_Class.h:1345
virtual void createClassesList(const tString &fieldName, const tBoolean &isComposite, const int &n)=0
create a multiple association of size n with name fieldname of type isComoposite
#define tFlag
Definition: types.h:14
tBoolean loadField(const tString &name, int &n, double *&v) const
Definition: UI_Class.h:1256
void getKeys(vector< Key > &ks) const
return a vector of keys
Definition: CORE_Map.hpp:109