Version: 9.16.0
General methods

Functions

PMMLLIB_EXPORT PMMLlib::PMMLlib::PMMLlib (std::string file, bool log=false)
 
PMMLLIB_EXPORT PMMLlib::PMMLlib::PMMLlib (bool log=false)
 This constructor is mandatory for Swig because it can be used with no parameters. More...
 
PMMLLIB_EXPORT PMMLlib::PMMLlib::~PMMLlib ()
 
PMMLLIB_EXPORT void PMMLlib::PMMLlib::SetCurrentModel (std::string modelName, PMMLType type)
 
PMMLLIB_EXPORT void PMMLlib::PMMLlib::SetCurrentModel (std::string modelName)
 Throw an exception if there is no model or more than one model with name "modelName" in the PMML file. More...
 
PMMLLIB_EXPORT void PMMLlib::PMMLlib::SetCurrentModel ()
 Throw an exception if no model is found or if there are more than one model in the PMLL file. More...
 
PMMLLIB_EXPORT std::string PMMLlib::PMMLlib::makeLog () const
 
PMMLLIB_EXPORT void PMMLlib::PMMLlib::printLog () const
 
PMMLLIB_EXPORT void PMMLlib::PMMLlib::AddDataField (std::string name, std::string displayName, std::string optype, std::string dataType, std::string closure, double leftMargin, double rightMargin, bool interval=false)
 
PMMLLIB_EXPORT void PMMLlib::PMMLlib::AddMiningSchema (std::string name, std::string usageType)
 Common to all models. More...
 
PMMLLIB_EXPORT void PMMLlib::PMMLlib::SetHeader (std::string copyright, std::string description, std::string appName, std::string appVersion, std::string annotation)
 
PMMLLIB_EXPORT void PMMLlib::PMMLlib::UnlinkNode ()
 
PMMLLIB_EXPORT void PMMLlib::PMMLlib::BackupNode ()
 
PMMLLIB_EXPORT int PMMLlib::PMMLlib::GetModelsNb ()
 
PMMLLIB_EXPORT void PMMLlib::PMMLlib::Write ()
 
PMMLLIB_EXPORT void PMMLlib::PMMLlib::Write (std::string file)
 
PMMLLIB_EXPORT PMMLType PMMLlib::PMMLlib::GetCurrentModelType ()
 type is kUNDEFINED if no model is set or if model type is not handled More...
 
PMMLLIB_EXPORT std::string PMMLlib::PMMLlib::GetCurrentModelName ()
 name is "" if no model is set More...
 
xmlNodePtr PMMLlib::PMMLlib::GetChildByName (xmlNodePtr node, std::string nodename)
 
xmlNodePtr PMMLlib::PMMLlib::GetPtr (int ann_index, std::string name)
 
xmlNodePtr PMMLlib::PMMLlib::GetPtr (std::string ann_name, std::string name)
 
void PMMLlib::PMMLlib::CountModels ()
 
int PMMLlib::PMMLlib::CountNeuralNetModels ()
 
int PMMLlib::PMMLlib::CountRegressionModels ()
 
void PMMLlib::PMMLlib::SetRootNode ()
 
std::string PMMLlib::PMMLlib::GetModelName (xmlNodePtr node)
 
std::string PMMLlib::PMMLlib::GetTypeString ()
 

Detailed Description

Common methods to all kinds of PMML files and models

Function Documentation

◆ AddDataField()

void PMMLlib::PMMLlib::AddDataField ( std::string  fieldName,
std::string  displayName,
std::string  optype,
std::string  dataType,
std::string  closure,
double  leftMargin,
double  rightMargin,
bool  interval = false 
)

Add a DataField node to the DataDictionnary node

Parameters
fieldNameValue of property "name"
displayNameValue of property "displayName"
optypeValue of property "optype"
dataTypeValue of property "dataType"
closureValue of property "closure" in node Interval
leftMarginValue of property "leftMargin" in node Interval
rightMarginValue of property "rightMargin" in node Interval
intervalFlag to add a node Interval (if true)

Definition at line 1317 of file PMMLlib.cxx.

1325{
1326 // if 'DataDictionary' node does not exist, create it
1327 xmlNodePtr dataDictNode = GetChildByName(_rootNode, "DataDictionary");
1328 if(!dataDictNode)
1329 {
1330 dataDictNode = xmlNewChild(_rootNode, 0, (const xmlChar*)"DataDictionary", 0);
1331 }
1332
1333 // then append the node
1334 xmlNodePtr dataFieldNode = xmlNewChild(dataDictNode, 0, (const xmlChar*)"DataField", 0);
1335 xmlNewProp(dataFieldNode, (const xmlChar*)"name", (const xmlChar*)(fieldName.c_str()) );
1336 xmlNewProp(dataFieldNode, (const xmlChar*)"displayName", (const xmlChar*)(displayName.c_str()) );
1337 xmlNewProp(dataFieldNode, (const xmlChar*)"optype", (const xmlChar*)(optype.c_str()) );
1338 xmlNewProp(dataFieldNode, (const xmlChar*)"dataType", (const xmlChar*)(dataType.c_str()) );
1339
1340 if ( interval )
1341 {
1342 xmlNodePtr intervalNode = xmlNewChild(dataFieldNode, 0, (const xmlChar*)"Interval", 0);
1343 xmlNewProp(intervalNode, (const xmlChar*)"closure", (const xmlChar*)(closure.c_str()) );
1344 stringstream ss;
1345 ss << scientific << leftMargin;
1346 xmlNewProp(intervalNode, (const xmlChar*)"leftMargin", (const xmlChar*)(ss.str().c_str()) );
1347 ss.str("");
1348 ss << scientific << rightMargin;
1349 xmlNewProp(intervalNode, (const xmlChar*)"rightMargin", (const xmlChar*)(ss.str().c_str()) );
1350 }
1351}
xmlNodePtr _rootNode
Root node of the document.
Definition: PMMLlib.hxx:79
xmlNodePtr GetChildByName(xmlNodePtr node, std::string nodename)
Definition: PMMLlib.cxx:310

◆ AddMiningSchema()

void PMMLlib::PMMLlib::AddMiningSchema ( std::string  name,
std::string  usageType 
)

Common to all models.

Add the MiningSchema node.

Parameters
nameValue of property "name".
usageTypeValue of property "usageType".

Definition at line 286 of file PMMLlib.cxx.

288{
289 xmlNodePtr netNode = _currentModelNode;
290
291 // if 'MiningSchema' node does not exist, create it
292 xmlNodePtr miningSchemaNode = GetChildByName(netNode, "MiningSchema");
293 if(!miningSchemaNode)
294 {
295 miningSchemaNode = xmlNewChild(netNode, 0, (const xmlChar*)"MiningSchema", 0);
296 }
297
298 // then append the node
299 xmlNodePtr miningFieldNode = xmlNewChild(miningSchemaNode, 0, (const xmlChar*)"MiningField", 0);
300 xmlNewProp(miningFieldNode, (const xmlChar*)"name", (const xmlChar*)(name.c_str()) );
301 xmlNewProp(miningFieldNode, (const xmlChar*)"usageType", (const xmlChar*)(usageType.c_str()) );
302}
xmlNodePtr _currentModelNode
Pointer to the current model node
Definition: PMMLlib.hxx:84

◆ BackupNode()

void PMMLlib::PMMLlib::BackupNode ( )

Make a backup of the current model node.

Definition at line 535 of file PMMLlib.cxx.

536{
537 // Node name depending of PMML type
538 string name = GetTypeString();
539 // Find the last save index number
540 int nCrtIndex = 0;
541 stringstream ss;
542 ss << _currentModelName << "_" << nCrtIndex;
543 xmlNodePtr ptr = GetPtr(ss.str(), name);
544 while( ptr )
545 {
546 nCrtIndex++;
547 if (_log)
548 cout << " ** nCrtIndex[" << nCrtIndex << "]" << endl;
549
550 ss.str("");
551 ss << _currentModelName << "_" << nCrtIndex;
552 ptr = GetPtr(ss.str(), name);
553 }
554 if(_log)
555 cout << " *** Node \"" << _currentModelName << "\" found, then backup it with index [" << nCrtIndex << "]" << endl;
556 // Rename model
557 xmlUnsetProp(_currentModelNode, (const xmlChar*)"modelName");
558 xmlNewProp(_currentModelNode, (const xmlChar*)"modelName", (const xmlChar*)(ss.str().c_str()));
559}
bool _log
Log Printing.
Definition: PMMLlib.hxx:76
std::string _currentModelName
Name of the current model
Definition: PMMLlib.hxx:82
std::string GetTypeString()
Definition: PMMLlib.cxx:473
xmlNodePtr GetPtr(int ann_index, std::string name)
Definition: PMMLlib.cxx:419

◆ CountModels()

void PMMLlib::PMMLlib::CountModels ( )
private

Count the tags of all types of models (NeuralNetwork and RegressionModel).

Returns
Number of models

Definition at line 341 of file PMMLlib.cxx.

342{
343 int nCount = 0;
345 if ( _log)
346 cout << " ** End Of Count Models nCount[" << nCount << "]" << endl;
347 _nbModels = nCount ;
348}
int _nbModels
Number of models (all kinds)
Definition: PMMLlib.hxx:81
int CountNeuralNetModels()
Definition: PMMLlib.cxx:354
int CountRegressionModels()
Definition: PMMLlib.cxx:375

◆ CountNeuralNetModels()

int PMMLlib::PMMLlib::CountNeuralNetModels ( )
private

Count NeuralNetwork models tags in the PMML file.

Returns
Number of models

Definition at line 354 of file PMMLlib.cxx.

355{
356 int nCount = 0;
357 xmlNodePtr ptr = GetChildByName(_rootNode,"NeuralNetwork");
358 // Count the models
359 while (ptr != NULL && _xmlCharToString(ptr->name) == "NeuralNetwork")
360 {
361 nCount++;
362 if (_log)
363 cout << " ** nCount[" << nCount << "]" << endl;
364 ptr = ptr->next;
365 }
366 if ( _log)
367 cout << " ** End Of CountNetworks nCount[" << nCount << "]" << endl;
368 return nCount;
369}
std::string _xmlCharToString(const xmlChar *xs) const
Definition: PMMLlib.cxx:669

◆ CountRegressionModels()

int PMMLlib::PMMLlib::CountRegressionModels ( )
private

Count RegressionModel models tags in the PMML file.

Returns
Number of models

Definition at line 375 of file PMMLlib.cxx.

376{
377 int nCount = 0;
378 xmlNodePtr ptr = GetChildByName(_rootNode,"RegressionModel");
379 // Count the models
380 while (ptr != NULL && _xmlCharToString(ptr->name) == "RegressionModel")
381 {
382 nCount++;
383 if (_log)
384 cout << " ** nCount[" << nCount << "]" << endl;
385 ptr = ptr->next;
386 }
387 if ( _log)
388 cout << " ** End Of CountRegressions nCount[" << nCount << "]" << endl;
389 return nCount;
390}

◆ GetChildByName()

xmlNodePtr PMMLlib::PMMLlib::GetChildByName ( xmlNodePtr  node,
std::string  nodeName 
)
private

Get the child of a node from the name of this node

Parameters
nodeStart node for the research
nodeNameName of the node to find
Returns
Pointer to the node found

Definition at line 310 of file PMMLlib.cxx.

312{
313 if ( node == NULL )
314 return node;
315
316 xmlNodePtr childNode = node->children;
317 if ( childNode == NULL )
318 return childNode;
319
320 const xmlChar* name = childNode->name;
321 string strName("");
322 if ( name != NULL )
323 strName = _xmlCharToString(name);
324
325 while( (childNode != NULL) && (strName != nodeName) )
326 {
327 childNode = childNode->next;
328 if ( childNode == NULL )
329 return childNode;
330 name = childNode->name;
331 if ( name != NULL )
332 strName = _xmlCharToString(name);
333 }
334 return childNode;
335}

◆ GetCurrentModelName()

std::string PMMLlib::PMMLlib::GetCurrentModelName ( )

name is "" if no model is set

Get the current model name.

Returns
the type

Definition at line 514 of file PMMLlib.cxx.

515{
516 if ( ! _currentModelNode )
517 return string("");
518 string name = _getProp(_currentModelNode, string("modelName"));
519 return name;
520}
std::string _getProp(const xmlNodePtr node, std::string const &prop) const
Definition: PMMLlib.cxx:694

◆ GetCurrentModelType()

PMMLType PMMLlib::PMMLlib::GetCurrentModelType ( )

type is kUNDEFINED if no model is set or if model type is not handled

Get the current model type.

Returns
the type

Definition at line 496 of file PMMLlib.cxx.

497{
498 PMMLType type = kUNDEFINED ;
499 if ( ! _currentModelNode )
500 return type;
501 string name = _xmlCharToString(_currentModelNode->name);
502 if ( name == "NeuralNetwork" )
503 type = kANN;
504 else if ( name == "RegressionModel" )
505 type = kLR;
506 return type;
507}
@ kANN
Definition: PMMLlib.hxx:54
@ kUNDEFINED
Definition: PMMLlib.hxx:54

References PMMLlib::kANN, PMMLlib::kLR, and PMMLlib::kUNDEFINED.

◆ GetModelName()

std::string PMMLlib::PMMLlib::GetModelName ( xmlNodePtr  node)
private

Get the name of the XML node of a given model

Parameters
nodeModel node
Returns
value of attribute "modelName" of the model node

Definition at line 406 of file PMMLlib.cxx.

407{
408 string name("");
409 name = _getProp(node, string("modelName") );
410 return name;
411}

◆ GetModelsNb()

int PMMLlib::PMMLlib::GetModelsNb ( )

Get the number of models

Returns
Number of models

Definition at line 396 of file PMMLlib.cxx.

397{
398 return _nbModels;
399}

◆ GetPtr() [1/2]

xmlNodePtr PMMLlib::PMMLlib::GetPtr ( int  index,
std::string  name 
)
private

Get a pointer to the index-th node named name

Parameters
indexIndex of the node to search
nameName of the node
Returns
Pointer to the node found

Definition at line 419 of file PMMLlib.cxx.

421{
422 xmlNodePtr node = NULL;
423
424 if (_doc != NULL)
425 {
426 _rootNode = xmlDocGetRootElement(_doc);
427 node = GetChildByName(_rootNode, name);
428
429 int i=0;
430 while ((i != index) && (node != NULL))
431 {
432 node = node->next;
433 i++;
434 }
435 }
436 return node;
437}
xmlDocPtr _doc
Associated DOM documents.
Definition: PMMLlib.hxx:78

References yacsorb.CORBAEngineTest::i.

◆ GetPtr() [2/2]

xmlNodePtr PMMLlib::PMMLlib::GetPtr ( std::string  myModelName,
std::string  nodeName 
)
private

Get a pointer to the node named name whose 'modelName' attribute is ann_name

Parameters
modelNameModel name of the node to search
nodeNameName of the node
Returns
Pointer to the node found

Definition at line 445 of file PMMLlib.cxx.

447{
448 xmlNodePtr node = NULL;
449 if (_doc != NULL)
450 {
451 node = GetChildByName(_rootNode, nodeName);
452 if( node )
453 {
454 string modelName = _getProp(node, string("modelName"));
455
456 while ( (node != NULL) && modelName != myModelName )
457 {
458 node = node->next;
459 if( node )
460 {
461 modelName = _getProp(node, string("modelName"));
462 }
463 }
464 }
465 }
466 return node;
467}

◆ GetTypeString()

std::string PMMLlib::PMMLlib::GetTypeString ( )
private

Get the tag of the current model.

Returns
Current model tag

Definition at line 473 of file PMMLlib.cxx.

474{
475 string name = "";
476 switch(_currentModelType)
477 {
478 case kANN:
479 name = "NeuralNetwork";
480 break;
481 case kLR:
482 name = "RegressionModel";
483 break;
484 default:
485 throw string("Unknown PMML type.");
486 break;
487 }
488 return name;
489}
PMMLType _currentModelType
Type of the current model.
Definition: PMMLlib.hxx:83

References PMMLlib::kANN, and PMMLlib::kLR.

◆ makeLog()

std::string PMMLlib::PMMLlib::makeLog ( ) const

Make the string used by PMMLlib::printLog.

Returns
The log

Definition at line 213 of file PMMLlib.cxx.

214{
215 ostringstream out;
216 out << "**\n**** Display of PMMLlib ****" << endl;
217 out << " ** _pmmlFile[" << _pmmlFile << "]" << endl;
218 out << " ** _log[" << (_log?1:0) << "]" << endl;
219 out << "**\n**** End of display of PMMLlib ****" << endl;
220 return out.str();
221}
std::string _pmmlFile
Name of the associated PMML file.
Definition: PMMLlib.hxx:77

◆ PMMLlib() [1/2]

PMMLlib::PMMLlib::PMMLlib ( bool  log = false)

This constructor is mandatory for Swig because it can be used with no parameters.

Constructor to create a PMML file.

Parameters
logFlag to print logs or not

Definition at line 94 of file PMMLlib.cxx.

94 :
95 _log(log),
96 _pmmlFile(""),
97 _doc(NULL),
98 _rootNode(NULL),
99 _currentNode(NULL),
100 _nbModels(0),
103{
104 SetRootNode();
105}
xmlNodePtr _currentNode
Pointer to the current node
Definition: PMMLlib.hxx:80
void SetRootNode()
Definition: PMMLlib.cxx:238
string log
Definition: logview.py:23

◆ PMMLlib() [2/2]

PMMLlib::PMMLlib::PMMLlib ( std::string  file,
bool  log = false 
)

Constructor to read a PMML file.

Parameters
fileName of the PMML file to read
logFlag to print logs or not

Definition at line 57 of file PMMLlib.cxx.

57 :
58 _log(log),
59 _pmmlFile(file),
60 _doc(NULL),
61 _rootNode(NULL),
62 _currentNode(NULL),
63 _nbModels(0),
66{
67 try
68 {
69 xmlKeepBlanksDefault(0);
70 xmlInitParser();
71 _doc = xmlParseFile(_pmmlFile.c_str());
72 if ( _doc != NULL )
73 {
74 _rootNode = xmlDocGetRootElement(_doc);
75 CountModels();
76 }
77 else
78 throw string("Unable to read PMML file.");
79 }
80 catch ( std::string msg )
81 {
82 std::cerr << msg;
83 xmlFreeDoc(_doc);
84 xmlCleanupParser();
85 throw;
86 }
87}
void CountModels()
Definition: PMMLlib.cxx:341

◆ printLog()

void PMMLlib::PMMLlib::printLog ( ) const

Print some information about the current PMML object.

Definition at line 226 of file PMMLlib.cxx.

227{
228 string log = makeLog();
229 cout << log << endl;
230}
PMMLLIB_EXPORT std::string makeLog() const
Definition: PMMLlib.cxx:213

References gui.logview::log.

◆ SetCurrentModel() [1/3]

void PMMLlib::PMMLlib::SetCurrentModel ( )

Throw an exception if no model is found or if there are more than one model in the PMLL file.

Set the current model and its type.

Definition at line 183 of file PMMLlib.cxx.

184{
185 int nC = _nbModels;
186 if ( nC != 1 )
187 {
188 std::ostringstream oss;
189 oss << nC;
190 string msg = "SetCurrentModel() : found " + oss.str() + " model(s) in PMML file.\n";
191 msg += "Use SetCurrentModel(modelName) or SetCurrentModel(modelName,type).";
192 throw msg;
193 }
194 _currentModelNode = GetChildByName(_rootNode,"NeuralNetwork");
196 if (_currentModelNode == NULL)
197 {
198 _currentModelNode = GetChildByName(_rootNode,"RegressionModel");
200 }
201 if (_currentModelNode == NULL)
202 {
203 string msg("Couldn't get node in SetCurrentModel().");
204 throw msg;
205 }
206 _currentModelName = _getProp(_currentModelNode, string("modelName"));
207}

References PMMLlib::kANN, and PMMLlib::kLR.

◆ SetCurrentModel() [2/3]

void PMMLlib::PMMLlib::SetCurrentModel ( std::string  modelName)

Throw an exception if there is no model or more than one model with name "modelName" in the PMML file.

Set the current model and its type.

Parameters
modelNameName of the model to load (ie content of 'modelName' attribute)

Definition at line 150 of file PMMLlib.cxx.

151{
152 if (_rootNode == NULL)
153 throw string("No PMML file set.");
154 xmlNodePtr node = NULL;
155 int nC = 0;
156 node = _rootNode->children;
157 while (node)
158 {
159 string nodeModelName = _getProp(node, string("modelName"));
160 if ( nodeModelName == modelName )
161 {
162 nC++;
163 _currentModelNode = node;
164 _currentModelName = modelName;
166 }
167 node = node->next;
168 }
169 if ( nC != 1 )
170 {
171 std::ostringstream oss;
172 oss << nC;
173 string msg = "SetCurrentModel(modelName) : found " + oss.str() + " model(s) in PMML file.\n";
174 msg += "Use SetCurrentModel(modelName,type).";
175 throw msg;
176 }
177}
PMMLLIB_EXPORT PMMLType GetCurrentModelType()
type is kUNDEFINED if no model is set or if model type is not handled
Definition: PMMLlib.cxx:496

◆ SetCurrentModel() [3/3]

void PMMLlib::PMMLlib::SetCurrentModel ( std::string  modelName,
PMMLType  type 
)

Set the current model and its type.

Parameters
modelNameName of the model to load (ie content of 'modelName' attribute)
typeType of PMML to read: one of kANN or kLR

Definition at line 124 of file PMMLlib.cxx.

126{
127 _currentModelName = modelName;
128 _currentModelType = type;
129 switch(type)
130 {
131 case kANN:
133 break;
134 case kLR:
136 break;
137 default:
138 throw string("Unknown PMML type.");
139 break;
140 }
141 if ( _currentModelNode == NULL )
142 throw string("Model not found.");
143}
xmlNodePtr GetNeuralNetPtr(std::string ann_name)
Definition: PMMLlib.cxx:749
xmlNodePtr GetRegressionPtr(int reg_index)

References PMMLlib::kANN, and PMMLlib::kLR.

◆ SetHeader()

void PMMLlib::PMMLlib::SetHeader ( std::string  copyright,
std::string  description,
std::string  appName,
std::string  appVersion,
std::string  annotation 
)

Set the header node in the tree.

Parameters
copyrightCopyright of the PMML file
descriptionDescription of the model
appNameName of the application that produced the file
appVersionVersion of the application that produced the file
annotationSome annotation

Definition at line 263 of file PMMLlib.cxx.

268{
269 xmlNodePtr headerNode = xmlNewChild(_rootNode, 0, (const xmlChar*)"Header", 0);
270 xmlNewProp(headerNode, (const xmlChar*)"copyright", (const xmlChar*)(copyright.c_str()));
271 xmlNewProp(headerNode, (const xmlChar*)"description", (const xmlChar*)(description.c_str()));
272
273 xmlNodePtr appNode = xmlNewChild(headerNode, 0, (const xmlChar*)"Application", 0);
274 xmlNewProp(appNode, (const xmlChar*)"name", (const xmlChar*)(appName.c_str()));
275 xmlNewProp(appNode, (const xmlChar*)"version", (const xmlChar*)(appVersion.c_str()));
276
277 xmlNewChild(headerNode, 0, (const xmlChar*)"Annotation", (const xmlChar*)(annotation.c_str()));
278}

◆ SetRootNode()

void PMMLlib::PMMLlib::SetRootNode ( )
private

Set the root node in the tree:

<PMML version="4.1" xmlns="http://www.dmg.org/PMML-4_1">

Definition at line 238 of file PMMLlib.cxx.

239{
240 xmlChar * xs = _stringToXmlChar("1.0");
241 _doc = xmlNewDoc(xs);
242 xmlFree(xs);
243
244 xmlChar *xp = _stringToXmlChar("PMML");
245 _rootNode = xmlNewNode(0, xp);
246 xmlFree(xp);
247
248 xmlNewProp(_rootNode, (const xmlChar*)"xmlns", (const xmlChar*)"http://www.dmg.org/PMML-4_1");
249 xmlNewProp(_rootNode, (const xmlChar*)"version", (const xmlChar*)"4.1");
250
251 xmlDocSetRootElement(_doc, _rootNode);
252}
xmlChar * _stringToXmlChar(const std::string &s) const
Definition: PMMLlib.cxx:683

◆ UnlinkNode()

void PMMLlib::PMMLlib::UnlinkNode ( )

Unlink the current model node.

Definition at line 525 of file PMMLlib.cxx.

526{
527 xmlNodePtr ptr = _currentModelNode ;
528 xmlUnlinkNode( ptr );
529 xmlFreeNode( ptr );
530}

◆ Write() [1/2]

void PMMLlib::PMMLlib::Write ( )

Save the XML tree in the PMML file

Definition at line 564 of file PMMLlib.cxx.

565{
566 // Enregistrement de l'arbre DOM dans le fichier pmml
568 // Mise à jour du nombre de modèles
569 CountModels();
570}
PMMLLIB_EXPORT void Write()
Definition: PMMLlib.cxx:564

◆ Write() [2/2]

void PMMLlib::PMMLlib::Write ( std::string  file)

Save the XML tree in a given file

Parameters
Nameof the file

Definition at line 576 of file PMMLlib.cxx.

577{
578 // Enregistrement de l'arbre DOM sous forme de fichier pmml
579 int ret = xmlSaveFormatFile( file.c_str(), _doc, 1);
580 if ( ret == -1 )
581 {
582 std::string msg(" *** Error :: unable to write the PMML file \"" + file + "\"") ;
583 cout << msg << endl;
584 throw msg;
585 }
586 if ( _log )
587 cout << " *** Write the PMML file \"" << file <<"\"" << endl;
588}

◆ ~PMMLlib()

PMMLlib::PMMLlib::~PMMLlib ( )

Destructor of the class.

Definition at line 110 of file PMMLlib.cxx.

111{
112 if (_doc)
113 xmlFreeDoc(_doc);
114 xmlCleanupParser();
115 if ( _log )
116 cout << "~PMMLlib" << endl;
117}