30 map<tString,SP::MM_Attribute > mAttributes;
33 map<tString,boost::shared_ptr< SV::MM_Data > >mCompositeAssociations;
36 map<tString,boost::shared_ptr< WV::MM_Data > >mSimpleAssociations;
66 inline static SP::MM_Class
New() {
80 map<tString,boost::shared_ptr< SV::MM_Data> >::const_iterator association=mCompositeAssociations.find(name);
81 map<tString,boost::shared_ptr< SV::MM_Data> >::const_iterator end=mCompositeAssociations.end();
82 if (association==end)
return null;
83 return association->second.get();
91 map<tString,boost::shared_ptr< SV::MM_Data > >::iterator iter=mCompositeAssociations.find(name);
92 map<tString,boost::shared_ptr< SV::MM_Data > >::iterator end=mCompositeAssociations.end();
97 SV::MM_Data* list=iter->second.get();
98 if (list->getSize()<=index) {
103 return (*list)[index];
108 map<tString,boost::shared_ptr< SV::MM_Data > >::iterator iter=mCompositeAssociations.find(name);
109 map<tString,boost::shared_ptr< SV::MM_Data > >::iterator end=mCompositeAssociations.end();
110 boost::shared_ptr< SV::MM_Data > list;
113 list=SV::MM_Data::New();
114 mCompositeAssociations[name]=list;
118 if (list->getSize()<=index) {
120 list->setSize(index+1);
125 list->set(index,data);
132 map<tString,boost::shared_ptr< SV::MM_Data > >::iterator iter=mCompositeAssociations.find(name);
133 map<tString,boost::shared_ptr< SV::MM_Data > >::iterator end=mCompositeAssociations.end();
134 boost::shared_ptr< SV::MM_Data > list;
137 list=SV::MM_Data::New();
138 mCompositeAssociations[name]=list;
149 map<tString,boost::shared_ptr< SV::MM_Data> >::iterator association=mCompositeAssociations.find(name);
150 map<tString,boost::shared_ptr< SV::MM_Data> >::iterator end=mCompositeAssociations.end();
151 if (end!=association) {
152 association->second->clear();
158 map<tString,boost::shared_ptr< SV::MM_Data> >::iterator association=mCompositeAssociations.find(name);
159 map<tString,boost::shared_ptr< SV::MM_Data> >::iterator end=mCompositeAssociations.end();
160 if (end==association) {
161 boost::shared_ptr< SV::MM_Data > list=SV::MM_Data::New();
163 mCompositeAssociations[name]=list;
165 association->second->add(f);
171 return mCompositeAssociations.size();
176 map<tString,boost::shared_ptr< SV::MM_Data> >::const_iterator association=mCompositeAssociations.find(name);
177 map<tString,boost::shared_ptr< SV::MM_Data> >::const_iterator end=mCompositeAssociations.end();
178 if (association==end)
return 0;
179 return association->second->getSize();
186 map<tString,boost::shared_ptr< SV::MM_Data> >::const_iterator iter=mCompositeAssociations.begin();
187 map<tString,boost::shared_ptr< SV::MM_Data> >::const_iterator end=mCompositeAssociations.end();
189 fields.push_back(iter->first);
202 map<tString,boost::shared_ptr< WV::MM_Data > >::iterator iter=mSimpleAssociations.find(name);
203 map<tString,boost::shared_ptr< WV::MM_Data > >::iterator end=mSimpleAssociations.end();
209 WV::MM_Data *list=iter->second.get();
210 if (list->getSize()<=index) {
221 map<tString,boost::shared_ptr< WV::MM_Data > >::iterator iter=mSimpleAssociations.find(name);
222 map<tString,boost::shared_ptr< WV::MM_Data > >::iterator end=mSimpleAssociations.end();
223 boost::shared_ptr< WV::MM_Data> list;
226 list=WV::MM_Data::New();
227 mSimpleAssociations[name]=list;
232 if (list->getSize()<=index) {
234 list->setSize(index+1);
239 list->set(index,data);
245 map<tString,boost::shared_ptr< WV::MM_Data> >::iterator association=mSimpleAssociations.find(name);
246 map<tString,boost::shared_ptr< WV::MM_Data> >::iterator end=mSimpleAssociations.end();
247 if (end==association) {
248 boost::shared_ptr< WV::MM_Data > list=WV::MM_Data::New();
250 association->second=list;
252 association->second->add(f);
260 map<tString,boost::shared_ptr< WV::MM_Data > >::iterator iter=mSimpleAssociations.find(name);
261 map<tString,boost::shared_ptr< WV::MM_Data > >::iterator end=mSimpleAssociations.end();
262 boost::shared_ptr< WV::MM_Data > list;
265 list=WV::MM_Data::New();
266 mSimpleAssociations[name]=list;
276 map<tString,boost::shared_ptr< WV::MM_Data> >::iterator association=mSimpleAssociations.find(name);
277 map<tString,boost::shared_ptr< WV::MM_Data> >::iterator end=mSimpleAssociations.end();
278 if (end!=association) {
279 association->second->clear();
286 return mSimpleAssociations.size();
292 map<tString,boost::shared_ptr< WV::MM_Data> >::const_iterator association=mSimpleAssociations.find(name);
293 map<tString,boost::shared_ptr< WV::MM_Data> >::const_iterator end=mSimpleAssociations.end();
294 if (association==end)
return 0;
295 return association->second->getSize();
300 map<tString,boost::shared_ptr< WV::MM_Data> >::const_iterator association=mSimpleAssociations.find(name);
301 map<tString,boost::shared_ptr< WV::MM_Data> >::const_iterator end=mSimpleAssociations.end();
302 if (association==end)
return null;
303 return association->second.get();
310 map<tString,boost::shared_ptr< WV::MM_Data > >::const_iterator iter=mSimpleAssociations.begin();
311 map<tString,boost::shared_ptr< WV::MM_Data> >::const_iterator end=mSimpleAssociations.end();
313 fields.push_back(iter->first);
324 return mAttributes.size();
339 map<tString,SP::MM_Attribute>::iterator att=mAttributes.find(name);
340 map<tString,SP::MM_Attribute>::iterator end=mAttributes.end();
342 SP::MM_Attribute ret;
353 map<tString,SP::MM_Attribute>::const_iterator att=mAttributes.find(name);
354 map<tString,SP::MM_Attribute>::const_iterator end=mAttributes.end();
356 SPC::MM_Attribute ret;
368 map<tString,SP::MM_Attribute >::const_iterator iter=mAttributes.begin();
369 map<tString,SP::MM_Attribute >::const_iterator end=mAttributes.end();
371 fields.push_back(iter->first);
400 SP::MM_Attribute att=dynamic_sp_cast<
MM_Attribute>(data);
401 if (att.get()!=
null) {
406 SP::MM_Class cl=dynamic_sp_cast<
MM_Class>(data);
417 map<tString,boost::shared_ptr< WV::MM_Data> >::const_iterator sass=mSimpleAssociations.find(name);
418 map<tString,boost::shared_ptr< WV::MM_Data> >::const_iterator end_sass=mSimpleAssociations.end();
419 if (sass!=end_sass)
return true;
420 map<tString,boost::shared_ptr< SV::MM_Data> >::const_iterator cass=mCompositeAssociations.find(name);
421 map<tString,boost::shared_ptr< SV::MM_Data> >::const_iterator end_cass=mCompositeAssociations.end();
422 if (cass!=end_cass)
return true;
424 map<tString,SP::MM_Attribute>::const_iterator att=mAttributes.find(name);
425 map<tString,SP::MM_Attribute>::const_iterator end_att=mAttributes.end();
426 return (att!=end_att);
434 if (data.get()!=
null)
return data;
440 map<tString,boost::shared_ptr< WV::MM_Data> >::const_iterator association=mSimpleAssociations.find(name);
441 map<tString,boost::shared_ptr< WV::MM_Data> >::const_iterator end=mSimpleAssociations.end();
442 if (association==end) {
443 map<tString,boost::shared_ptr< SV::MM_Data> >::const_iterator cassociation=mCompositeAssociations.find(name);
444 map<tString,boost::shared_ptr< SV::MM_Data> >::const_iterator cend=mCompositeAssociations.end();
445 if (cassociation==cend)
return 0;
446 return cassociation->second->getSize();
449 return association->second->getSize();
463 if (data.get()!=
null)
return data;
472 map<tString,SP::MM_Attribute >::const_iterator attributes;
473 attributes=mAttributes.begin();
474 while (mAttributes.end()!=attributes) {
475 fields.push_back(attributes->first);
478 map<tString,boost::shared_ptr< SV::MM_Data > >::const_iterator compositeAssociations;
479 compositeAssociations=mCompositeAssociations.begin();
480 while (mCompositeAssociations.end()!=compositeAssociations) {
481 fields.push_back(compositeAssociations->first);
482 compositeAssociations++;
486 map<tString,boost::shared_ptr< WV::MM_Data > >::const_iterator simpleAssociations;
487 simpleAssociations=mSimpleAssociations.begin();
488 while (mSimpleAssociations.end()!=simpleAssociations) {
489 fields.push_back(simpleAssociations->first);
490 simpleAssociations++;
void clearSimpleAssociation(const tString &name)
clear the composite association of name
Definition: MM_Class.h:275
void setAttribute(const tString &name, SP::MM_Attribute f)
set the attributes with name
Definition: MM_Class.h:330
tBoolean setField(const tString &name, const tBoolean &isComposite, SP::MM_Data data)
set th field
Definition: MM_Class.h:399
This class is a primary field.
Definition: MM_Attribute.h:15
WV::MM_Data * getSimpleAssociation(const tString &name) const
get the simple association
Definition: MM_Class.h:299
#define tVectorIndex
Definition: types.h:42
SV::MM_Data * getCompositeAssociation(const tString &name) const
get the simple association
Definition: MM_Class.h:79
int getCompositeAssociationsNumber() const
get the number of simple classes
Definition: MM_Class.h:170
virtual ~MM_Class(void)
destroy an object.
Definition: MM_Class.cpp:11
#define tBoolean
Definition: types.h:48
SV::MM_Data * createCompositeAssociation(const tString &name, const int &n)
create a composite assocation of name name with size n
Definition: MM_Class.h:131
SP::MM_Data getAssociation(const tString &name)
Definition: MM_Class.h:455
tString getClassId() const
get the class id
Definition: MM_Class.h:383
#define null
Definition: types.h:13
SP::MM_Data getCompositeAssociation(const tString &name, const tVectorIndex &index)
get the index-th data from the composite association of name return null if not exists ...
Definition: MM_Class.h:89
This class is a description of class.
Definition: MM_Class.h:17
SP::MM_Data getAssociation(const tString &name, const int &index)
Definition: MM_Class.h:432
tBoolean hasField(const tString &name) const
return true if the class contains attribute or association with name
Definition: MM_Class.h:416
virtual tString toString() const
turn the class into string
Definition: MM_Class.cpp:17
void getFieldNames(vector< tString > &fields) const
get the field names
Definition: MM_Class.h:468
MM_Class(void)
create an object
Definition: MM_Class.cpp:4
SP::MM_Attribute getAttribute(const tString &name)
set the attributes with name
Definition: MM_Class.h:337
int getSimpleAssociationCardinality(const tString &name) const
get the cardinality of the simple association
Definition: MM_Class.h:291
int getAttributesNumber() const
get the number of attribute
Definition: MM_Class.h:323
void getAttributesName(vector< tString > &fields) const
get the fields name
Definition: MM_Class.h:365
int getSimpleAssociationsNumber() const
get the number of simple classes
Definition: MM_Class.h:285
int getAssociationCardinality(const tString &name) const
Definition: MM_Class.h:439
This class is a data.
Definition: MM_Data.h:17
void addSimpleAssociation(const tString &name, SP::MM_Data f)
add the association
Definition: MM_Class.h:244
WV::MM_Data * createSimpleAssociation(const tString &name, const int &n)
create a simple association of name name with size n
Definition: MM_Class.h:259
void clearCompositeAssociation(const tString &name)
clear the composite association of name
Definition: MM_Class.h:148
#define tString
Definition: types.h:49
void addCompositeAssociation(const tString &name, SP::MM_Data f)
add the association
Definition: MM_Class.h:157
void getSimpleAssociationsName(vector< tString > &fields) const
get the fields name
Definition: MM_Class.h:308
int getCompositeAssociationCardinality(const tString &name) const
get the cardinality of the simple association
Definition: MM_Class.h:175
SP::MM_Data getField(const tString &name)
Definition: MM_Class.h:461
void setClassId(const tString &id)
set the class id
Definition: MM_Class.h:388
static SP::MM_Class New()
creta a matlab class
Definition: MM_Class.h:66
SP::MM_Data getSimpleAssociation(const tString &name, const int &index)
get the index-th data from the simple association of name return null if not exists ...
Definition: MM_Class.h:200
void setSimpleAssociation(const tString &name, const int &index, SP::MM_Data data)
set the index-th data from the simple association of name
Definition: MM_Class.h:220
void getCompositeAssociationsName(vector< tString > &fields) const
get the fields name
Definition: MM_Class.h:184
SPC::MM_Attribute getAttribute(const tString &name) const
set the attributes with name
Definition: MM_Class.h:351
void setCompositeAssociation(const tString &name, const tVectorIndex &index, SP::MM_Data data)
set the index-th data from the composite association of name
Definition: MM_Class.h:107
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106