Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

PersistNode.h

Go to the documentation of this file.
00001 //                            Package   : omniIFR
00002 // PersistNode.h              Created   : 2004/04/29
00003 //                            Author    : Alex Tingle
00004 //
00005 //    Copyright (C) 2004 Alex Tingle.
00006 //
00007 //    This file is part of the omniIFR application.
00008 //
00009 //    omniIFR is free software; you can redistribute it and/or
00010 //    modify it under the terms of the GNU Lesser General Public
00011 //    License as published by the Free Software Foundation; either
00012 //    version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //    omniIFR is distributed in the hope that it will be useful,
00015 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //    Lesser General Public License for more details.
00018 //
00019 //    You should have received a copy of the GNU Lesser General Public
00020 //    License along with this library; if not, write to the Free Software
00021 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 
00024 #ifndef OMNIIFR__PERSIST_NODE_H
00025 #define OMNIIFR__PERSIST_NODE_H
00026 
00027 #ifdef HAVE_CONFIG_H
00028 #  include "config.h"
00029 #endif
00030 
00031 #include <omniORB4/CORBA.h>
00032 
00033 #include <string>
00034 #include <map>
00035 
00036 #ifdef HAVE_IOSTREAM
00037 #  include <iostream>
00038 #else
00039 #  include <iostream.h>
00040 #endif
00041 
00042 #ifdef HAVE_STD_IOSTREAM
00043 using namespace std;
00044 #endif
00045 
00046 namespace Omniifr {
00047 
00048 class PersistNode;
00049 
00050 class PersistNode
00051 {
00052 public:
00053   PersistNode(){}           
00054   PersistNode(istream& is); 
00055   ~PersistNode();           
00056   void   output(ostream& os,string name) const;
00057 
00058 public: // Construction
00059   inline bool  readnode(istream& is);
00060   inline bool  readtoken(istream& is, string& tok);
00061   PersistNode* addnode(const string& name);
00062   void         delnode(const string& name);
00063   void         addattr(const string& keyvalue);
00064   void         addattr(const string& key,long value);
00065 
00066 public: // Accessors
00067   bool  hasAttr(const string& key) const;
00068   string  attrString(const string& key, const string& fallback="") const;
00069   long  attrLong(const string& key, long fallback=0 ) const;
00070   cdrMemoryStream  attrCdrStream(const string& key) const;
00071   PersistNode*  child(const string& key) const;
00072 
00073 public: // Members
00074   static const char*       _separator; 
00075   map<string,PersistNode*> _child;
00076   map<string,string>       _attr;
00077 
00078 public:
00080   static void outputCdrMemoryStream(
00081     ostream& os, cdrMemoryStream& memstr, const char* prefix =NULL);
00083   static void outputIOR(
00084     ostream& os, CORBA::Object_ptr obj, const char* prefix =NULL);
00085 };
00086 
00087 } // end namespace Omniifr
00088 
00089 #endif // OMNIIFR__PERSIST_NODE_H

Generated on Fri Mar 4 13:03:23 2005 for OmniIFR by  doxygen 1.4.1