• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

bulkDataNTConfigurationParser.h

Go to the documentation of this file.
00001 #ifndef _BULKDATA_NT_CONFIGURATION_PARSER_H_
00002 #define _BULKDATA_NT_CONFIGURATION_PARSER_H_
00003 
00004 /*******************************************************************************
00005 * ALMA - Atacama Large Millimiter Array
00006 * (c) European Southern Observatory, 2011
00007 *
00008 * This library is free software; you can redistribute it and/or
00009 * modify it under the terms of the GNU Lesser General Public
00010 * License as published by the Free Software Foundation; either
00011 * version 2.1 of the License, or (at your option) any later version.
00012 *
00013 * This library is distributed in the hope that it will be useful,
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 * Lesser General Public License for more details.
00017 *
00018 * You should have received a copy of the GNU Lesser General Public
00019 * License along with this library; if not, write to the Free Software
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00021 *
00022 * "@(#) $Id: bulkDataNTConfigurationParser.h,v 1.7 2011/11/10 11:10:33 rtobar Exp $"
00023 *
00024 * who       when      what
00025 * --------  --------  ----------------------------------------------
00026 * bjeram  2011-04-19  created
00027 */
00028 
00029 #ifndef __cplusplus
00030 #error This is a C++ include file and cannot be used from plain C
00031 #endif
00032 
00033 #include <map>
00034 #include <string>
00035 #include <set>
00036 
00037 #include <xercesc/dom/DOMNode.hpp>
00038 #include <xercesc/dom/DOMWriter.hpp>
00039 #include <xercesc/parsers/AbstractDOMParser.hpp>
00040 
00041 #include "bulkDataNTSenderStream.h"
00042 #include "bulkDataNTReceiverStream.h"
00043 
00044 namespace AcsBulkdata
00045 {
00046 
00047         class BulkDataConfigurationParser {
00048 
00049         public:
00050 
00051                 typedef struct {
00052                         SenderStreamConfiguration streamCfg;
00053                         std::map<std::string, SenderFlowConfiguration> flowsCfgMap;
00054                 } SenderCfg;
00055 
00056                 typedef struct {
00057                         ReceiverStreamConfiguration streamCfg;
00058                         std::map<std::string, ReceiverFlowConfiguration> flowsCfgMap;
00059                 } ReceiverCfg;
00060 
00064                 BulkDataConfigurationParser();
00065 
00069                 ~BulkDataConfigurationParser();
00070 
00076                 void parseSenderConfig(char const *configXML, std::map<std::string, SenderCfg> &configMap);
00077 
00083                 void parseReceiverConfig(char const *configXML, std::map<std::string, ReceiverCfg> &configMap);
00084 
00085         private:
00086 
00087                 char* getAttrValue(xercesc::DOMNode *node, const char * name);
00088 
00089                 void getSerializedElement(xercesc::DOMNode *node, std::string &s);
00090 
00091                 void addQoSToProfile(const char *stream, const char *profileName, const char* baseProfile, xercesc::DOMNode *node);
00092 
00093                 void parseConfig(const char *config,
00094                         const char* const reqStreamNodeName,
00095                         const char* const reqFlowNodeName,
00096                         const char* const reqStreamQoSNodeName,
00097                         const char* const reqFlowQoSNodeName,
00098                         const char* const defaultStreamProfile,
00099                         const char* const defaultFlowProfile);
00100 
00101                 template<class CfgS, class StreamConfigT, class FlowConfigT>
00102                 void populateConfiguration(std::map<std::string, CfgS> &configMap);
00103 
00104                 void clearCollections();
00105 
00106                 void printEntities();
00107 
00108                 std::string getStrURIforStream(char *streamName);
00109 
00110                 // map<streamName, map<flowName, strURLPiece>>
00111                 std::map<std::string, std::map<std::string, std::string> > m_profiles;
00112                 std::map<char *, std::set<char*> > m_entities;
00113                 xercesc::DOMWriter *m_writer;
00114                 xercesc::AbstractDOMParser *m_parser;
00115 
00116                 static const char* const SENDER_STREAM_NODENAME;
00117                 static const char* const SENDER_STREAM_QOS_NODENAME;
00118                 static const char* const SENDER_FLOW_NODENAME;
00119                 static const char* const SENDER_FLOW_QOS_NODENAME;
00120                 static const char* const RECEIVER_STREAM_NODENAME;
00121                 static const char* const RECEIVER_STREAM_QOS_NODENAME;
00122                 static const char* const RECEIVER_FLOW_NODENAME;
00123                 static const char* const RECEIVER_FLOW_QOS_NODENAME;
00124 
00125                 static const char* const DYNAMIC_LIBRARY_NAME;
00126         };
00127 
00128 };
00129 
00130 #include "bulkDataNTConfigurationParser.i"
00131 
00132 #endif

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0