summaryrefslogtreecommitdiffstats
path: root/src/uscxml/transform
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2016-05-19 08:03:50 (GMT)
committerStefan Radomski <github@mintwerk.de>2016-05-19 08:03:50 (GMT)
commit5de792adc6796b0f03d62124765b4af0676dde46 (patch)
treee700d6b008b21c037aebcc1882fd9286920b2987 /src/uscxml/transform
parentf8e0c96fddfdd5f086e1bd973d6b0a19c39c93da (diff)
downloaduscxml-5de792adc6796b0f03d62124765b4af0676dde46.zip
uscxml-5de792adc6796b0f03d62124765b4af0676dde46.tar.gz
uscxml-5de792adc6796b0f03d62124765b4af0676dde46.tar.bz2
Refactored for public headers and started documentation
Diffstat (limited to 'src/uscxml/transform')
-rw-r--r--src/uscxml/transform/ChartToC.cpp40
-rw-r--r--src/uscxml/transform/ChartToC.h8
-rw-r--r--src/uscxml/transform/ChartToVHDL.h6
-rw-r--r--src/uscxml/transform/Transformer.h11
4 files changed, 33 insertions, 32 deletions
diff --git a/src/uscxml/transform/ChartToC.cpp b/src/uscxml/transform/ChartToC.cpp
index 4891bfe..d7537ea 100644
--- a/src/uscxml/transform/ChartToC.cpp
+++ b/src/uscxml/transform/ChartToC.cpp
@@ -33,7 +33,7 @@
namespace uscxml {
-using namespace xercesc;
+using namespace XERCESC_NS;
// many more tricks: https://graphics.stanford.edu/~seander/bithacks.html
@@ -41,7 +41,7 @@ using namespace xercesc;
Transformer ChartToC::transform(const Interpreter& other) {
ChartToC* c2c = new ChartToC(other);
- return boost::shared_ptr<TransformerImpl>(c2c);
+ return std::shared_ptr<TransformerImpl>(c2c);
}
ChartToC::ChartToC(const Interpreter& other) : TransformerImpl(other), _topMostMachine(NULL), _parentMachine(NULL) {
@@ -69,7 +69,7 @@ ChartToC::ChartToC(const Interpreter& other) : TransformerImpl(other), _topMostM
void ChartToC::setHistoryCompletion() {
- std::list<DOMElement*> histories = DOMUtils::inPostFixOrder({ XML_PREFIX(_scxml).str() + "history" }, _scxml);
+ std::list<DOMElement*> histories = DOMUtils::inPostFixOrder({ XML_PREFIX(_scxml).str() + "history" }, _scxml);
std::list<DOMElement*> covered;
std::list<DOMElement*> perParentcovered;
@@ -245,14 +245,14 @@ void ChartToC::prepare() {
// make sure initial and history elements always precede propoer states
resortStates(_scxml);
- std::list<xercesc::DOMElement*> tmp = DOMUtils::inDocumentOrder({
- XML_PREFIX(_scxml).str() + "scxml",
- XML_PREFIX(_scxml).str() + "state",
- XML_PREFIX(_scxml).str() + "final",
- XML_PREFIX(_scxml).str() + "history",
- XML_PREFIX(_scxml).str() + "initial",
- XML_PREFIX(_scxml).str() + "parallel"
- }, _scxml);
+ std::list<XERCESC_NS::DOMElement*> tmp = DOMUtils::inDocumentOrder({
+ XML_PREFIX(_scxml).str() + "scxml",
+ XML_PREFIX(_scxml).str() + "state",
+ XML_PREFIX(_scxml).str() + "final",
+ XML_PREFIX(_scxml).str() + "history",
+ XML_PREFIX(_scxml).str() + "initial",
+ XML_PREFIX(_scxml).str() + "parallel"
+ }, _scxml);
_states.insert(_states.end(), tmp.begin(), tmp.end());
// set states' document order and parent attribute
@@ -297,7 +297,7 @@ void ChartToC::prepare() {
// set transitions' document order and source attribute
- tmp = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "transition" }, _scxml);
+ tmp = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "transition" }, _scxml);
size_t index = 0;
for (auto transIter = tmp.begin(); transIter != tmp.end(); transIter++, index++) {
DOMElement* transition = *transIter;
@@ -1027,7 +1027,7 @@ void ChartToC::writeHelpers(std::ostream& stream) {
void ChartToC::writeExecContentFinalize(std::ostream& stream) {
// needs to be written prior to invocation elem info
- std::list<DOMElement*> finalizes = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "finalize" }, _scxml);
+ std::list<DOMElement*> finalizes = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "finalize" }, _scxml);
if (finalizes.size() > 0) {
stream << "#ifndef USCXML_NO_EXEC_CONTENT" << std::endl;
@@ -1497,7 +1497,7 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
stream << "#ifndef USCXML_NO_ELEM_INFO" << std::endl;
stream << std::endl;
- std::list<DOMElement*> foreachs = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "foreach" }, _scxml);
+ std::list<DOMElement*> foreachs = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "foreach" }, _scxml);
if (foreachs.size() > 0) {
_hasElement.insert("foreach");
stream << "static const uscxml_elem_foreach " << _prefix << "_elem_foreachs[" << foreachs.size() << "] = {" << std::endl;
@@ -1516,7 +1516,7 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
stream << std::endl;
}
- std::list<DOMElement*> assigns = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "assign" }, _scxml);
+ std::list<DOMElement*> assigns = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "assign" }, _scxml);
if (assigns.size() > 0) {
_hasElement.insert("assign");
stream << "static const uscxml_elem_assign " << _prefix << "_elem_assigns[" << assigns.size() << "] = {" << std::endl;
@@ -1549,7 +1549,7 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
}
- std::list<DOMElement*> datas = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "data" }, _scxml);
+ std::list<DOMElement*> datas = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "data" }, _scxml);
if (datas.size() > 0) {
_hasElement.insert("data");
size_t dataIndexOffset = 0;
@@ -1607,7 +1607,7 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
stream << std::endl;
}
- std::list<DOMElement*> params = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "param" }, _scxml);
+ std::list<DOMElement*> params = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "param" }, _scxml);
if (params.size() > 0) {
_hasElement.insert("param");
DOMNode* parent = NULL;
@@ -1644,7 +1644,7 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
stream << std::endl;
}
- std::list<DOMElement*> sends = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "send" }, _scxml);
+ std::list<DOMElement*> sends = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "send" }, _scxml);
if (sends.size() > 0) {
_hasElement.insert("send");
stream << "static const uscxml_elem_send " << _prefix << "_elem_sends[" << sends.size() << "] = {" << std::endl;
@@ -1708,7 +1708,7 @@ void ChartToC::writeElementInfo(std::ostream& stream) {
stream << std::endl;
}
- std::list<DOMElement*> donedatas = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "donedata" }, _scxml);
+ std::list<DOMElement*> donedatas = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "donedata" }, _scxml);
stream << "static const uscxml_elem_donedata " << _prefix << "_elem_donedatas[" << donedatas.size() + 1 << "] = {" << std::endl;
stream << " /* source, content, contentexpr, params */" << std::endl;
size_t i = 0;
@@ -1970,7 +1970,7 @@ void ChartToC::writeTransitions(std::ostream& stream) {
stream << std::endl;
// cross reference transition by document order - is this really needed?!
- std::list<DOMElement*> transDocOrder = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "transition" }, _scxml);
+ std::list<DOMElement*> transDocOrder = DOMUtils::inDocumentOrder({ XML_PREFIX(_scxml).str() + "transition" }, _scxml);
if (_transitions.size() > 0) {
stream << "static const uscxml_transition " << _prefix << "_transitions[" << toStr(_transitions.size()) << "] = {" << std::endl;
diff --git a/src/uscxml/transform/ChartToC.h b/src/uscxml/transform/ChartToC.h
index a34a2e0..43ffc45 100644
--- a/src/uscxml/transform/ChartToC.h
+++ b/src/uscxml/transform/ChartToC.h
@@ -58,9 +58,9 @@ protected:
void writeFSM(std::ostream& stream);
void writeCharArrayInitList(std::ostream& stream, const std::string& boolString);
- void writeExecContent(std::ostream& stream, const xercesc::DOMNode* node, int indent = 0);
+ void writeExecContent(std::ostream& stream, const XERCESC_NS::DOMNode* node, int indent = 0);
- void resortStates(xercesc::DOMNode* node);
+ void resortStates(XERCESC_NS::DOMNode* node);
void setHistoryCompletion();
void setStateCompletion();
void prepare();
@@ -69,8 +69,8 @@ protected:
Interpreter interpreter;
- std::vector<xercesc::DOMElement*> _states;
- std::vector<xercesc::DOMElement*> _transitions;
+ std::vector<XERCESC_NS::DOMElement*> _states;
+ std::vector<XERCESC_NS::DOMElement*> _transitions;
std::string _md5;
std::string _prefix;
diff --git a/src/uscxml/transform/ChartToVHDL.h b/src/uscxml/transform/ChartToVHDL.h
index 3d8b00d..89af6fd 100644
--- a/src/uscxml/transform/ChartToVHDL.h
+++ b/src/uscxml/transform/ChartToVHDL.h
@@ -191,15 +191,15 @@ protected:
// event generation
void writeExContentBlock(std::ostream & stream, std::string index,
- std::list<xercesc::DOMElement*> commandSequence);
+ std::list<XERCESC_NS::DOMElement*> commandSequence);
Trie _eventTrie;
- std::list<xercesc::DOMElement*> _execContent;
+ std::list<XERCESC_NS::DOMElement*> _execContent;
private:
std::string eventNameEscape(const std::string& eventName);
- std::string getLineForExecContent(const xercesc::DOMElement* elem);
+ std::string getLineForExecContent(const XERCESC_NS::DOMElement* elem);
};
diff --git a/src/uscxml/transform/Transformer.h b/src/uscxml/transform/Transformer.h
index a490533..fcfda01 100644
--- a/src/uscxml/transform/Transformer.h
+++ b/src/uscxml/transform/Transformer.h
@@ -23,6 +23,7 @@
#include <iostream>
#include <map>
#include "uscxml/Interpreter.h"
+#include "uscxml/interpreter/InterpreterImpl.h"
namespace uscxml {
@@ -47,8 +48,8 @@ protected:
std::multimap<std::string, std::string> _extensions;
std::list<std::string> _options;
- xercesc::DOMDocument* _document;
- xercesc::DOMElement* _scxml;
+ XERCESC_NS::DOMDocument* _document;
+ XERCESC_NS::DOMElement* _scxml;
Interpreter interpreter;
InterpreterImpl::Binding _binding;
@@ -63,7 +64,7 @@ public:
// Transformer(const Interpreter& source) { _impl = new (source) }
Transformer() : _impl() {} // the empty, invalid interpreter
- Transformer(boost::shared_ptr<TransformerImpl> const impl) : _impl(impl) { }
+ Transformer(std::shared_ptr<TransformerImpl> const impl) : _impl(impl) { }
Transformer(const Transformer& other) : _impl(other._impl) { }
virtual ~Transformer() {};
@@ -91,7 +92,7 @@ public:
return _impl->operator Interpreter();
}
- boost::shared_ptr<TransformerImpl> getImpl() {
+ std::shared_ptr<TransformerImpl> getImpl() {
return _impl;
}
@@ -104,7 +105,7 @@ public:
}
protected:
- boost::shared_ptr<TransformerImpl> _impl;
+ std::shared_ptr<TransformerImpl> _impl;
};