Main Page Class Hierarchy Compound List File List Compound Members File Members

# BestFitNoCheckSelector Class Reference

Inheritance diagram for BestFitNoCheckSelector

[legend]
Collaboration diagram for BestFitNoCheckSelector:

[legend]
List of all members.

## Public Methods
Use* | operate (Use* ref_use, Use* new_use)

## Member Function Documentation

Use * BestFitNoCheckSelector::operate ( | Use * ref_use,
| Use * new_use )`[virtual]`

| Reimplemented from VersionSelector. Definition at line 2523 of file cmt_use.cxx.
    02524 {
    02525   Use* selected = ref_use;
    02526
    02527   int old_v = -1;
    02528   int old_r = -1;
    02529   int old_p = -1;
    02530   cmt_string old_pp;
    02531
    02532   int new_v = -1;
    02533   int new_r = -1;
    02534   int new_p = -1;
    02535   cmt_string new_pp;
    02536
    02537   int alias_v = -1;
    02538   int alias_r = -1;
    02539   int alias_p = -1;
    02540   cmt_string alias_pp;
    02541
    02542   enum { no_alias, new_has_alias, ref_has_alias } has_alias = no_alias;
    02543
    02544   CmtSystem::is_version_directory (ref_use->version, old_v, old_r, old_p);
    02545   old_pp = ref_use->path;
    02546
    02547   CmtSystem::is_version_directory (new_use->version, new_v, new_r, new_p);
    02548   new_pp = new_use->path;
    02549
    02550   if (new_use->version_alias != "")
    02551     {
    02552       has_alias = new_has_alias;
    02553       CmtSystem::is_version_directory (new_use->version_alias,
    02554                                        alias_v, alias_r, alias_p);
    02555       alias_pp = new_use->path_alias;
    02556     }
    02557   else if (ref_use->version_alias != "")
    02558     {
    02559       has_alias = ref_has_alias;
    02560       CmtSystem::is_version_directory (ref_use->version_alias,
    02561                                        alias_v, alias_r, alias_p);
    02562       alias_pp = ref_use->path_alias;
    02563     }
    02564
    02565   ref_use->undiscard ();
    02566   new_use->undiscard ();
    02567
    02568   if (new_v != old_v)
    02569     {
    02570       if (has_alias != no_alias)
    02571         {
    02572           if (has_alias == new_has_alias)
    02573             {
    02574               new_v = alias_v;
    02575               new_r = alias_r;
    02576               new_p = alias_p;
    02577               new_pp = alias_pp;
    02578             }
    02579           else if (has_alias == ref_has_alias)
    02580             {
    02581               old_v = alias_v;
    02582               old_r = alias_r;
    02583               old_p = alias_p;
    02584               old_pp = alias_pp;
    02585             }
    02586         }
    02587     }
    02588
    02589   if (new_v < old_v)
    02590     {
    02591       if (!Cmt::get_quiet ())
    02592         {
    02593           cout << "# Keep version " << ref_use->version <<
    02594             " of package " << ref_use->package <<
    02595             " (ignore version " << new_use->version << ")" <<
    02596             endl;
    02597         }
    02598
    02599       if (ref_use != new_use) new_use->discard ();
    02600     }
    02601   else if (new_v > old_v)
    02602     {
    02603       if (!Cmt::get_quiet ())
    02604         {
    02605           cout << "# Select version " << new_use->version <<
    02606             " of package " << ref_use->package <<
    02607             " instead of existing " << ref_use->version <<
    02608             endl;
    02609         }
    02610
    02611       if (ref_use != new_use) ref_use->discard ();
    02612       selected = new_use;
    02613       selected->done = false; // Will read the new requirements
    02614     }
    02615   else if (new_r < old_r)
    02616     {
    02617       if (!Cmt::get_quiet ())
    02618         {
    02619           cout << "# keep release " << ref_use->version <<
    02620             " of package " << ref_use->package <<
    02621             " (ignore release " << new_use->version << ")" <<
    02622             endl;
    02623         }
    02624
    02625       if (ref_use != new_use) new_use->discard ();
    02626     }
    02627   else if (new_r > old_r)
    02628     {
    02629       if (!Cmt::get_quiet ())
    02630         {
    02631           cout << "# Select release " << new_use->version <<
    02632             " of package " << ref_use->package <<
    02633             " instead of existing " << ref_use->version <<
    02634             endl;
    02635         }
    02636
    02637       if (ref_use != new_use) ref_use->discard ();
    02638       selected = new_use;
    02639       selected->done = false; // Will read the new requirements
    02640     }
    02641   else if (new_p > old_p)
    02642     {
    02643       if (!Cmt::get_quiet ())
    02644         {
    02645           cout << "# Select patch " << new_use->version <<
    02646             " of package " << ref_use->package <<
    02647             " instead of existing " << ref_use->version <<
    02648             endl;
    02649         }
    02650
    02651       if (ref_use != new_use) ref_use->discard ();
    02652       selected = new_use;
    02653       selected->done = false; // Will read the new requirements
    02654     }
    02655   else if (new_pp != old_pp) // same version-r-p but from different path
    02656     {
    02657       if (ref_use != new_use) ref_use->discard ();
    02658       selected = new_use;
    02659       selected->done = false; // Will read the new requirements
    02660     }
    02661
    02662   return (selected);
    02663 }

The documentation for this class was generated from the following file:

- cmt_use.cxx