diff --git a/.gitignore b/.gitignore index c263cefe..8545b108 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,11 @@ testlog.xml /OdbDesignTests/CMakeLists_Local.txt /OdbDesignTests/DesignNameTests_Local.cpp /output +OdbDesignServer/api/__pycache__/ +OdbDesignServer/api/migrations/__pycache__/ +OdbDesignServer/OdbDesignServer/__pycache__/ +OdbDesignServer/PyOdbDesignLib/__pycache__/ +OdbDesignServer/PyOdbDesignLib/PyOdbDesignLib.py +OdbDesignServer/db.sqlite3 +OdbDesignServer/PyOdbDesignLib/_PyOdbDesignLib.pyd +/TEST_DATA.zip diff --git a/OdbDesignLib/App/DesignCache.cpp b/OdbDesignLib/App/DesignCache.cpp index 307084c0..cdcfc992 100644 --- a/OdbDesignLib/App/DesignCache.cpp +++ b/OdbDesignLib/App/DesignCache.cpp @@ -114,30 +114,26 @@ namespace Odb::Lib::App for (const auto& entry : directory_iterator(m_directory)) { if (entry.is_regular_file()) - { - //for (const auto& designExt : DESIGN_EXTENSIONS) - //{ - //if (entry.path().extension() == designExt) - if (ArchiveExtractor::IsArchiveTypeSupported(entry.path().filename())) + { + if (ArchiveExtractor::IsArchiveTypeSupported(entry.path().filename())) + { + try { - try + auto pFileArchive = LoadFileArchive(entry.path().stem().string()); + if (pFileArchive != nullptr) { - auto pFileArchive = LoadFileArchive(entry.path().stem().string()); - if (pFileArchive != nullptr) - { - loaded++; - } + loaded++; } - catch (std::exception& e) - { - // continue if we encounter an error loading one - logexception(e); - if (stopOnError) throw e; - } } - //} + catch (std::exception& e) + { + // continue if we encounter an error loading one + logexception(e); + if (stopOnError) throw e; + } + } } - } + } return loaded; } @@ -150,30 +146,25 @@ namespace Odb::Lib::App { if (entry.is_regular_file()) { - //for (const auto& designExt : DESIGN_EXTENSIONS) - //{ - //auto ext = entry.path().extension().string(); - //if (ext == designExt) - if (ArchiveExtractor::IsArchiveTypeSupported(entry.path().filename())) + if (ArchiveExtractor::IsArchiveTypeSupported(entry.path().filename())) + { + try { - try + auto pDesign = LoadDesign(entry.path().stem().string()); + if (pDesign != nullptr) { - auto pDesign = LoadDesign(entry.path().stem().string()); - if (pDesign != nullptr) - { - loaded++; - } + loaded++; } - catch (std::exception& e) + } + catch (std::exception& e) + { + logexception(e); + if (stopOnError) { - logexception(e); - if (stopOnError) - { - throw e; - } + throw e; } } - //} + } } } diff --git a/OdbDesignLib/App/DesignCache.h b/OdbDesignLib/App/DesignCache.h index 1187c6f6..52905fa9 100644 --- a/OdbDesignLib/App/DesignCache.h +++ b/OdbDesignLib/App/DesignCache.h @@ -42,7 +42,7 @@ namespace Odb::Lib::App std::shared_ptr LoadDesign(const std::string& designName); std::shared_ptr LoadFileArchive(const std::string& designName); - constexpr inline static const char* DESIGN_EXTENSIONS[] = { "zip", "tgz", "tar.gz", "tar" }; + constexpr inline static const char* DESIGN_EXTENSIONS[] = { "zip", "tgz", "tar.gz", "tar", "gzip" , "gz" }; }; } diff --git a/OdbDesignLib/App/OdbServerAppBase.h b/OdbDesignLib/App/OdbServerAppBase.h index 9a0df6f7..da0c1828 100644 --- a/OdbDesignLib/App/OdbServerAppBase.h +++ b/OdbDesignLib/App/OdbServerAppBase.h @@ -17,14 +17,15 @@ namespace Odb::Lib::App Utils::ExitCode Run() override; - protected: - crow::SimpleApp m_crowApp; + protected: RouteController::Vector m_vecControllers; // implement in subclasses to add route controllers virtual void add_controllers() = 0; private: + crow::SimpleApp m_crowApp; + void register_routes(); static constexpr const char* SSL_CERT_FILE = "ssl.crt"; diff --git a/OdbDesignLib/CMakeLists.txt b/OdbDesignLib/CMakeLists.txt index 278748ae..f0c24b20 100644 --- a/OdbDesignLib/CMakeLists.txt +++ b/OdbDesignLib/CMakeLists.txt @@ -65,6 +65,10 @@ target_link_libraries(OdbDesign PUBLIC OpenSSL::SSL OpenSSL::Crypto) target_compile_definitions(OdbDesign PUBLIC CROW_ENABLE_COMPRESSION) target_compile_definitions(OdbDesign PUBLIC CROW_ENABLE_SSL) +# link to Crow +find_package(Crow CONFIG REQUIRED) +target_link_libraries(OdbDesign PRIVATE Crow::Crow) + # Link to Protobuf find_package(Protobuf CONFIG REQUIRED) #protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS protoc/edadatafile.proto) @@ -75,6 +79,11 @@ target_link_libraries(OdbDesign PRIVATE protobuf::libprotobuf) # add the generated Protobuf C++ files to the target #target_sources(OdbDesign PRIVATE ${PROTO_SRCS} ${PROTO_HDRS}) +# workaround to remove error: "C++ command-line error: invalid macro definition: _CROW_ICD-NOTFOUND" +# (see https://github.com/CrowCpp/Crow/issues/661#issuecomment-1702544225) +list(REMOVE_ITEM _CROW_ICD "_CROW_ICD-NOTFOUND") +set_target_properties(Crow::Crow PROPERTIES INTERFACE_COMPILE_DEFINITIONS "${_CROW_ICD}") + # Python extension module build settings if (PYTHON_MODULE_BUILD) # # run swig to generate wrapper file diff --git a/OdbDesignLib/FileModel/Design/AttrListFile.cpp b/OdbDesignLib/FileModel/Design/AttrListFile.cpp index 4b29ffbf..344dadb8 100644 --- a/OdbDesignLib/FileModel/Design/AttrListFile.cpp +++ b/OdbDesignLib/FileModel/Design/AttrListFile.cpp @@ -44,7 +44,7 @@ namespace Odb::Lib::FileModel::Design loginfo("checking for extraction..."); std::filesystem::path featuresFilePath; - for (const std::string featuresFilename : ATTRLIST_FILENAMES) + for (const std::string& featuresFilename : ATTRLIST_FILENAMES) { loginfo("trying attrlist file: [" + featuresFilename + "]..."); diff --git a/OdbDesignLib/FileModel/Design/ComponentsFile.cpp b/OdbDesignLib/FileModel/Design/ComponentsFile.cpp index ac53e6c0..f5f4a32d 100644 --- a/OdbDesignLib/FileModel/Design/ComponentsFile.cpp +++ b/OdbDesignLib/FileModel/Design/ComponentsFile.cpp @@ -22,7 +22,8 @@ using namespace std::filesystem; namespace Odb::Lib::FileModel::Design { ComponentsFile::ComponentsFile() - : m_id((unsigned int)-1) + : m_id((unsigned int)-1) + , m_side(BoardSide::BsNone) { } @@ -310,7 +311,7 @@ namespace Odb::Lib::FileModel::Design loginfo("checking for extraction..."); std::filesystem::path componentsFilePath; - for (const std::string componentsFilename : COMPONENTS_FILENAMES) + for (const std::string& componentsFilename : COMPONENTS_FILENAMES) { loginfo("trying components file: [" + componentsFilename + "]..."); diff --git a/OdbDesignLib/FileModel/Design/EdaDataFile.cpp b/OdbDesignLib/FileModel/Design/EdaDataFile.cpp index 9e338660..4830ad6a 100644 --- a/OdbDesignLib/FileModel/Design/EdaDataFile.cpp +++ b/OdbDesignLib/FileModel/Design/EdaDataFile.cpp @@ -618,8 +618,8 @@ namespace Odb::Lib::FileModel::Design pCurrentSubnetRecord.reset(); } - m_netRecords.push_back(pCurrentNetRecord); - m_netRecordsByName[pCurrentNetRecord->name] = pCurrentNetRecord; + m_netRecords.push_back(pCurrentNetRecord); + //m_netRecordsByName[pCurrentNetRecord->name] = pCurrentNetRecord; pCurrentNetRecord.reset(); } @@ -835,7 +835,7 @@ namespace Odb::Lib::FileModel::Design } m_netRecords.push_back(pCurrentNetRecord); - m_netRecordsByName[pCurrentNetRecord->name] = pCurrentNetRecord; + //m_netRecordsByName[pCurrentNetRecord->name] = pCurrentNetRecord; pCurrentNetRecord.reset(); } else if (pCurrentPackageRecord != nullptr) @@ -855,7 +855,7 @@ namespace Odb::Lib::FileModel::Design // finish up any current (previous) package records m_packageRecords.push_back(pCurrentPackageRecord); - m_packageRecordsByName[pCurrentPackageRecord->name] = pCurrentPackageRecord; + //m_packageRecordsByName[pCurrentPackageRecord->name] = pCurrentPackageRecord; pCurrentPackageRecord.reset(); } @@ -1087,7 +1087,7 @@ namespace Odb::Lib::FileModel::Design } m_netRecords.push_back(pCurrentNetRecord); - m_netRecordsByName[pCurrentNetRecord->name] = pCurrentNetRecord; + //m_netRecordsByName[pCurrentNetRecord->name] = pCurrentNetRecord; pCurrentNetRecord.reset(); } else if (pCurrentPackageRecord != nullptr) @@ -1107,7 +1107,7 @@ namespace Odb::Lib::FileModel::Design // finish up any current (previous) package records m_packageRecords.push_back(pCurrentPackageRecord); - m_packageRecordsByName[pCurrentPackageRecord->name] = pCurrentPackageRecord; + //m_packageRecordsByName[pCurrentPackageRecord->name] = pCurrentPackageRecord; pCurrentPackageRecord.reset(); } else if (pCurrentFeatureGroupRecord != nullptr) @@ -1507,7 +1507,7 @@ namespace Odb::Lib::FileModel::Design } m_netRecords.push_back(pCurrentNetRecord); - m_netRecordsByName[pCurrentNetRecord->name] = pCurrentNetRecord; + //m_netRecordsByName[pCurrentNetRecord->name] = pCurrentNetRecord; pCurrentNetRecord.reset(); } else if (pCurrentPackageRecord != nullptr) @@ -1527,7 +1527,7 @@ namespace Odb::Lib::FileModel::Design // finish up any current (previous) package records m_packageRecords.push_back(pCurrentPackageRecord); - m_packageRecordsByName[pCurrentPackageRecord->name] = pCurrentPackageRecord; + //m_packageRecordsByName[pCurrentPackageRecord->name] = pCurrentPackageRecord; pCurrentPackageRecord.reset(); } else if (pCurrentFeatureGroupRecord != nullptr) @@ -1611,8 +1611,7 @@ namespace Odb::Lib::FileModel::Design { auto pPinRecord = std::make_shared(); pPinRecord->from_protobuf(pinRecordMessage); - m_pinRecords.push_back(pPinRecord); - m_pinRecordsByName[pPinRecord->name] = pPinRecord; + m_pinRecords.push_back(pPinRecord); } for (const auto& kvPinRecordMessage : message.pinrecordsbyname()) diff --git a/OdbDesignLib/FileModel/Design/EdaDataFile.h b/OdbDesignLib/FileModel/Design/EdaDataFile.h index eadce865..5b8338b5 100644 --- a/OdbDesignLib/FileModel/Design/EdaDataFile.h +++ b/OdbDesignLib/FileModel/Design/EdaDataFile.h @@ -113,9 +113,7 @@ namespace Odb::Lib::FileModel::Design ~NetRecord(); - std::string name; - //std::string attributesIdString; - // TODO: store index of records + std::string name; unsigned int index; SubnetRecord::Vector m_subnetRecords; @@ -245,8 +243,7 @@ namespace Odb::Lib::FileModel::Design std::string name; float pitch; float xMin, yMin; - float xMax, yMax; - //std::string attributesIdString; + float xMax, yMax; unsigned int index; OutlineRecord::Vector m_outlineRecords; diff --git a/OdbDesignLib/FileModel/Design/FeaturesFile.cpp b/OdbDesignLib/FileModel/Design/FeaturesFile.cpp index ec241482..02d18c3d 100644 --- a/OdbDesignLib/FileModel/Design/FeaturesFile.cpp +++ b/OdbDesignLib/FileModel/Design/FeaturesFile.cpp @@ -53,7 +53,7 @@ namespace Odb::Lib::FileModel::Design } std::filesystem::path featuresFilePath; - for (const std::string featuresFilename : filenames) + for (const std::string& featuresFilename : filenames) { loginfo("trying features file: [" + featuresFilename + "]..."); diff --git a/OdbDesignLib/FileModel/Design/NetlistFile.cpp b/OdbDesignLib/FileModel/Design/NetlistFile.cpp index 6f6fafcc..e30d2ee3 100644 --- a/OdbDesignLib/FileModel/Design/NetlistFile.cpp +++ b/OdbDesignLib/FileModel/Design/NetlistFile.cpp @@ -16,7 +16,9 @@ namespace Odb::Lib::FileModel::Design { NetlistFile::NetlistFile(std::filesystem::path path) - : m_path(path), m_optimized(false), m_staggered(Staggered::Unknown) + : m_path(path) + , m_optimized(false) + , m_staggered(Staggered::Unknown) { } @@ -219,7 +221,7 @@ namespace Odb::Lib::FileModel::Design pNetRecord->serialNumber = unSerialNumber; pNetRecord->netName = netName; m_netRecords.push_back(pNetRecord); - m_netRecordsByName[pNetRecord->netName] = pNetRecord; + //m_netRecordsByName[pNetRecord->netName] = pNetRecord; } else // NetPointRecord (starts with an unsigned int, netNumber) { diff --git a/OdbDesignLib/FileModel/Design/NetlistFile.h b/OdbDesignLib/FileModel/Design/NetlistFile.h index d01719fb..91bf8d95 100644 --- a/OdbDesignLib/FileModel/Design/NetlistFile.h +++ b/OdbDesignLib/FileModel/Design/NetlistFile.h @@ -64,7 +64,7 @@ namespace Odb::Lib::FileModel::Design void from_protobuf(const Odb::Lib::Protobuf::NetlistFile::NetPointRecord& message) override; typedef std::vector> Vector; - }; + }; // NetPointRecord enum class Staggered { @@ -111,5 +111,5 @@ namespace Odb::Lib::FileModel::Design inline constexpr static const char* COMMENT_TOKEN = "#"; inline constexpr static const char* HEADER_TOKEN = "H"; - }; + }; // NetlistFile } \ No newline at end of file diff --git a/OdbDesignLib/OdbDesign.h b/OdbDesignLib/OdbDesign.h index 8aa0e26b..0ea51609 100644 --- a/OdbDesignLib/OdbDesign.h +++ b/OdbDesignLib/OdbDesign.h @@ -3,9 +3,13 @@ // include headers for linking to library #include "FileModel/Design/FileArchive.h" -#include "ProductModel/Design.h" -#include "App/DesignCache.h" #include "FileModel/parse_error.h" #include "FileModel/invalid_odb_error.h" +#include "ProductModel/Design.h" + +#include "App/DesignCache.h" +#include "App/OdbAppBase.h" +#include "App/OdbServerAppBase.h" + diff --git a/OdbDesignLib/ProtoBuf/edadatafile.pb.cc b/OdbDesignLib/ProtoBuf/edadatafile.pb.cc index 9ef67f2d..c5b01cb8 100644 --- a/OdbDesignLib/ProtoBuf/edadatafile.pb.cc +++ b/OdbDesignLib/ProtoBuf/edadatafile.pb.cc @@ -515,7 +515,7 @@ static const ::_pb::Message* const file_default_instances[] = { const char descriptor_table_protodef_edadatafile_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = "\n\021edadatafile.proto\022\020Odb.Lib.Protobuf\032\014c" - "ommon.proto\032\013enums.proto\"\276#\n\013EdaDataFile" + "ommon.proto\032\013enums.proto\"\266#\n\013EdaDataFile" "\022\021\n\004path\030\001 \001(\tH\000\210\001\001\022\022\n\005units\030\002 \001(\tH\001\210\001\001\022" "\023\n\006source\030\003 \001(\tH\002\210\001\001\022\022\n\nlayerNames\030\004 \003(\t" "\022\026\n\016attributeNames\030\005 \003(\t\022\033\n\023attributeTex" @@ -565,7 +565,7 @@ const char descriptor_table_protodef_edadatafile_2eproto[] PROTOBUF_SECTION_VARI "umberB\021\n\017_toeprintNumberB\010\n\006_index\032;\n\031At" "tributeLookupTableEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005" "value\030\002 \001(\t:\0028\001B\007\n\005_nameB\025\n\023_attributesI" - "dStringB\010\n\006_index\032\324\020\n\rPackageRecord\022\021\n\004n" + "dStringB\010\n\006_index\032\314\020\n\rPackageRecord\022\021\n\004n" "ame\030\001 \001(\tH\000\210\001\001\022\022\n\005pitch\030\002 \001(\002H\001\210\001\001\022\021\n\004xM" "in\030\003 \001(\002H\002\210\001\001\022\021\n\004yMin\030\004 \001(\002H\003\210\001\001\022\021\n\004xMax" "\030\005 \001(\002H\004\210\001\001\022\021\n\004yMax\030\006 \001(\002H\005\210\001\001\022\037\n\022attrib" @@ -596,7 +596,7 @@ const char descriptor_table_protodef_edadatafile_2eproto[] PROTOBUF_SECTION_VARI "ctangle\020\000\022\n\n\006Circle\020\001\022\n\n\006Square\020\002\022\013\n\007Con" "tour\020\003B\007\n\005_typeB\r\n\013_lowerLeftXB\r\n\013_lower" "LeftYB\010\n\006_widthB\t\n\007_heightB\n\n\010_xCenterB\n" - "\n\010_yCenterB\013\n\t_halfSideB\t\n\007_radius\032\235\006\n\tP" + "\n\010_yCenterB\013\n\t_halfSideB\t\n\007_radius\032\225\006\n\tP" "inRecord\022\021\n\004name\030\001 \001(\tH\000\210\001\001\022M\n\004type\030\002 \001(" "\0162:.Odb.Lib.Protobuf.EdaDataFile.Package" "Record.PinRecord.TypeH\001\210\001\001\022\024\n\007xCenter\030\003 " @@ -607,29 +607,29 @@ const char descriptor_table_protodef_edadatafile_2eproto[] PROTOBUF_SECTION_VARI "\022W\n\tmountType\030\007 \001(\0162\?.Odb.Lib.Protobuf.E" "daDataFile.PackageRecord.PinRecord.Mount" "TypeH\006\210\001\001\022\017\n\002id\030\010 \001(\rH\007\210\001\001\022\022\n\005index\030\t \001(" - "\rH\010\210\001\001\"0\n\004Type\022\020\n\014THROUGH_HOLE\020\000\022\t\n\005BLIN" - "D\020\001\022\013\n\007SURFACE\020\002\"C\n\016ElectricalType\022\016\n\nEL" - "ECTRICAL\020\000\022\022\n\016NON_ELECTRICAL\020\001\022\r\n\tUNDEFI" - "NED\020\002\"\231\001\n\tMountType\022\007\n\003SMT\020\000\022\027\n\023RECOMMEN" - "DED_SMT_PAD\020\001\022\023\n\017MT_THROUGH_HOLE\020\002\022\034\n\030RE" - "COMMENDED_THROUGH_HOLE\020\003\022\014\n\010PRESSFIT\020\004\022\r" - "\n\tNON_BOARD\020\005\022\010\n\004HOLE\020\006\022\020\n\014MT_UNDEFINED\020" - "\007B\007\n\005_nameB\007\n\005_typeB\n\n\010_xCenterB\n\n\010_yCen" - "terB\023\n\021_finishedHoleSizeB\021\n\017_electricalT" - "ypeB\014\n\n_mountTypeB\005\n\003_idB\010\n\006_indexB\007\n\005_n" - "ameB\010\n\006_pitchB\007\n\005_xMinB\007\n\005_yMinB\007\n\005_xMax" - "B\007\n\005_yMaxB\025\n\023_attributesIdString\032\264\001\n\022Fea" - "tureGroupRecord\022\021\n\004type\030\001 \001(\tH\000\210\001\001\0229\n\017pr" - "opertyRecords\030\002 \003(\0132 .Odb.Lib.Protobuf.P" - "ropertyRecord\022G\n\020featureIdRecords\030\003 \003(\0132" - "-.Odb.Lib.Protobuf.EdaDataFile.FeatureId" - "RecordB\007\n\005_type\032`\n\025NetRecordsByNameEntry" - "\022\013\n\003key\030\001 \001(\t\0226\n\005value\030\002 \001(\0132\'.Odb.Lib.P" - "rotobuf.EdaDataFile.NetRecord:\0028\001\032h\n\031Pac" - "kageRecordsByNameEntry\022\013\n\003key\030\001 \001(\t\022:\n\005v" - "alue\030\002 \001(\0132+.Odb.Lib.Protobuf.EdaDataFil" - "e.PackageRecord:\0028\001B\007\n\005_pathB\010\n\006_unitsB\t" - "\n\007_sourceb\006proto3" + "\rH\010\210\001\001\"/\n\004Type\022\017\n\013ThroughHole\020\000\022\t\n\005Blind" + "\020\001\022\013\n\007Surface\020\002\"B\n\016ElectricalType\022\016\n\nEle" + "ctrical\020\000\022\021\n\rNonElectrical\020\001\022\r\n\tUndefine" + "d\020\002\"\223\001\n\tMountType\022\007\n\003Smt\020\000\022\025\n\021Recommende" + "dSmtPad\020\001\022\022\n\016MT_ThroughHole\020\002\022\032\n\026Recomme" + "ndedThroughHole\020\003\022\014\n\010PressFit\020\004\022\014\n\010NonBo" + "ard\020\005\022\010\n\004Hole\020\006\022\020\n\014MT_Undefined\020\007B\007\n\005_na" + "meB\007\n\005_typeB\n\n\010_xCenterB\n\n\010_yCenterB\023\n\021_" + "finishedHoleSizeB\021\n\017_electricalTypeB\014\n\n_" + "mountTypeB\005\n\003_idB\010\n\006_indexB\007\n\005_nameB\010\n\006_" + "pitchB\007\n\005_xMinB\007\n\005_yMinB\007\n\005_xMaxB\007\n\005_yMa" + "xB\025\n\023_attributesIdString\032\264\001\n\022FeatureGrou" + "pRecord\022\021\n\004type\030\001 \001(\tH\000\210\001\001\0229\n\017propertyRe" + "cords\030\002 \003(\0132 .Odb.Lib.Protobuf.PropertyR" + "ecord\022G\n\020featureIdRecords\030\003 \003(\0132-.Odb.Li" + "b.Protobuf.EdaDataFile.FeatureIdRecordB\007" + "\n\005_type\032`\n\025NetRecordsByNameEntry\022\013\n\003key\030" + "\001 \001(\t\0226\n\005value\030\002 \001(\0132\'.Odb.Lib.Protobuf." + "EdaDataFile.NetRecord:\0028\001\032h\n\031PackageReco" + "rdsByNameEntry\022\013\n\003key\030\001 \001(\t\022:\n\005value\030\002 \001" + "(\0132+.Odb.Lib.Protobuf.EdaDataFile.Packag" + "eRecord:\0028\001B\007\n\005_pathB\010\n\006_unitsB\t\n\007_sourc" + "eb\006proto3" ; static const ::_pbi::DescriptorTable* const descriptor_table_edadatafile_2eproto_deps[2] = { &::descriptor_table_common_2eproto, @@ -637,7 +637,7 @@ static const ::_pbi::DescriptorTable* const descriptor_table_edadatafile_2eproto }; static ::_pbi::once_flag descriptor_table_edadatafile_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_edadatafile_2eproto = { - false, false, 4617, descriptor_table_protodef_edadatafile_2eproto, + false, false, 4609, descriptor_table_protodef_edadatafile_2eproto, "edadatafile.proto", &descriptor_table_edadatafile_2eproto_once, descriptor_table_edadatafile_2eproto_deps, 2, 13, schemas, file_default_instances, TableStruct_edadatafile_2eproto::offsets, @@ -788,9 +788,9 @@ bool EdaDataFile_PackageRecord_PinRecord_Type_IsValid(int value) { } #if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -constexpr EdaDataFile_PackageRecord_PinRecord_Type EdaDataFile_PackageRecord_PinRecord::THROUGH_HOLE; -constexpr EdaDataFile_PackageRecord_PinRecord_Type EdaDataFile_PackageRecord_PinRecord::BLIND; -constexpr EdaDataFile_PackageRecord_PinRecord_Type EdaDataFile_PackageRecord_PinRecord::SURFACE; +constexpr EdaDataFile_PackageRecord_PinRecord_Type EdaDataFile_PackageRecord_PinRecord::ThroughHole; +constexpr EdaDataFile_PackageRecord_PinRecord_Type EdaDataFile_PackageRecord_PinRecord::Blind; +constexpr EdaDataFile_PackageRecord_PinRecord_Type EdaDataFile_PackageRecord_PinRecord::Surface; constexpr EdaDataFile_PackageRecord_PinRecord_Type EdaDataFile_PackageRecord_PinRecord::Type_MIN; constexpr EdaDataFile_PackageRecord_PinRecord_Type EdaDataFile_PackageRecord_PinRecord::Type_MAX; constexpr int EdaDataFile_PackageRecord_PinRecord::Type_ARRAYSIZE; @@ -811,9 +811,9 @@ bool EdaDataFile_PackageRecord_PinRecord_ElectricalType_IsValid(int value) { } #if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -constexpr EdaDataFile_PackageRecord_PinRecord_ElectricalType EdaDataFile_PackageRecord_PinRecord::ELECTRICAL; -constexpr EdaDataFile_PackageRecord_PinRecord_ElectricalType EdaDataFile_PackageRecord_PinRecord::NON_ELECTRICAL; -constexpr EdaDataFile_PackageRecord_PinRecord_ElectricalType EdaDataFile_PackageRecord_PinRecord::UNDEFINED; +constexpr EdaDataFile_PackageRecord_PinRecord_ElectricalType EdaDataFile_PackageRecord_PinRecord::Electrical; +constexpr EdaDataFile_PackageRecord_PinRecord_ElectricalType EdaDataFile_PackageRecord_PinRecord::NonElectrical; +constexpr EdaDataFile_PackageRecord_PinRecord_ElectricalType EdaDataFile_PackageRecord_PinRecord::Undefined; constexpr EdaDataFile_PackageRecord_PinRecord_ElectricalType EdaDataFile_PackageRecord_PinRecord::ElectricalType_MIN; constexpr EdaDataFile_PackageRecord_PinRecord_ElectricalType EdaDataFile_PackageRecord_PinRecord::ElectricalType_MAX; constexpr int EdaDataFile_PackageRecord_PinRecord::ElectricalType_ARRAYSIZE; @@ -839,14 +839,14 @@ bool EdaDataFile_PackageRecord_PinRecord_MountType_IsValid(int value) { } #if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::SMT; -constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::RECOMMENDED_SMT_PAD; -constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::MT_THROUGH_HOLE; -constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::RECOMMENDED_THROUGH_HOLE; -constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::PRESSFIT; -constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::NON_BOARD; -constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::HOLE; -constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::MT_UNDEFINED; +constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::Smt; +constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::RecommendedSmtPad; +constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::MT_ThroughHole; +constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::RecommendedThroughHole; +constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::PressFit; +constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::NonBoard; +constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::Hole; +constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::MT_Undefined; constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::MountType_MIN; constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord::MountType_MAX; constexpr int EdaDataFile_PackageRecord_PinRecord::MountType_ARRAYSIZE; diff --git a/OdbDesignLib/ProtoBuf/edadatafile.pb.h b/OdbDesignLib/ProtoBuf/edadatafile.pb.h index 08f1163a..72b8f4f2 100644 --- a/OdbDesignLib/ProtoBuf/edadatafile.pb.h +++ b/OdbDesignLib/ProtoBuf/edadatafile.pb.h @@ -247,15 +247,15 @@ inline bool EdaDataFile_PackageRecord_OutlineRecord_Type_Parse( EdaDataFile_PackageRecord_OutlineRecord_Type_descriptor(), name, value); } enum EdaDataFile_PackageRecord_PinRecord_Type : int { - EdaDataFile_PackageRecord_PinRecord_Type_THROUGH_HOLE = 0, - EdaDataFile_PackageRecord_PinRecord_Type_BLIND = 1, - EdaDataFile_PackageRecord_PinRecord_Type_SURFACE = 2, + EdaDataFile_PackageRecord_PinRecord_Type_ThroughHole = 0, + EdaDataFile_PackageRecord_PinRecord_Type_Blind = 1, + EdaDataFile_PackageRecord_PinRecord_Type_Surface = 2, EdaDataFile_PackageRecord_PinRecord_Type_EdaDataFile_PackageRecord_PinRecord_Type_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits::min(), EdaDataFile_PackageRecord_PinRecord_Type_EdaDataFile_PackageRecord_PinRecord_Type_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits::max() }; bool EdaDataFile_PackageRecord_PinRecord_Type_IsValid(int value); -constexpr EdaDataFile_PackageRecord_PinRecord_Type EdaDataFile_PackageRecord_PinRecord_Type_Type_MIN = EdaDataFile_PackageRecord_PinRecord_Type_THROUGH_HOLE; -constexpr EdaDataFile_PackageRecord_PinRecord_Type EdaDataFile_PackageRecord_PinRecord_Type_Type_MAX = EdaDataFile_PackageRecord_PinRecord_Type_SURFACE; +constexpr EdaDataFile_PackageRecord_PinRecord_Type EdaDataFile_PackageRecord_PinRecord_Type_Type_MIN = EdaDataFile_PackageRecord_PinRecord_Type_ThroughHole; +constexpr EdaDataFile_PackageRecord_PinRecord_Type EdaDataFile_PackageRecord_PinRecord_Type_Type_MAX = EdaDataFile_PackageRecord_PinRecord_Type_Surface; constexpr int EdaDataFile_PackageRecord_PinRecord_Type_Type_ARRAYSIZE = EdaDataFile_PackageRecord_PinRecord_Type_Type_MAX + 1; const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* EdaDataFile_PackageRecord_PinRecord_Type_descriptor(); @@ -273,15 +273,15 @@ inline bool EdaDataFile_PackageRecord_PinRecord_Type_Parse( EdaDataFile_PackageRecord_PinRecord_Type_descriptor(), name, value); } enum EdaDataFile_PackageRecord_PinRecord_ElectricalType : int { - EdaDataFile_PackageRecord_PinRecord_ElectricalType_ELECTRICAL = 0, - EdaDataFile_PackageRecord_PinRecord_ElectricalType_NON_ELECTRICAL = 1, - EdaDataFile_PackageRecord_PinRecord_ElectricalType_UNDEFINED = 2, + EdaDataFile_PackageRecord_PinRecord_ElectricalType_Electrical = 0, + EdaDataFile_PackageRecord_PinRecord_ElectricalType_NonElectrical = 1, + EdaDataFile_PackageRecord_PinRecord_ElectricalType_Undefined = 2, EdaDataFile_PackageRecord_PinRecord_ElectricalType_EdaDataFile_PackageRecord_PinRecord_ElectricalType_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits::min(), EdaDataFile_PackageRecord_PinRecord_ElectricalType_EdaDataFile_PackageRecord_PinRecord_ElectricalType_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits::max() }; bool EdaDataFile_PackageRecord_PinRecord_ElectricalType_IsValid(int value); -constexpr EdaDataFile_PackageRecord_PinRecord_ElectricalType EdaDataFile_PackageRecord_PinRecord_ElectricalType_ElectricalType_MIN = EdaDataFile_PackageRecord_PinRecord_ElectricalType_ELECTRICAL; -constexpr EdaDataFile_PackageRecord_PinRecord_ElectricalType EdaDataFile_PackageRecord_PinRecord_ElectricalType_ElectricalType_MAX = EdaDataFile_PackageRecord_PinRecord_ElectricalType_UNDEFINED; +constexpr EdaDataFile_PackageRecord_PinRecord_ElectricalType EdaDataFile_PackageRecord_PinRecord_ElectricalType_ElectricalType_MIN = EdaDataFile_PackageRecord_PinRecord_ElectricalType_Electrical; +constexpr EdaDataFile_PackageRecord_PinRecord_ElectricalType EdaDataFile_PackageRecord_PinRecord_ElectricalType_ElectricalType_MAX = EdaDataFile_PackageRecord_PinRecord_ElectricalType_Undefined; constexpr int EdaDataFile_PackageRecord_PinRecord_ElectricalType_ElectricalType_ARRAYSIZE = EdaDataFile_PackageRecord_PinRecord_ElectricalType_ElectricalType_MAX + 1; const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* EdaDataFile_PackageRecord_PinRecord_ElectricalType_descriptor(); @@ -299,20 +299,20 @@ inline bool EdaDataFile_PackageRecord_PinRecord_ElectricalType_Parse( EdaDataFile_PackageRecord_PinRecord_ElectricalType_descriptor(), name, value); } enum EdaDataFile_PackageRecord_PinRecord_MountType : int { - EdaDataFile_PackageRecord_PinRecord_MountType_SMT = 0, - EdaDataFile_PackageRecord_PinRecord_MountType_RECOMMENDED_SMT_PAD = 1, - EdaDataFile_PackageRecord_PinRecord_MountType_MT_THROUGH_HOLE = 2, - EdaDataFile_PackageRecord_PinRecord_MountType_RECOMMENDED_THROUGH_HOLE = 3, - EdaDataFile_PackageRecord_PinRecord_MountType_PRESSFIT = 4, - EdaDataFile_PackageRecord_PinRecord_MountType_NON_BOARD = 5, - EdaDataFile_PackageRecord_PinRecord_MountType_HOLE = 6, - EdaDataFile_PackageRecord_PinRecord_MountType_MT_UNDEFINED = 7, + EdaDataFile_PackageRecord_PinRecord_MountType_Smt = 0, + EdaDataFile_PackageRecord_PinRecord_MountType_RecommendedSmtPad = 1, + EdaDataFile_PackageRecord_PinRecord_MountType_MT_ThroughHole = 2, + EdaDataFile_PackageRecord_PinRecord_MountType_RecommendedThroughHole = 3, + EdaDataFile_PackageRecord_PinRecord_MountType_PressFit = 4, + EdaDataFile_PackageRecord_PinRecord_MountType_NonBoard = 5, + EdaDataFile_PackageRecord_PinRecord_MountType_Hole = 6, + EdaDataFile_PackageRecord_PinRecord_MountType_MT_Undefined = 7, EdaDataFile_PackageRecord_PinRecord_MountType_EdaDataFile_PackageRecord_PinRecord_MountType_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits::min(), EdaDataFile_PackageRecord_PinRecord_MountType_EdaDataFile_PackageRecord_PinRecord_MountType_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits::max() }; bool EdaDataFile_PackageRecord_PinRecord_MountType_IsValid(int value); -constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord_MountType_MountType_MIN = EdaDataFile_PackageRecord_PinRecord_MountType_SMT; -constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord_MountType_MountType_MAX = EdaDataFile_PackageRecord_PinRecord_MountType_MT_UNDEFINED; +constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord_MountType_MountType_MIN = EdaDataFile_PackageRecord_PinRecord_MountType_Smt; +constexpr EdaDataFile_PackageRecord_PinRecord_MountType EdaDataFile_PackageRecord_PinRecord_MountType_MountType_MAX = EdaDataFile_PackageRecord_PinRecord_MountType_MT_Undefined; constexpr int EdaDataFile_PackageRecord_PinRecord_MountType_MountType_ARRAYSIZE = EdaDataFile_PackageRecord_PinRecord_MountType_MountType_MAX + 1; const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* EdaDataFile_PackageRecord_PinRecord_MountType_descriptor(); @@ -1710,12 +1710,12 @@ class EdaDataFile_PackageRecord_PinRecord final : // nested types ---------------------------------------------------- typedef EdaDataFile_PackageRecord_PinRecord_Type Type; - static constexpr Type THROUGH_HOLE = - EdaDataFile_PackageRecord_PinRecord_Type_THROUGH_HOLE; - static constexpr Type BLIND = - EdaDataFile_PackageRecord_PinRecord_Type_BLIND; - static constexpr Type SURFACE = - EdaDataFile_PackageRecord_PinRecord_Type_SURFACE; + static constexpr Type ThroughHole = + EdaDataFile_PackageRecord_PinRecord_Type_ThroughHole; + static constexpr Type Blind = + EdaDataFile_PackageRecord_PinRecord_Type_Blind; + static constexpr Type Surface = + EdaDataFile_PackageRecord_PinRecord_Type_Surface; static inline bool Type_IsValid(int value) { return EdaDataFile_PackageRecord_PinRecord_Type_IsValid(value); } @@ -1742,12 +1742,12 @@ class EdaDataFile_PackageRecord_PinRecord final : } typedef EdaDataFile_PackageRecord_PinRecord_ElectricalType ElectricalType; - static constexpr ElectricalType ELECTRICAL = - EdaDataFile_PackageRecord_PinRecord_ElectricalType_ELECTRICAL; - static constexpr ElectricalType NON_ELECTRICAL = - EdaDataFile_PackageRecord_PinRecord_ElectricalType_NON_ELECTRICAL; - static constexpr ElectricalType UNDEFINED = - EdaDataFile_PackageRecord_PinRecord_ElectricalType_UNDEFINED; + static constexpr ElectricalType Electrical = + EdaDataFile_PackageRecord_PinRecord_ElectricalType_Electrical; + static constexpr ElectricalType NonElectrical = + EdaDataFile_PackageRecord_PinRecord_ElectricalType_NonElectrical; + static constexpr ElectricalType Undefined = + EdaDataFile_PackageRecord_PinRecord_ElectricalType_Undefined; static inline bool ElectricalType_IsValid(int value) { return EdaDataFile_PackageRecord_PinRecord_ElectricalType_IsValid(value); } @@ -1774,22 +1774,22 @@ class EdaDataFile_PackageRecord_PinRecord final : } typedef EdaDataFile_PackageRecord_PinRecord_MountType MountType; - static constexpr MountType SMT = - EdaDataFile_PackageRecord_PinRecord_MountType_SMT; - static constexpr MountType RECOMMENDED_SMT_PAD = - EdaDataFile_PackageRecord_PinRecord_MountType_RECOMMENDED_SMT_PAD; - static constexpr MountType MT_THROUGH_HOLE = - EdaDataFile_PackageRecord_PinRecord_MountType_MT_THROUGH_HOLE; - static constexpr MountType RECOMMENDED_THROUGH_HOLE = - EdaDataFile_PackageRecord_PinRecord_MountType_RECOMMENDED_THROUGH_HOLE; - static constexpr MountType PRESSFIT = - EdaDataFile_PackageRecord_PinRecord_MountType_PRESSFIT; - static constexpr MountType NON_BOARD = - EdaDataFile_PackageRecord_PinRecord_MountType_NON_BOARD; - static constexpr MountType HOLE = - EdaDataFile_PackageRecord_PinRecord_MountType_HOLE; - static constexpr MountType MT_UNDEFINED = - EdaDataFile_PackageRecord_PinRecord_MountType_MT_UNDEFINED; + static constexpr MountType Smt = + EdaDataFile_PackageRecord_PinRecord_MountType_Smt; + static constexpr MountType RecommendedSmtPad = + EdaDataFile_PackageRecord_PinRecord_MountType_RecommendedSmtPad; + static constexpr MountType MT_ThroughHole = + EdaDataFile_PackageRecord_PinRecord_MountType_MT_ThroughHole; + static constexpr MountType RecommendedThroughHole = + EdaDataFile_PackageRecord_PinRecord_MountType_RecommendedThroughHole; + static constexpr MountType PressFit = + EdaDataFile_PackageRecord_PinRecord_MountType_PressFit; + static constexpr MountType NonBoard = + EdaDataFile_PackageRecord_PinRecord_MountType_NonBoard; + static constexpr MountType Hole = + EdaDataFile_PackageRecord_PinRecord_MountType_Hole; + static constexpr MountType MT_Undefined = + EdaDataFile_PackageRecord_PinRecord_MountType_MT_Undefined; static inline bool MountType_IsValid(int value) { return EdaDataFile_PackageRecord_PinRecord_MountType_IsValid(value); } diff --git a/OdbDesignLib/ProtoBuf/enums.pb.cc b/OdbDesignLib/ProtoBuf/enums.pb.cc index acd8fe0e..33db87b1 100644 --- a/OdbDesignLib/ProtoBuf/enums.pb.cc +++ b/OdbDesignLib/ProtoBuf/enums.pb.cc @@ -33,16 +33,16 @@ static constexpr ::_pbi::MigrationSchema* schemas = nullptr; static constexpr ::_pb::Message* const* file_default_instances = nullptr; const char descriptor_table_protodef_enums_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = - "\n\013enums.proto\022\020Odb.Lib.Protobuf*-\n\tBoard" - "Side\022\007\n\003Top\020\000\022\n\n\006Bottom\020\001\022\013\n\007Neither\020\002*\"" - "\n\tLineShape\022\n\n\006Square\020\000\022\t\n\005Round\020\001*&\n\010Po" - "larity\022\014\n\010Positive\020\000\022\014\n\010Negative\020\001*.\n\010Un" - "itType\022\010\n\004None\020\000\022\n\n\006Metric\020\001\022\014\n\010Imperial" - "\020\002b\006proto3" + "\n\013enums.proto\022\020Odb.Lib.Protobuf*,\n\tBoard" + "Side\022\n\n\006BsNone\020\000\022\007\n\003Top\020\001\022\n\n\006Bottom\020\002*\"\n" + "\tLineShape\022\n\n\006Square\020\000\022\t\n\005Round\020\001*&\n\010Pol" + "arity\022\014\n\010Positive\020\000\022\014\n\010Negative\020\001*.\n\010Uni" + "tType\022\010\n\004None\020\000\022\n\n\006Metric\020\001\022\014\n\010Imperial\020" + "\002b\006proto3" ; static ::_pbi::once_flag descriptor_table_enums_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_enums_2eproto = { - false, false, 210, descriptor_table_protodef_enums_2eproto, + false, false, 209, descriptor_table_protodef_enums_2eproto, "enums.proto", &descriptor_table_enums_2eproto_once, nullptr, 0, 0, schemas, file_default_instances, TableStruct_enums_2eproto::offsets, diff --git a/OdbDesignLib/ProtoBuf/enums.pb.h b/OdbDesignLib/ProtoBuf/enums.pb.h index 35c3fa27..3c7ce6c4 100644 --- a/OdbDesignLib/ProtoBuf/enums.pb.h +++ b/OdbDesignLib/ProtoBuf/enums.pb.h @@ -50,15 +50,15 @@ namespace Lib { namespace Protobuf { enum BoardSide : int { - Top = 0, - Bottom = 1, - Neither = 2, + BsNone = 0, + Top = 1, + Bottom = 2, BoardSide_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits::min(), BoardSide_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits::max() }; bool BoardSide_IsValid(int value); -constexpr BoardSide BoardSide_MIN = Top; -constexpr BoardSide BoardSide_MAX = Neither; +constexpr BoardSide BoardSide_MIN = BsNone; +constexpr BoardSide BoardSide_MAX = Bottom; constexpr int BoardSide_ARRAYSIZE = BoardSide_MAX + 1; const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* BoardSide_descriptor(); diff --git a/OdbDesignLib/enums.h b/OdbDesignLib/enums.h index 7bca5428..53560c94 100644 --- a/OdbDesignLib/enums.h +++ b/OdbDesignLib/enums.h @@ -4,6 +4,7 @@ namespace Odb::Lib { enum class BoardSide { + BsNone, Top, Bottom }; diff --git a/OdbDesignLib/protoc/edadatafile.proto b/OdbDesignLib/protoc/edadatafile.proto index d4c74e49..92f28297 100644 --- a/OdbDesignLib/protoc/edadatafile.proto +++ b/OdbDesignLib/protoc/edadatafile.proto @@ -119,26 +119,26 @@ message EdaDataFile { message PinRecord { enum Type { - THROUGH_HOLE = 0; - BLIND = 1; - SURFACE = 2; + ThroughHole = 0; + Blind = 1; + Surface = 2; }; enum ElectricalType { - ELECTRICAL = 0; - NON_ELECTRICAL = 1; - UNDEFINED = 2; + Electrical = 0; + NonElectrical = 1; + Undefined = 2; }; enum MountType { - SMT = 0; - RECOMMENDED_SMT_PAD = 1; - MT_THROUGH_HOLE = 2; - RECOMMENDED_THROUGH_HOLE = 3; - PRESSFIT = 4; - NON_BOARD = 5; - HOLE = 6; - MT_UNDEFINED = 7; // default + Smt = 0; + RecommendedSmtPad = 1; + MT_ThroughHole = 2; + RecommendedThroughHole = 3; + PressFit = 4; + NonBoard = 5; + Hole = 6; + MT_Undefined = 7; // default }; optional string name = 1; diff --git a/OdbDesignLib/protoc/enums.proto b/OdbDesignLib/protoc/enums.proto index d22f512c..70e34a07 100644 --- a/OdbDesignLib/protoc/enums.proto +++ b/OdbDesignLib/protoc/enums.proto @@ -7,9 +7,9 @@ package Odb.Lib.Protobuf; enum BoardSide { - Top = 0; - Bottom = 1; - Neither = 2; + BsNone = 0; + Top = 1; + Bottom = 2; }; enum LineShape diff --git a/OdbDesignServer/CMakeLists.txt b/OdbDesignServer/CMakeLists.txt index 95279b63..8c004e8d 100644 --- a/OdbDesignServer/CMakeLists.txt +++ b/OdbDesignServer/CMakeLists.txt @@ -1,20 +1,11 @@ # CMakeList.txt : CMake project for OdbDesignServer # -add_executable(OdbDesignServer "main.cpp" "Controllers/HelloWorldController.h" "Controllers/HelloWorldController.cpp" "OdbDesignServerApp.h" "OdbDesignServerApp.cpp" "Controllers/StepsEdaDataController.cpp" "Controllers/StepsEdaDataController.h" "OdbDesignServer.h" "Controllers/FileUploadController.h" "Controllers/FileUploadController.cpp") +add_executable(OdbDesignServer "main.cpp" "Controllers/HelloWorldController.h" "Controllers/HelloWorldController.cpp" "OdbDesignServerApp.h" "OdbDesignServerApp.cpp" "OdbDesignServer.h" "Controllers/FileUploadController.h" "Controllers/FileUploadController.cpp" "Controllers/FileModelController.h" "Controllers/FileModelController.cpp") ## PCH file (GLOB_RECURSE ODBDESIGN_SERVER_HEADER_FILES "*.h") target_precompile_headers(OdbDesignServer PRIVATE ${ODBDESIGN_SERVER_HEADER_FILES}) -# link to Crow -find_package(Crow CONFIG REQUIRED) -target_link_libraries(OdbDesignServer PRIVATE Crow::Crow) - # link to OdbDesign library target_link_libraries(OdbDesignServer PRIVATE OdbDesign) - -# workaround to remove error: "C++ command-line error: invalid macro definition: _CROW_ICD-NOTFOUND" -# (see https://github.com/CrowCpp/Crow/issues/661#issuecomment-1702544225) -list(REMOVE_ITEM _CROW_ICD "_CROW_ICD-NOTFOUND") -set_target_properties(Crow::Crow PROPERTIES INTERFACE_COMPILE_DEFINITIONS "${_CROW_ICD}") diff --git a/OdbDesignServer/Controllers/StepsEdaDataController.cpp b/OdbDesignServer/Controllers/FileModelController.cpp similarity index 65% rename from OdbDesignServer/Controllers/StepsEdaDataController.cpp rename to OdbDesignServer/Controllers/FileModelController.cpp index 3a8010be..cd7e30cb 100644 --- a/OdbDesignServer/Controllers/StepsEdaDataController.cpp +++ b/OdbDesignServer/Controllers/FileModelController.cpp @@ -1,8 +1,5 @@ -#include "StepsEdaDataController.h" -#include "FileModel/Design/FileArchive.h" -#include "FileModel/Design/EdaDataFile.h" -#include "JsonCrowReturnable.h" -#include +#include "FileModelController.h" +#include #include "UrlEncoding.h" @@ -12,18 +9,14 @@ using namespace Utils; namespace Odb::App::Server { - StepsEdaDataController::StepsEdaDataController(IOdbServerApp& serverApp) + FileModelController::FileModelController(Odb::Lib::App::IOdbServerApp& serverApp) : RouteController(serverApp) { } - void StepsEdaDataController::register_routes() + void FileModelController::register_routes() { - // - // /steps/edadata?design=sample_design&step=stepName - // - // TODO: figure out why capture here is weird (i.e. how to capture pServerApp so it can be used in the member fxn handler) - CROW_ROUTE(m_serverApp.crow_app(), "/designs//steps//eda_data") + CROW_ROUTE(m_serverApp.crow_app(), "/filemodel//steps//eda_data") ([&](const crow::request& req, std::string designName, std::string stepName) { return this->steps_edadata_route_handler(designName, stepName, req); @@ -34,19 +27,11 @@ namespace Odb::App::Server { return this->designs_route_handler(designName, req); }); + } - //app.route_dynamic(url) - - //register_route_handler("/steps/edadata/package_records", std::bind(&StepsEdaDataController::steps_edadata_route_handler, this, std::placeholders::_1)); - /*[&](const crow::request& req) - { - return steps_edadata_route_handler(req); - });*/ - } - - crow::response StepsEdaDataController::steps_edadata_route_handler(const std::string& designName, - const std::string& stepName, - const crow::request& req) + crow::response FileModelController::steps_edadata_route_handler(const std::string& designName, + const std::string& stepName, + const crow::request& req) { auto designNameDecoded = UrlEncoding::decode(designName); if (designNameDecoded.empty()) @@ -59,7 +44,7 @@ namespace Odb::App::Server { return crow::response(crow::status::BAD_REQUEST, "step name not specified"); } - + auto pFileArchive = m_serverApp.designs().GetFileArchive(designNameDecoded); if (pFileArchive == nullptr) { @@ -82,7 +67,7 @@ namespace Odb::App::Server return crow::response(JsonCrowReturnable(edaDataFile)); } - crow::response StepsEdaDataController::designs_route_handler(const std::string& designName, const crow::request& req) + crow::response FileModelController::designs_route_handler(const std::string& designName, const crow::request& req) { auto designNameDecoded = UrlEncoding::decode(designName); if (designNameDecoded.empty()) @@ -100,4 +85,4 @@ namespace Odb::App::Server return crow::response(JsonCrowReturnable(*pFileArchive)); } -} +} \ No newline at end of file diff --git a/OdbDesignServer/Controllers/FileModelController.h b/OdbDesignServer/Controllers/FileModelController.h new file mode 100644 index 00000000..ab936328 --- /dev/null +++ b/OdbDesignServer/Controllers/FileModelController.h @@ -0,0 +1,19 @@ +#pragma once + +#include "App/RouteController.h" +#include "App/IOdbServerApp.h" + +namespace Odb::App::Server +{ + class FileModelController : public Odb::Lib::App::RouteController + { + public: + FileModelController(Odb::Lib::App::IOdbServerApp& serverApp); + //virtual ~FileModelController() = default; + + virtual void register_routes() override; + + crow::response steps_edadata_route_handler(const std::string& designName, const std::string& stepName, const crow::request& req); + crow::response designs_route_handler(const std::string& designName, const crow::request& req); + }; +} diff --git a/OdbDesignServer/Controllers/StepsEdaDataController.h b/OdbDesignServer/Controllers/StepsEdaDataController.h deleted file mode 100644 index 9ce2a913..00000000 --- a/OdbDesignServer/Controllers/StepsEdaDataController.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include "App/RouteController.h" -#include "App/IOdbServerApp.h" - - -namespace Odb::App::Server -{ -class StepsEdaDataController : public Odb::Lib::App::RouteController - { - public: - StepsEdaDataController(Odb::Lib::App::IOdbServerApp& serverApp); - - void register_routes() override; - - private: - crow::response steps_edadata_route_handler(const std::string& designName, - const std::string& stepName, - const crow::request& req); - - crow::response designs_route_handler(const std::string& designName, - const crow::request& req); - - }; -} diff --git a/OdbDesignServer/OdbDesignServerApp.cpp b/OdbDesignServer/OdbDesignServerApp.cpp index cc15fe40..b2f40a0e 100644 --- a/OdbDesignServer/OdbDesignServerApp.cpp +++ b/OdbDesignServer/OdbDesignServerApp.cpp @@ -1,8 +1,8 @@ #include "OdbDesignServerApp.h" #include "OdbDesign.h" #include "Controllers/HelloWorldController.h" -#include "Controllers/StepsEdaDataController.h" #include "Controllers/FileUploadController.h" +#include "Controllers/FileModelController.h" namespace Odb::App::Server @@ -31,8 +31,8 @@ namespace Odb::App::Server void OdbDesignServerApp::add_controllers() { - m_vecControllers.push_back(std::make_shared(*this)); - m_vecControllers.push_back(std::make_shared(*this)); + m_vecControllers.push_back(std::make_shared(*this)); m_vecControllers.push_back(std::make_shared(*this)); + m_vecControllers.push_back(std::make_shared(*this)); } } \ No newline at end of file diff --git a/PyOdbDesignLib/Utilities.py b/PyOdbDesignLib/Utilities.py new file mode 100644 index 00000000..d8a129d6 --- /dev/null +++ b/PyOdbDesignLib/Utilities.py @@ -0,0 +1,13 @@ +from PyOdbDesignLib import PyOdbDesignLib + + +def load_file_archive(path): + """ + This function loads a FileArchive object from disk and returns it. + """ + try: + file_archive = PyOdbDesignLib.FileArchive(path) + return file_archive + except Exception as e: + print("Error: {}".format(e)) + return None diff --git a/Utils/macros.h b/Utils/macros.h index f3dffdf6..6f6654cf 100644 --- a/Utils/macros.h +++ b/Utils/macros.h @@ -3,7 +3,7 @@ namespace Odb::Lib { - static inline bool IsMsvc() + constexpr static inline bool IsMsvc() { #if defined(_MSC_VER) return true; @@ -12,6 +12,15 @@ namespace Odb::Lib #endif } + constexpr static inline bool IsDebug() + { + #if defined(_DEBUG) + return true; + #else + return false; + #endif + } + #ifndef ARRAY_COUNT # define ARRAY_COUNT(array_) (sizeof(array_)/sizeof((array_)[0])) #endif