diff --git a/new/design.h b/new/design.h new file mode 100644 index 0000000000..969b5a8516 --- /dev/null +++ b/new/design.h @@ -0,0 +1,492 @@ + + +// This file describes the early phases of some new classes which may +// eventually be used to implement a distributed library system. + +// Designer and copyright holder: Dick Hollenbeck + + +typedef std::string STRING; +typedef std::vector< STRING > STRINGS; + + +const STRING StrEmpty = ""; + + +/** + * Class PART + * will have to be unified with what Wayne is doing. I want a separate copy + * here until I can get the state management correct. Since a PART only lives + * within a cache called a LIBRARY, its constructor is private (only a LIBRARY + * can instantiate one), and it exists in various states of freshness and + * completeness relative to the LIBRARY_SOURCE within the LIBRARY. + */ +class PART +{ + /// LIBRARY class has great license to modify what's in here, nobody else does. + /// Modification is done through the LIBRARY so it can track the state of the + /// PART and take action as needed. Actually most of the modification will + /// be done by PARTS_LIST, a class derived from LIBRARY. + friend class LIBRARY; + + + /// a private constructor, only a LIBRARY can instantiate one. + PART() {} + + +protected: // not likely to have descendants, but protected none-the-less. + + LIBRARY* owner; ///< which LIBRARY am I a part of (pun if you want) + STRING extends; ///< LPID of base part + + STRING name; ///< example "passives/R", immutable. + + /// s-expression text for the part, initially empty, and read in as this part + /// actually becomes cached in RAM. + STRING body; + + // lots of other stuff. + + +public: + + /** + * Function Inherit + * is a specialized assignment function that copies a specific subset, enough + * to fulfill the requirements of the sweet s-expression language. + */ + void Inherit( const PART& aBasePart ); + +}; + + +/** + * Class LPID (aka GUID) + * is a Logical Part ID and consists of various portions much like a URI. It + * relies heavily on a logical library name to hide where actual physical library + * sources reside. Its static functions serve as managers of the library table to + * map logical library names to actual library sources. + *

+ * Example LPID string: + * "kicad:passives/R/rev6". + *

+ *

+ *

+ * This class owns the library table, which is like fstab in concept and maps logical + * library name to library URI, type, and password. It has the following columns: + *

+ *

+ * For now, the Library Type can be one of: + *