XML_Saver.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    XML_Saver.h
00006  *
00007  *  XML_Saver.h,v 1.6 2006/03/14 06:14:34 jtc Exp
00008  *
00009  *  @author Jonathan Pollack <pollack_j@ociweb.com>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef XML_SAVER_H
00014 #define XML_SAVER_H
00015 #include /**/ "ace/pre.h"
00016 
00017 #include "orbsvcs/Notify/Topology_Saver.h"
00018 
00019 #include "ace/streams.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 #pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00026 
00027 namespace TAO_Notify
00028 {
00029 
00030 /**
00031  * \brief Save Notification Service Topology to an XML file.
00032  */
00033 class XML_Saver : public Topology_Saver
00034 {
00035 public:
00036   /// Construct an XML_Saver.
00037   /// Initialization is deferred to "open()"
00038   XML_Saver (bool timestamp = true);
00039 
00040   virtual ~XML_Saver ();
00041 
00042   /// Open the output file.
00043   /// \param file_name the fully qualified file name
00044   /// \return true if successful
00045   bool open (const ACE_CString & file_name, size_t backup_count);
00046 
00047   //////////////////////////////////
00048   // Override Topology_Saver methods
00049   // see Topology_Saver.h for doc
00050   virtual bool begin_object (CORBA::Long id,
00051     const ACE_CString& type,
00052     const NVPList& attrs,
00053     bool changed
00054     ACE_ENV_ARG_DECL);
00055 
00056   virtual void end_object (CORBA::Long id,
00057     const ACE_CString& type
00058     ACE_ENV_ARG_DECL);
00059 
00060   virtual void close (ACE_ENV_SINGLE_ARG_DECL);
00061 
00062 private:
00063   void backup_file_name (char * file_path, int nfile);
00064 
00065 private:
00066   /// A stream representing our current output.
00067   FILE * output_;
00068   bool close_out_;
00069 
00070   /// the name of the output file
00071   ACE_CString base_name_;
00072   size_t backup_count_;
00073 
00074   /// true to enable timestamping
00075   bool timestamp_;
00076 
00077   /// A string consisting of spaces that is our current indentation level.
00078   ACE_CString indent_;
00079 
00080 };
00081 
00082 } // namespace TAO_Notify
00083 
00084 TAO_END_VERSIONED_NAMESPACE_DECL
00085 
00086 #include /**/ "ace/post.h"
00087 #endif /* XML_SAVER_H */

Generated on Thu Nov 9 13:24:17 2006 for TAO_CosNotification by doxygen 1.3.6