⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config.cxx

📁 eCos1.31版
💻 CXX
📖 第 1 页 / 共 5 页
字号:
                                             CdlDiagnosticFnPtr error_fn, CdlDiagnosticFnPtr warn_fn, bool limbo)    throw(CdlInputOutputException, CdlParseException, std::bad_alloc){    CYG_REPORT_FUNCNAME("CdlConfiguration::change_package_version");    CYG_REPORT_FUNCARG1XV(this);    CdlLocalTransaction transaction(this);    this->change_package_version(transaction.get(), name, version, error_fn, warn_fn, limbo);    transaction.body();    CYG_REPORT_RETURN();}voidCdlConfigurationBody::change_package_version(CdlPackage package, std::string version,                                             CdlDiagnosticFnPtr error_fn, CdlDiagnosticFnPtr warn_fn, bool limbo)    throw(CdlInputOutputException, CdlParseException, std::bad_alloc){    CYG_REPORT_FUNCNAME("CdlConfiguration::change_package_version");    CYG_REPORT_FUNCARG1XV(this);    CdlLocalTransaction transaction(this);    this->change_package_version(transaction.get(), package, version, error_fn, warn_fn, limbo);    transaction.body();    CYG_REPORT_RETURN();}voidCdlConfigurationBody::change_package_version(CdlTransaction transaction, std::string name, std::string new_version,                                             CdlDiagnosticFnPtr error_fn, CdlDiagnosticFnPtr warn_fn, bool limbo)    throw(CdlInputOutputException, CdlParseException, std::bad_alloc){    CYG_REPORT_FUNCNAME("CdlConfiguration::change_package_version");    CYG_REPORT_FUNCARG2XV(this, transaction);    CYG_PRECONDITION_THISC();    CYG_PRECONDITION_CLASSC(transaction);    CYG_PRECONDITIONC("" != name);    CdlPackage package = 0;    CdlNode node = this->lookup(name);    if (0 != node) {        package = dynamic_cast<CdlPackage>(node);    }    // For now it is illegal to change the version of package that has    // not been loaded yet    CYG_ASSERT_CLASSC(package);        this->change_package_version(transaction, package, new_version, error_fn, warn_fn, limbo);    CYG_REPORT_RETURN();}voidCdlConfigurationBody::add(std::string filename,                          CdlDiagnosticFnPtr error_fn, CdlDiagnosticFnPtr warn_fn)    throw(CdlInputOutputException, CdlParseException, std::bad_alloc){    CYG_REPORT_FUNCNAME("CdlConfiguration::add");    CYG_REPORT_FUNCARG1XV(this);    CdlLocalTransaction transaction(this);    this->add(transaction.get(), filename, error_fn, warn_fn);    transaction.body();    CYG_REPORT_RETURN();}voidCdlConfigurationBody::set_template(std::string name, std::string version,                                   CdlDiagnosticFnPtr error_fn, CdlDiagnosticFnPtr warn_fn, bool limbo)    throw(CdlInputOutputException, CdlParseException, std::bad_alloc){    CYG_REPORT_FUNCNAME("CdlConfiguration::set_template");    CYG_REPORT_FUNCARG1XV(this);    CdlLocalTransaction transaction(this);    this->set_template(transaction.get(), name, version, error_fn, warn_fn, limbo);    transaction.body();    CYG_REPORT_RETURN();}voidCdlConfigurationBody::set_template_file(std::string filename,                                        CdlDiagnosticFnPtr error_fn, CdlDiagnosticFnPtr warn_fn, bool limbo)    throw(CdlInputOutputException, CdlParseException, std::bad_alloc){    CYG_REPORT_FUNCNAME("CdlConfiguration::set_template_file");    CYG_REPORT_FUNCARG1XV(this);    CdlLocalTransaction transaction(this);    this->set_template_file(transaction.get(), filename, error_fn, warn_fn, limbo);    transaction.body();    CYG_REPORT_RETURN();}voidCdlConfigurationBody::set_template(CdlTransaction transaction, std::string template_name, std::string version,                                   CdlDiagnosticFnPtr error_fn, CdlDiagnosticFnPtr warn_fn, bool limbo)    throw(CdlInputOutputException, CdlParseException, std::bad_alloc){    CYG_REPORT_FUNCNAME("CdlConfiguration::set_template");    CYG_REPORT_FUNCARG2XV(this, transaction);    // Some consistency checks before doing anything damaging    if (!this->database->is_known_template(template_name)) {        throw CdlInputOutputException("Unknown template " + template_name);    }    std::string template_filename = this->database->get_template_filename(template_name, version);    if ("" == template_filename) {        if ("" == version) {            throw CdlInputOutputException("There is no template file corresponding to " + template_name);        } else {            throw CdlInputOutputException("There is no temmplate file corresponding to version "                                          + version + " of " + template_name);        }    }    // Now use set_template_file() to do the hard work.    this->set_template_file(transaction, template_filename, error_fn, warn_fn, limbo);    current_template = template_name;    CYG_REPORT_RETURN();}voidCdlConfigurationBody::unload_template(bool limbo){    CYG_REPORT_FUNCNAME("CdlConfiguration::unload_template");    CYG_REPORT_FUNCARG1XV(this);    CdlLocalTransaction transaction(this);    this->unload_template(transaction.get(), limbo);    transaction.body();    CYG_REPORT_RETURN();}voidCdlConfigurationBody::set_hardware(std::string name,                                   CdlDiagnosticFnPtr error_fn, CdlDiagnosticFnPtr warn_fn, bool limbo)    throw(CdlInputOutputException, CdlParseException, std::bad_alloc){    CYG_REPORT_FUNCNAME("CdlConfiguration::set_hardware");    CYG_REPORT_FUNCARG1XV(this);    CdlLocalTransaction transaction(this);    this->set_hardware(transaction.get(), name, error_fn, warn_fn, limbo);    transaction.body();    CYG_REPORT_RETURN();}voidCdlConfigurationBody::unload_hardware(bool limbo){    CYG_REPORT_FUNCNAME("CdlConfiguration::unload_hardware");    CYG_REPORT_FUNCARG1XV(this);    CdlLocalTransaction transaction(this);    this->unload_hardware(transaction.get(), limbo);    transaction.body();    CYG_REPORT_RETURN();}//}}}//{{{  Load and unload - transaction support            // ----------------------------------------------------------------------------// A number of commit/cancel auxiliary classes are needed to allow the// load/unload code to integrate properly with the transaction code.class CdlConfiguration_CommitCancelLoad :    public CdlTransactionCommitCancelOp{    friend class CdlTest;  public:    CdlConfiguration_CommitCancelLoad(CdlPackage package_arg)        : CdlTransactionCommitCancelOp()    {        CYG_ASSERT_CLASSC(package_arg);        package = package_arg;    }    ~CdlConfiguration_CommitCancelLoad()    {        package = 0;    }    void commit(CdlTransaction transaction)    {        CYG_ASSERT_CLASSC(package);        CdlLoadableBody::transaction_commit_load(transaction, package);        package = 0;    }    void cancel(CdlTransaction transaction)    {        CYG_ASSERT_CLASSC(package);        CdlLoadableBody::transaction_cancel_load(transaction, package);        package = 0;    }      protected:      private:    CdlConfiguration_CommitCancelLoad()    {    }    CdlPackage  package;};class CdlConfiguration_CommitCancelUnload :    public CdlTransactionCommitCancelOp{    friend class CdlTest;  public:    CdlConfiguration_CommitCancelUnload(CdlPackage package_arg)        : CdlTransactionCommitCancelOp()    {        CYG_ASSERT_CLASSC(package_arg);        package = package_arg;    }    ~CdlConfiguration_CommitCancelUnload()    {        package = 0;    }    void commit(CdlTransaction transaction)    {        CYG_PRECONDITION_CLASSC(package);        CdlLoadableBody::transaction_commit_unload(transaction, package);        package = 0;    }    void cancel(CdlTransaction transaction)    {        CYG_PRECONDITION_CLASSC(package);        CdlLoadableBody::transaction_cancel_unload(transaction, package);        package = 0;    }  protected:  private:    CdlConfiguration_CommitCancelUnload()    {    }    CdlPackage package;};// These utility classes can be used to control the hardware and// template names. If the transaction is cancelled the previous// name gets re-installedclass CdlConfiguration_CommitCancelHardwareName :    public CdlTransactionCommitCancelOp{    friend class CdlTest;      public:    CdlConfiguration_CommitCancelHardwareName(std::string old_name_arg)        : CdlTransactionCommitCancelOp()    {        old_name = old_name_arg;    }    ~CdlConfiguration_CommitCancelHardwareName()    {        old_name = "";    }    void commit(CdlTransaction transaction)    {        // The new name is already installed, nothing more needs to happen.        CYG_UNUSED_PARAM(CdlTransaction, transaction);    }    void cancel(CdlTransaction transaction)    {        // Restore the old name        CdlToplevel toplevel = transaction->get_toplevel();        CYG_ASSERTC(0 != toplevel);        CdlConfiguration configuration = dynamic_cast<CdlConfiguration>(toplevel);        CYG_ASSERT_CLASSC(configuration);        configuration->set_hardware_name(old_name);        CYG_UNUSED_PARAM(CdlTransaction, transaction);    }      protected:  private:    CdlConfiguration_CommitCancelHardwareName()    {    }    std::string old_name;};class CdlConfiguration_CommitCancelTemplateName :    public CdlTransactionCommitCancelOp{    friend class CdlTest;      public:    CdlConfiguration_CommitCancelTemplateName(std::string old_name_arg)        : CdlTransactionCommitCancelOp()    {        old_name = old_name_arg;    }    ~CdlConfiguration_CommitCancelTemplateName()    {        old_name = "";    }    void commit(CdlTransaction transaction)    {        // The new name is already installed, nothing more needs to happen.        CYG_UNUSED_PARAM(CdlTransaction, transaction);    }    void cancel(CdlTransaction transaction)    {        // Restore the old name        CdlToplevel toplevel = transaction->get_toplevel();        CYG_ASSERTC(0 != toplevel);        CdlConfiguration configuration = dynamic_cast<CdlConfiguration>(toplevel);        CYG_ASSERT_CLASSC(configuration);        configuration->set_template_name(old_name);        CYG_UNUSED_PARAM(CdlTransaction, transaction);    }      protected:  private:    CdlConfiguration_CommitCancelTemplateName()    {    }    std::string old_name;};//}}}//{{{  CdlConfiguration::load_package()                 // ----------------------------------------------------------------------------// Loading a package into the current level. This involves the following// stages.////  1) check that the specified package name and version is valid, by//     comparing it with the database. When the database was created there//     will have been checks to make sure that the initial CDL script was//     present, but more checks can be done here.////  2) before allocating any resources, check that there is no name conflict//     for the package itself.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -