00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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:
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:
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:
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 }
00088
00089 #endif // OMNIIFR__PERSIST_NODE_H