Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning and release builds #66

Merged
merged 5 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/core/dcp/helper/DcpSlaveDescriptionHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t>(transportProtocol)));
}


Expand Down
3 changes: 3 additions & 0 deletions include/core/dcp/model/LogEntry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions include/core/dcp/model/pdu/IpToStr.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#ifndef DCPLIB_IPTOSTR
#define DCPLIB_IPTOSTR

#if defined(DEBUG) || defined(LOGGING)
#include <string>
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
5 changes: 5 additions & 0 deletions include/core/dcp/xml/DcpSlaveDescriptionElements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned int>(dir)));
}

struct DataPipe_t {
Expand Down Expand Up @@ -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<unsigned int>(dim)));
}
struct Dimension_t {
DimensionType type;
Expand All @@ -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<unsigned int>(kind)));
}

struct Dependency_t {
Expand Down Expand Up @@ -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<unsigned int>(variability)));
}

struct Variable_t {
Expand Down Expand Up @@ -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<uint8_t>(variableNamingConvention)));
}

struct SlaveDescription_t {
Expand Down
2 changes: 2 additions & 0 deletions include/ethernet/dcp/driver/ethernet/tcp/TcpDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#ifndef DCPLIB_TCP_DRIVER_H
#define DCPLIB_TCP_DRIVER_H

#ifndef ASIO_STANDALONE
#define ASIO_STANDALONE
#endif


#include <dcp/driver/ethernet/tcp/helper/TcpHelper.hpp>
Expand Down
2 changes: 2 additions & 0 deletions include/ethernet/dcp/driver/ethernet/udp/UdpDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#ifndef DCPLIB_UDPDRIVER_H
#define DCPLIB_UDPDRIVER_H

#ifndef ASIO_STANDALONE
#define ASIO_STANDALONE
#endif

#include <dcp/driver/ethernet/udp/helper/UdpHelper.hpp>

Expand Down
26 changes: 17 additions & 9 deletions include/xml/dcp/xml/DcpSlaveDescriptionReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,36 +289,44 @@ std::shared_ptr<SlaveDescription_t> readSlaveDescription(const char *acuDFile) {
parser->setValidationSchemaFullChecking(false);
xercesc::MemBufInputSource dcpAnnotationFile(reinterpret_cast<const XMLByte *>(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<const XMLByte *>(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<const XMLByte *>(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<const XMLByte *>(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<const XMLByte *>(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<const XMLByte *>(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<const XMLByte *>(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<const XMLByte *>(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) {
Expand Down
Loading