#ifndef DOMAIN_COMDEL_GENERATOR_H #define DOMAIN_COMDEL_GENERATOR_H #include "library.h" #include "schema.h" #include #include #include #include #include namespace domain { struct ComdelContext { std::vector attributes; std::vector wires; std::string name; bool inComponent; bool inConnection; bool inSingleAutomaticConnection; bool inBus; ComdelContext(std::string name, bool inComponent, bool inConnection, bool inSingleAutomaticConnection, bool inBus); bool doesAttributeExists(std::string name, Value::ValueType type); bool doesWireExists(std::string name); }; class SchemaCreator { std::vector context; std::string name; std::string libraryInfo; std::string header; std::string componentDirectory; std::optional componentHeader = nullopt; std::vector addressSpaces; std::vector components; std::vector buses; std::vector connections; std::map messages; std::vector errors; std::vector validators; std::optional loadAddressSpace(AddressSpaceNode node); std::optional loadComponent(ComponentNode node); std::optional loadAttribute(AttributeNode node); std::optional loadRule(RuleNode node); std::optional loadCondition(ConditionNode node); std::optional loadPopup(PopupNode node, std::string name, Value::ValueType type); std::optional loadDisplay(DisplayNode node); std::optional loadWire(WireNode node); std::optional loadPin(PinNode pins); PinConnection loadPinConnection(PinConnectionNode node); std::optional loadConnection(ConnectionNode node); std::optional loadBus(BusNode node); std::shared_ptr loadComponentInstance(InstanceNode instance, Library &library); std::shared_ptr loadBusInstance(InstanceNode instance, Library &library); std::optional getBus(std::string name); std::optional getComponentPin(std::string name, std::string pin); bool hasAddressSpace(std::string name); void push(ComdelContext context); void pushAdditional(std::string name); ComdelContext ¤t(); void pop(); std::optional createMemoryAttribute(); vector createWireEnumeration(vector enumeration); std::optional createMemoryPopup(); public: explicit SchemaCreator(std::vector validators); std::vector getErrors(); std::optional loadLibrary(LibraryNode node); Schema *loadSchema(SchemaNode node, Library &library); }; } // namespace domain #endif // DOMAIN_COMDEL_GENERATOR_H