Dynamically Loaded Libraries Outside the Standard
LoadModule directive • C extension for CPython (.pyd on Windows) – import module_name • Java Native Interface (JNI) – System.loadLibrary(name) Customized file formats for dynamic loading9 CppCon 2021 | #include | • Loadable module being used in a different language • Accessed through a Foreign Function Interface (FFI) How foreign is foreign?40 CppCon 2021 | from ctypes import CDLL, c_double x = (c_double programmatically get extra functionality?47 CppCon 2021 | • Generic Graphics Library (GEGL) from GIMP • Adding-removing functionalities by dragging & dropping files Case: GEGL48 CppCon 2021 | PLUGINAPP_API0 码力 | 100 页 | 3.98 MB | 5 月前3Why Loops End
loop is repeated, and • is not separated from the loop by a function interface?result_type function_name ( parameter_list ) interface { // preconditions… implementation; // postconditions… } The The calling function is responsible for the top part of the interface. The called function is responsible for the bottom part of the interface.😈 Let’s call that sort of reason a local reason. Does the ensure that a and b remain stable during the operation. bool operator==( const int a, const int b ) interface { extend_stability a, b; discern a, b; implementation; transfer_stability result; discern result;0 码力 | 134 页 | 1.30 MB | 5 月前3A (Short) Tour of C++ Modules
MODULES a short recap 5source.cpp library.h translation unit object file library.h library interface library.cpp library.h library implementation library object file 6 . 1 some header.h other export module library; library interface unit module library; library implementation library implementation object file import library; program library interface object file 7 . 1 export .. declarations macros compiler options predefined, commandline defaults, commandline none module interface unit files object file BMI file discarded 7 . 2// mod.h #pragma once; struct S { int value0 码力 | 62 页 | 4.20 MB | 5 月前3Neighborhoods Banding Together: Reasoning Globally about Programs
void foo() implementation { … … … bar(); … … … } void bar() interface { … …prologue … implementation; … …epilogue … } void foo() interface { … …prologue … implementation; … …epilogue … } See “The Truth Procedure”void foo() implementation { … … … bar(); … … … } void bar() interface { … …prologue … implementation; … …epilogue … } void foo() interface { … …prologue … implementation; … …epilogue … } 🙂 😈 🙂 interactions with low-complexity algorithms.fits many functions Indirect caller’s interface int Nondecreasing( const int x ) interface { claim usable( x ); implementation; claim x <= result; claim usable(0 码力 | 49 页 | 1.03 MB | 5 月前3C++20 Modules: The Packaging and Binary Redistribution Story
to locate and load the binary module interface (BMI) 👇:Binary module interfaces export module fmt; export namespace fmt { … } fmt.cc fmt.o Module interface unit Other file extensions: .ixx (msvc) pcm BMI file extensions: .pcm (clang) .gcm (gcc) .ifc (msvc) BMI: Binary module interface libfmt.aModule interface unit export module fmt; export namespace fmt { … } import fmt; int main() { delta.cxx foxtrot.cxx golf.cxx alpha.o bravo.o charlie.o delta.o foxtrot.o golf.o Module interface units need to be compiled before any of the importers import fmt; fmt.cxx fmt.pcm fmt.oCompilation0 码力 | 76 页 | 2.09 MB | 5 月前3Object Oriented Programming
final Template method Destructor Interfaces Liskov substitution principle Inheritance (interface versus implemenation) Covariant return type Duck Typing Traps Virtual in con- /destructor final Template method Destructor Interfaces Liskov substitution principle Inheritance (interface versus implemenation) Covariant return type Duck Typing Traps Virtual in con- /destructor its members and member functions from the outside world. Information hiding Separation from interface and implementationObject-Oriented Programming Key Ideas Class Inheritance Polymorphism Early0 码力 | 38 页 | 752.99 KB | 5 月前3Custom Views for the Rest of Us
requires std::ranges::forward_rangeclass all_pairs_view : public std::ranges::view_interface > // CRTP! { private: TBase _vw; public: class iterator { /* ... */ requires std::ranges::forward_range class all_pairs_view : public std::ranges::view_interface > // CRTP! { private: TBase _vw; public: class iterator { /* ... */ all_pairs_view all_pairs_view : : public public std::ranges::view_interface > std::ranges::view_interface > // CRTP! // CRTP! 1 2 3 { 4 private: 5 0 码力 | 187 页 | 13.25 MB | 5 月前3COMPOSABLE C++
composabilitySO WE HAVE AN INTERFACE SO WE HAVE AN INTERFACE What classes should we write to this interface, to enable higher-level composability? What classes should we write to this interface, to enable higher-level just that interface, we can implement: With just that interface, we can implement:CASE STUDY: ALLOCATORS CASE STUDY: ALLOCATORS With just that interface, we can implement: With just that interface, we can fails, try B)CASE STUDY: ALLOCATORS CASE STUDY: ALLOCATORS With just that interface, we can implement: With just that interface, we can implement: fallback allocator (try A, if it fails, try B) stack allocatorCASE0 码力 | 124 页 | 8.28 MB | 5 月前3Plug-in Based Software Architecture for Robotics
4Components of plugin architecture 1. Core - Defines how the system operates and provides interface 2. Plugins - Stand-alone independent components that contain implementation of core application’s Reduce dependencies in the core system 6Why use plugin architecture? ● More testable code ○ Interface can be mocked to test core system ○ Plugins can be individually tested ● Simplifies integration functionality ● Given start and end robot state, create a motion plan 11Core System contains the Interface class #pragma once #include#include namespace motion planner { struct 0 码力 | 75 页 | 2.40 MB | 5 月前3Breaking Dependencies: The SOLID Principles
Principle Interface Segregation Principle Dependency Inversion Principle9 The SOLID Principles Single-Responsibility Principle Open-Closed Principle Liskov Substitution Principle Interface Segregation Guideline: Make sure to adhere to the required concept.63 Questions?64 The Interface Segregation Principle (ISP)65 The Interface Segregation Principle (ISP) ”Clients should not be forced to depend on methods Martin, Agile Software Development)66 The Interface Segregation Principle (ISP) ”Many client specific interfaces are better than one general-purpose interface.” (Wikipedia)class Shape { public:0 码力 | 96 页 | 2.14 MB | 5 月前3
共 213 条
- 1
- 2
- 3
- 4
- 5
- 6
- 22
相关搜索词
DynamicallyLoadedLibrariesOutsidetheStandardWhyLoopsEndShortTourofC++ModulesNeighborhoodsBandingTogetherReasoningGloballyaboutPrograms20ThePackagingandBinaryRedistributionStoryObjectOrientedProgrammingCustomViewsforRestUsCOMPOSABLEPluginBasedSoftwareArchitectureRoboticsBreakingDependenciesSOLIDPrinciples