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

📄 base.cxx

📁 eCos1.31版
💻 CXX
📖 第 1 页 / 共 5 页
字号:
}voidCdlNodeBody::get_structural_conflicts(std::vector<CdlConflict>& result) const{    CYG_REPORT_FUNCNAME("CdlNode::get_structural_conflicts");    CYG_REPORT_FUNCARG1XV(this);    CYG_PRECONDITION_THISC();    const std::list<CdlConflict>& conflicts = toplevel->get_all_structural_conflicts();    std::list<CdlConflict>::const_iterator conf_i;    for (conf_i = conflicts.begin(); conf_i != conflicts.end(); conf_i++) {        if ((*conf_i)->get_node() == this) {            result.push_back(*conf_i);        }    }    CYG_REPORT_RETURN();}voidCdlNodeBody::get_structural_conflicts(bool (*fn)(CdlConflict), std::vector<CdlConflict>& result) const{    CYG_REPORT_FUNCNAME("CdlNode::get_conflicts");    CYG_REPORT_FUNCARG2XV(this, fn);    CYG_PRECONDITION_THISC();    CYG_CHECK_FUNC_PTRC(fn);    const std::list<CdlConflict>& conflicts = toplevel->get_all_structural_conflicts();    std::list<CdlConflict>::const_iterator conf_i;    for (conf_i = conflicts.begin(); conf_i != conflicts.end(); conf_i++) {        if (((*conf_i)->get_node() == this) && ((*fn)(*conf_i))) {            result.push_back(*conf_i);        }    }        CYG_REPORT_RETURN();}//}}}//{{{  Referrers                                // ----------------------------------------------------------------------------// And access to the referrers vector.const std::vector<CdlReferrer>&CdlNodeBody::get_referrers() const{    CYG_REPORT_FUNCNAME("CdlNode::get_referrers");    CYG_REPORT_FUNCARG1XV(this);    CYG_PRECONDITION_THISC();    CYG_REPORT_RETURN();    return referrers;}//}}}//{{{  Property parsers                         // ----------------------------------------------------------------------------// Property parsing. For now there are now properties guaranteed to be// associated with every node. This may change in future, e.g.// internal debugging-related properties.voidCdlNodeBody::add_property_parsers(std::vector<CdlInterpreterCommandEntry>& parsers){    CYG_REPORT_FUNCNAME("CdlNode::add_property_parsers");    CYG_REPORT_RETURN();}voidCdlNodeBody::check_properties(CdlInterpreter interp){    CYG_REPORT_FUNCNAME("CdlNode::check_properties");    CYG_REPORT_FUNCARG2XV(this, interp);    CYG_PRECONDITION_THISC();    CYG_PRECONDITION_CLASSC(interp);    CYG_REPORT_RETURN();}//}}}//{{{  is_active() etc.                         // ----------------------------------------------------------------------------// Associated with every node is a boolean that holds the current// "active" state. Changes to this happen only at transaction// commit time.boolCdlNodeBody::is_active() const{    CYG_REPORT_FUNCNAMETYPE("CdlNode::is_active", "result %d");    CYG_REPORT_FUNCARG1XV(this);    CYG_PRECONDITION_THISC();    bool result = active;    CYG_REPORT_RETVAL(result);    return result;}boolCdlNodeBody::is_active(CdlTransaction transaction){    CYG_REPORT_FUNCNAMETYPE("CdlNode::is_active", "result %d");    CYG_REPORT_FUNCARG2XV(this, transaction);    CYG_PRECONDITION_THISC();    CYG_PRECONDITION_CLASSC(transaction);    bool result = transaction->is_active(this);    CYG_REPORT_RETVAL(result);    return result;}// This virtual member function allows nodes to check whether or not// they should be active. Derived classes may impose additional// constraints.boolCdlNodeBody::test_active(CdlTransaction transaction){    CYG_REPORT_FUNCNAMETYPE("CdlNode::test_active", "result %d");    CYG_PRECONDITION_THISC();    CYG_PRECONDITION_CLASSC(transaction);    bool result = false;    if ((0 != parent) && (transaction->is_active(parent))) {        CdlValuable valuable = dynamic_cast<CdlValuable>(parent);        if (0 == valuable) {            result = true;        } else if (valuable->is_enabled(transaction)) {            result = true;        }    }        CYG_REPORT_RETVAL(result);    return result;}//}}}//{{{  Propagation support                      // ----------------------------------------------------------------------------// In the base class nothing needs doing for propagation.voidCdlNodeBody::update(CdlTransaction transaction, CdlUpdate change){    CYG_REPORT_FUNCNAME("CdlNode::update");    CYG_REPORT_FUNCARG1XV(this);    CYG_PRECONDITION_THISC();    CYG_PRECONDITION_CLASSC(transaction);        CYG_REPORT_RETURN();}//}}}//{{{  Persistence support                      // ----------------------------------------------------------------------------// The CdlNode::save() member should never get invoked directly, it should// get invoked indirectly from e.g. CdlOption::save(). Normally there is// no information associated with a node that ends up in a save file// (the calling code will have take care of the name etc.). However there// is support in the library for storing application-specific data in the// save file, for example GUI information, and this information must be// preserved even if it is not recognised. Savefiles are self-describing,// they contain details of all the commands that are applicable. // CdlNode::save() is responsible for outputting the unrecognised strings// to the save file.voidCdlNodeBody::save(CdlInterpreter interp, Tcl_Channel chan, int indentation, bool minimal)    throw(CdlInputOutputException, std::bad_alloc){    CYG_REPORT_FUNCNAME("CdlNode::save");    CYG_REPORT_FUNCARG5XV(this, interp, chan, indentation, minimal);    if (unsupported_savefile_strings.size() != 0) {        // We should already be inside the body of a suitable command,        // e.g. cdl_option xyz { ... }        // CdlToplevel::savefile_handle_unsupported() is responsible for        // putting suitably formatted strings into the        // unsupported_savefile_strings vector, so all that is needed here        // is to dump those strings to the channel.        std::string data = "\n";        std::vector<std::string>::const_iterator str_i;        for (str_i = unsupported_savefile_strings.begin(); str_i != unsupported_savefile_strings.end(); str_i++) {            data += std::string(indentation, ' ') + *str_i + " ;\n";        }        interp->write_data(chan, data);    }    CYG_UNUSED_PARAM(bool, minimal);    CYG_REPORT_RETURN();}boolCdlNodeBody::has_additional_savefile_information() const{    CYG_REPORT_FUNCNAMETYPE("CdlNode::has_additional_savefile_information", "result %d");    CYG_REPORT_FUNCARG1XV(this);    CYG_PRECONDITION_THISC();    bool result = (0 != unsupported_savefile_strings.size());    CYG_REPORT_RETVAL(result);    return result;}//}}}//{{{  check_this()                             // ----------------------------------------------------------------------------// Because of multiple and virtual inheritance, check_this() may// get called rather a lot. Unfortunately all of the checks are// useful.boolCdlNodeBody::check_this(cyg_assert_class_zeal zeal) const{    if (CdlNodeBody_Magic != cdlnodebody_cookie) {        return false;    }    CYGDBG_MEMLEAK_CHECKTHIS();        if ("" == name) {        return false;    }    // It is hard to validate the toplevel, owner, and parent    // fields.    //    // 1) when a node is newly created all three fields will    //    be null.    // 2) the toplevel may be null if the node is in the process    //    of being removed, e.g. during an unload operation.    //    The node should still have a valid owner, and will    //    have a parent unless the node is also the loadable.    // 3) some nodes are special, e.g. the orphans container,    //    and do not have an owner.    //    // So the following combinations can occur:    //  Toplevel   Owner    Parent    //     0         0         0          Creation & toplevel    //     0       Valid       0          Loadable being unloaded    //     0       Valid     Valid        Node being unloaded    //   Valid       0       Valid        Orphans container    //   Valid     Valid     Valid        Any node    if (0 != toplevel) {        if (0 == parent) {            return false;        }    }     switch(zeal) {      case cyg_system_test :      case cyg_extreme     :      {        if ((0 != toplevel) && (toplevel != this)) {            if (!toplevel->check_this(cyg_quick)) {                return false;            }            if (toplevel->lookup_table.find(name) == toplevel->lookup_table.end()) {                return false;            }        }        if (0 != parent) {            if (!parent->check_this(cyg_quick)) {                return false;            }            if (std::find(parent->contents.begin(), parent->contents.end(), this) == parent->contents.end()) {                return false;            }        }        if (0 != owner) {            if (!owner->check_this(cyg_quick)) {                return false;            }            if (std::find(owner->owned.begin(), owner->owned.end(), this) == owner->owned.end()) {                return false;            }        }        std::vector<CdlProperty>::const_iterator prop_i;        for (prop_i = properties.begin(); prop_i != properties.end(); prop_i++) {            if (!(*prop_i)->check_this(cyg_quick)) {                return false;            }        }        std::vector<CdlReferrer>::const_iterator ref_i;        for (ref_i = referrers.begin(); ref_i != referrers.end(); ref_i++) {            if (!ref_i->check_this(cyg_quick)) {                return false;            }        }      }      case cyg_thorough    :      case cyg_quick       :      case cyg_trivial     :      case cyg_none        :      default              :          break;    }    return true;}//}}}//}}}//{{{  CdlContainerBody                 //{{{  Constructors                     // ----------------------------------------------------------------------------// A container simply holds other nodes in a hierarchy. Most// containers correspond to data in CDL scripts, but there are// exceptions. For example, if an option is reparented below some// package or component that is not yet known then it can instead be// reparented into an "orphans" container immediately below the// toplevel.//// Adding and removing entries to a container is done inside the// CdlToplevel add_node() and remove_node() members. These will update// all the fields needed to keep the hierarchy consistent. This// means that the CdlContainer class itself provides only limited// functionality.CdlContainerBody::CdlContainerBody(){    CYG_REPORT_FUNCNAME("CdlContainer:: default constructor");    CYG_REPORT_FUNCARG1XV(this);    cdlcontainerbody_cookie = CdlContainerBody_Magic;    CYGDBG_MEMLEAK_CONSTRUCTOR();        CYG_POSTCONDITION_THISC();    CYG_REPORT_RETURN();}// This variant is for internal use, to allow the library to create// containers that do not correspond to CDL entities such as// the orphans container.CdlContainerBody::CdlContainerBody(std::string name_arg)    : CdlNodeBody(name_arg){    CYG_REPORT_FUNCNAME("CdlContainerBody:: constructor (name)");    CYG_REPORT_FUNCARG1XV(this);    cdlcontainerbody_cookie = CdlContainerBody_Magic;    CYGDBG_MEMLEAK_CONSTRUCTOR();    CYG_POSTCONDITION_THISC();    CYG_REPORT_RETURN();}//}}}//{{{  Destructor                       // ----------------------------------------------------------------------------CdlContainerBody::~CdlContainerBody(){    CYG_REPORT_FUNCNAME("CdlContainer:: destructor");    CYG_REPORT_FUNCARG1XV(this);    CYG_PRECONDITION_THISC();    // Containers should always be empty by the time they    // get deleted. The toplevel and loadable destructors should    // guarantee this.    CYG_ASSERTC(0 == contents.size());        cdlcontainerbody_cookie = CdlContainerBody_Invalid;    CYGDBG_MEMLEAK_DESTRUCTOR();        CYG_REPORT_RETURN();}//}}}//{{{  Accessing the contents           // ----------------------------------------------------------------------------// Simple contents access facilities, including searching. Note that// the toplevel class maintains a <name,ptr> map, which will usually// be more efficient.

⌨️ 快捷键说明

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