diff --git a/include/core/dcp/helper/DcpSlaveDescriptionHelper.hpp b/include/core/dcp/helper/DcpSlaveDescriptionHelper.hpp index 751c717..3420d69 100644 --- a/include/core/dcp/helper/DcpSlaveDescriptionHelper.hpp +++ b/include/core/dcp/helper/DcpSlaveDescriptionHelper.hpp @@ -311,6 +311,7 @@ namespace slavedescription { case DcpTransportProtocol::TCP_IPv4: return slaveDescription.TransportProtocols.TCP_IPv4.get() != nullptr; } + throw std::runtime_error(std::string("Invalid DcpTransportProtocol encountered: ") + std::to_string(static_cast(transportProtocol))); } diff --git a/include/core/dcp/model/LogEntry.hpp b/include/core/dcp/model/LogEntry.hpp index da37880..f908cf4 100644 --- a/include/core/dcp/model/LogEntry.hpp +++ b/include/core/dcp/model/LogEntry.hpp @@ -132,11 +132,14 @@ class LogEntry { offset += 1; break; } +#if defined(DEBUG) || defined(LOGGING) case DcpDataType::pduType: { value = to_string(*((DcpPduType*)(payload + offset))); offset += 1; break; } +#endif //defined(DEBUG) || defined(LOGGING) + case DcpDataType::dataType: { value = to_string(*((DcpDataType*)(payload + offset))); offset += 1; diff --git a/include/core/dcp/model/pdu/IpToStr.hpp b/include/core/dcp/model/pdu/IpToStr.hpp index 81e58fa..e409d53 100644 --- a/include/core/dcp/model/pdu/IpToStr.hpp +++ b/include/core/dcp/model/pdu/IpToStr.hpp @@ -1,9 +1,11 @@ #ifndef DCPLIB_IPTOSTR #define DCPLIB_IPTOSTR +#if defined(DEBUG) || defined(LOGGING) #include std::string ipToString(const uint32_t ip) { return std::to_string(ip >> 24 & 0xFF) + "." + std::to_string(ip >> 16 & 0xFF) + "." + std::to_string(ip >> 8 & 0xFF) + "." + std::to_string(ip & 0xFF); } +#endif // defined(DEBUG) || defined(LOGGING) #endif //DCPLIB_IPTOSTR \ No newline at end of file diff --git a/include/core/dcp/xml/DcpSlaveDescriptionElements.hpp b/include/core/dcp/xml/DcpSlaveDescriptionElements.hpp index d23424d..5c5d2ff 100644 --- a/include/core/dcp/xml/DcpSlaveDescriptionElements.hpp +++ b/include/core/dcp/xml/DcpSlaveDescriptionElements.hpp @@ -237,6 +237,7 @@ static std::string to_string(Direction dir){ case Direction::USB_DIR_OUT: return "Out"; } + throw std::runtime_error(std::string("Invalid Direction encountered: ") + std::to_string(static_cast(dir))); } struct DataPipe_t { @@ -410,6 +411,7 @@ static std::string to_string(DimensionType dim){ case DimensionType::LINKED_VR: return "LINKED_VR"; } + throw std::runtime_error(std::string("Invalid DimensionType encountered: ") + std::to_string(static_cast(dim))); } struct Dimension_t { DimensionType type; @@ -431,6 +433,7 @@ static std::string to_string(DependencyKind kind){ case DependencyKind::LINEAR: return "linear"; } + throw std::runtime_error(std::string("Invalid DependencyKind encountered: ") + std::to_string(static_cast(kind))); } struct Dependency_t { @@ -901,6 +904,7 @@ static std::string to_string(Variability variability){ case Variability::CONTINUOUS: return "continuous"; } + throw std::runtime_error(std::string("Invalid Variability encountered: ") + std::to_string(static_cast(variability))); } struct Variable_t { @@ -993,6 +997,7 @@ static std::string to_string(VariableNamingConvention variableNamingConvention){ case VariableNamingConvention::STRUCTURED: return "structured"; } + throw std::runtime_error(std::string("Invalid VariableNamingConvention encountered: ") + std::to_string(static_cast(variableNamingConvention))); } struct SlaveDescription_t { diff --git a/include/ethernet/dcp/driver/ethernet/tcp/TcpDriver.hpp b/include/ethernet/dcp/driver/ethernet/tcp/TcpDriver.hpp index ebcadd1..6fb5b21 100644 --- a/include/ethernet/dcp/driver/ethernet/tcp/TcpDriver.hpp +++ b/include/ethernet/dcp/driver/ethernet/tcp/TcpDriver.hpp @@ -10,7 +10,9 @@ #ifndef DCPLIB_TCP_DRIVER_H #define DCPLIB_TCP_DRIVER_H +#ifndef ASIO_STANDALONE #define ASIO_STANDALONE +#endif #include diff --git a/include/ethernet/dcp/driver/ethernet/udp/UdpDriver.hpp b/include/ethernet/dcp/driver/ethernet/udp/UdpDriver.hpp index 9526152..f8abd07 100644 --- a/include/ethernet/dcp/driver/ethernet/udp/UdpDriver.hpp +++ b/include/ethernet/dcp/driver/ethernet/udp/UdpDriver.hpp @@ -10,7 +10,9 @@ #ifndef DCPLIB_UDPDRIVER_H #define DCPLIB_UDPDRIVER_H +#ifndef ASIO_STANDALONE #define ASIO_STANDALONE +#endif #include diff --git a/include/xml/dcp/xml/DcpSlaveDescriptionReader.hpp b/include/xml/dcp/xml/DcpSlaveDescriptionReader.hpp index 41ef4f9..85ec18e 100644 --- a/include/xml/dcp/xml/DcpSlaveDescriptionReader.hpp +++ b/include/xml/dcp/xml/DcpSlaveDescriptionReader.hpp @@ -289,36 +289,44 @@ std::shared_ptr readSlaveDescription(const char *acuDFile) { parser->setValidationSchemaFullChecking(false); xercesc::MemBufInputSource dcpAnnotationFile(reinterpret_cast(xsd::dcpAnnotation.c_str()), xsd::dcpAnnotation.size(), "dcpAnnotation.xsd"); - assert(parser->loadGrammar(dcpAnnotationFile, Grammar::SchemaGrammarType, true)); + auto ret = parser->loadGrammar(dcpAnnotationFile, Grammar::SchemaGrammarType, true); + assert(ret); xercesc::MemBufInputSource dcpAttributeGroupsFile( reinterpret_cast(xsd::dcpAttributeGroups.c_str()), xsd::dcpAttributeGroups.size(), "dcpAttributeGroups.xsd"); - assert(parser->loadGrammar(dcpAttributeGroupsFile, Grammar::SchemaGrammarType, true)); + ret = parser->loadGrammar(dcpAttributeGroupsFile, Grammar::SchemaGrammarType, true); + assert(ret); xercesc::MemBufInputSource dcpDataTypesFile( reinterpret_cast(xsd::dcpDataTypes.c_str()), xsd::dcpDataTypes.size(), "dcpDataTypes.xsd"); - assert(parser->loadGrammar(dcpDataTypesFile, Grammar::SchemaGrammarType, true)); + ret = parser->loadGrammar(dcpDataTypesFile, Grammar::SchemaGrammarType, true); + assert(ret); xercesc::MemBufInputSource dcpTransportProtocolFile( reinterpret_cast(xsd::dcpTransportProtocol.c_str()), xsd::dcpTransportProtocol.size(), "dcpTransportProtocolTypes.xsd"); - assert(parser->loadGrammar(dcpTransportProtocolFile, Grammar::SchemaGrammarType, true)); + ret = parser->loadGrammar(dcpTransportProtocolFile, Grammar::SchemaGrammarType, true); + assert(ret); xercesc::MemBufInputSource dcpTypeFile( reinterpret_cast(xsd::dcpType.c_str()), xsd::dcpType.size(), "dcpType.xsd"); - assert(parser->loadGrammar(dcpTypeFile, Grammar::SchemaGrammarType, true)); + ret = parser->loadGrammar(dcpTypeFile, Grammar::SchemaGrammarType, true); + assert(ret); xercesc::MemBufInputSource dcpUnitFile( reinterpret_cast(xsd::dcpUnit.c_str()), xsd::dcpUnit.size(), "dcpUnit.xsd"); - assert(parser->loadGrammar(dcpUnitFile, Grammar::SchemaGrammarType, true)); + ret = parser->loadGrammar(dcpUnitFile, Grammar::SchemaGrammarType, true); + assert(ret); xercesc::MemBufInputSource dcpVariableFile( reinterpret_cast(xsd::dcpVariable.c_str()), xsd::dcpVariable.size(), "dcpVariable.xsd"); - assert(parser->loadGrammar(dcpVariableFile, Grammar::SchemaGrammarType, true)); + ret = parser->loadGrammar(dcpVariableFile, Grammar::SchemaGrammarType, true); + assert(ret); xercesc::MemBufInputSource slaveDescriptionFile( reinterpret_cast(xsd::slaveDescription.c_str()), xsd::slaveDescription.size(), "slaveDescription.xsd"); - assert(parser->loadGrammar(slaveDescriptionFile, Grammar::SchemaGrammarType, true)); - + ret = parser->loadGrammar(slaveDescriptionFile, Grammar::SchemaGrammarType, true); + assert(ret); + try { parser->parse(XMLString::transcode(acuDFile)); } catch (const xercesc::XMLException &toCatch) {