extern "C" IFace *RISCV_create_service(IFace *iclass, const char *name, AttributeType *args) { IClass *icls = static_cast<IClass *>(iclass); IService *iobj = icls->createService(name); iobj->initService(args); iobj->postinitService(); return iobj; }
extern "C" void RISCV_set_configuration(AttributeType *cfg) { IClass *icls; IService *iserv; Config_.clone(cfg); if (!Config_.is_dict()) { RISCV_error("Wrong configuration.", NULL); return; } AttributeType &Services = Config_["Services"]; if (Services.is_list()) { for (unsigned i = 0; i < Services.size(); i++) { icls = static_cast<IClass *>( RISCV_get_class(Services[i]["Class"].to_string())); if (icls == NULL) { RISCV_error("Class %s not found", Services[i]["Class"].to_string()); continue; } AttributeType &Instances = Services[i]["Instances"]; for (unsigned n = 0; n < Instances.size(); n++) { iserv = icls->createService(Instances[n]["Name"].to_string()); iserv->initService(&Instances[n]["Attr"]); } } } // Post initialization for (unsigned i = 0; i < listClasses_.size(); i++) { icls = static_cast<IClass *>(listClasses_[i].to_iface()); icls->postinitServices(); } RISCV_printf(getInterface(IFACE_SERVICE), 0, "%s", "\n**********************************************************\n" " RISC-V debugger\n" " Author: Sergey Khabarov - [email protected]\n" " Copyright 2016 GNSS Sensor Ltd. All right reserved.\n" "**********************************************************"); IHap *ihap; for (unsigned i = 0; i < listHap_.size(); i++) { ihap = static_cast<IHap *>(listHap_[i].to_iface()); if (ihap->getType() == HAP_ConfigDone) { ihap->hapTriggered(HAP_ConfigDone); } } }