11 #include <xercesc/sax2/SAX2XMLReader.hpp>
12 #include <xercesc/sax2/XMLReaderFactory.hpp>
13 #include <xercesc/util/PlatformUtils.hpp>
22 using namespace xercesc;
27 if(ch == 0)
return "";
29 AnsiString astr(wstr);
32 if(ch == 0)
return "";
36 char* buf = XMLString::transcode(ch);
44 TPatternsVecsMap::const_iterator patVecIt = m_PatternsVecsMap.find(coneCrds);
45 if(patVecIt == m_PatternsVecsMap.end()){
49 throw RPCException( std::string(
"no such a cone in m_PatternsVecsMap: ")+ ss.str() );
52 return patVecIt->second;
59 return getPatternsVec(cords);
74 XStr(
const char*
const toTranscode)
77 m_fUnicodeForm = XMLString::transcode(toTranscode);
91 return m_fUnicodeForm;
104 #define Char2XMLCh(str) XStr(str).unicodeForm()
110 if(m_InstanceCount == 0) {
112 XMLPlatformUtils::Initialize();
116 catch(
const XMLException &toCatch) {
117 throw RPCException(
"Error during Xerces-c Initialization: "
133 fin.open(fileName.c_str());
140 SAX2XMLReader*
parser = XMLReaderFactory::createXMLReader();
141 parser->setContentHandler(
this);
143 m_QualityVec.clear();
144 parser->parse(fileName.c_str());
149 const XMLCh*
const localname,
150 const XMLCh*
const qname,
151 const Attributes& attrs) {
155 if(m_CurrElement ==
"quality") {
162 unsigned long fpUL = firedPl.to_ulong();
167 m_QualityVec.push_back(quality);
169 else if(m_CurrElement ==
"pac") {
177 if(res.second ==
true)
178 m_CurPacIt = res.first;
180 throw RPCException( std::string(
"m_PatternsVecsMap insertion failed - cone already exixsts?"));
183 else if(m_CurrElement ==
"pat") {
201 else if(m_CurrElement ==
"str") {
211 if(element ==
"pat") {
212 m_CurPacIt->second.push_back(m_CurPattern);
string xMLCh2String(const XMLCh *ch)
The coordinates of Logic Cone: m_Tower, m_LogSector, m_LogSegment.
const XMLCh * unicodeForm() const
static const TPatternType PAT_TYPE_T
unsigned char m_FiredPlanes
std::vector< RPCPattern > RPCPatVec
void endElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
void startElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs)
XStr(const char *const toTranscode)
const RPCPattern::RPCPatVec & getPatternsVec(const RPCConst::l1RpcConeCrdnts &coneCrds) const
Container::value_type value_type
static int m_InstanceCount
static const TPatternType PAT_TYPE_E
void parse(std::string fileName)
int stringToInt(std::string str)
Converts string to inteager number. If string contains chars, that are not digits, throws RPCException.