[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi/RTIG Federation.hh Federation.cc
From: |
CERTI CVS commits |
Subject: |
[certi-cvs] certi/RTIG Federation.hh Federation.cc |
Date: |
Mon, 16 Sep 2013 14:09:43 +0000 |
CVSROOT: /sources/certi
Module name: certi
Changes by: Eric NOULARD <erk> 13/09/16 14:09:43
Modified files:
RTIG : Federation.hh Federation.cc
Log message:
Calm down compiler warning and avoid using libxml inlcudes
in CERTI headers (using it in .cc is enough).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.hh?cvsroot=certi&r1=3.73&r2=3.74
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.148&r2=3.149
Patches:
Index: Federation.hh
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.hh,v
retrieving revision 3.73
retrieving revision 3.74
diff -u -b -r3.73 -r3.74
--- Federation.hh 31 Dec 2011 13:25:58 -0000 3.73
+++ Federation.hh 16 Sep 2013 14:09:43 -0000 3.74
@@ -18,7 +18,7 @@
// along with this program ; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// $Id: Federation.hh,v 3.73 2011/12/31 13:25:58 erk Exp $
+// $Id: Federation.hh,v 3.74 2013/09/16 14:09:43 erk Exp $
// ----------------------------------------------------------------------------
#ifndef _CERTI_RTIG_FEDERATION_HH
@@ -31,19 +31,12 @@
#include "SecurityServer.hh"
#include "HandleManager.hh"
#include "certi.hh"
-#include <stdlib.h>
+#include <cstdlib>
#ifdef FEDERATION_USES_MULTICAST
#include "SocketMC.hh"
#endif
-// Libraries
-#ifdef HAVE_XML
-#include <libxml/xmlmemory.h> // FIXME: should be in the .cc
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-#endif // HAVE_XML
-
namespace certi {
namespace rtig {
@@ -51,7 +44,7 @@
{
// ATTRIBUTES
--------------------------------------------------------------
private:
- Handle handle ;
+ Handle handle;
std::string name ;
std::string FEDid ;
@@ -74,7 +67,7 @@
#endif
bool saveXmlData();
- bool restoreXmlData();
+ bool restoreXmlData(std::string docFilename);
// METHODS
-----------------------------------------------------------------
public:
@@ -708,10 +701,6 @@
* The minimum NERx timestamp for this federation
*/
FederationTime minNERx;
-
-#ifdef HAVE_XML
- xmlDocPtr doc ; // FIXME: should not be an attribute
-#endif // HAVE_XML
/* The message buffer used to send Network messages */
MessageBuffer NM_msgBufSend;
};
@@ -720,4 +709,4 @@
#endif // _CERTI_RTIG_FEDERATION_HH
-// $Id: Federation.hh,v 3.73 2011/12/31 13:25:58 erk Exp $
+// $Id: Federation.hh,v 3.74 2013/09/16 14:09:43 erk Exp $
Index: Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.148
retrieving revision 3.149
diff -u -b -r3.148 -r3.149
--- Federation.cc 31 Dec 2011 13:25:59 -0000 3.148
+++ Federation.cc 16 Sep 2013 14:09:43 -0000 3.149
@@ -18,7 +18,7 @@
// along with this program ; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// $Id: Federation.cc,v 3.148 2011/12/31 13:25:59 erk Exp $
+// $Id: Federation.cc,v 3.149 2013/09/16 14:09:43 erk Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -55,6 +55,9 @@
// Definitions
#ifdef HAVE_XML
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
#define ROOT_NODE (const xmlChar*) "rtigSaveData"
#define NODE_FEDERATION (const xmlChar*) "federation"
#define NODE_FEDERATE (const xmlChar*) "federate"
@@ -1317,6 +1320,8 @@
}
// ----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
//! Informs that a federate is requesting a save.
void
Federation::requestFederationRestore(FederateHandle the_federate,
@@ -1339,17 +1344,7 @@
bool success = true ;
#ifdef HAVE_XML
string filename = name + "_" + the_label + ".xcs" ;
- doc = xmlParseFile(filename.c_str());
-
- // Did libXML manage to parse the file ?
- if (doc == 0) {
- cerr << "XML restore file not parsed successfully" << endl ;
- xmlFreeDoc(doc);
- success = false ;
- }
- if (success) {
- success = restoreXmlData();
- }
+ success = restoreXmlData(filename);
#else
success = false ;
#endif // HAVE_XML
@@ -2587,11 +2582,20 @@
// ----------------------------------------------------------------------------
bool
-Federation::restoreXmlData()
+Federation::restoreXmlData(std::string docFilename)
{
#ifndef HAVE_XML
return false ;
#else
+
+ xmlDocPtr doc = xmlParseFile(docFilename.c_str());
+
+ // Did libXML manage to parse the file ?
+ if (doc == 0) {
+ cerr << "XML restore file not parsed successfully" << endl ;
+ xmlFreeDoc(doc);
+ return false ;
+ }
xmlNodePtr cur ;
cur = xmlDocGetRootElement(doc);
@@ -2659,7 +2663,7 @@
#ifndef HAVE_XML
return false ;
#else
- doc = xmlNewDoc((const xmlChar *) "1.0");
+ xmlDocPtr doc = xmlNewDoc((const xmlChar *) "1.0");
doc->children = xmlNewDocNode(doc, NULL, ROOT_NODE, NULL);
xmlNodePtr federation ;
@@ -2794,5 +2798,5 @@
}} // namespace certi/rtig
-// $Id: Federation.cc,v 3.148 2011/12/31 13:25:59 erk Exp $
+// $Id: Federation.cc,v 3.149 2013/09/16 14:09:43 erk Exp $
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi/RTIG Federation.hh Federation.cc,
CERTI CVS commits <=