128 {
return ! ( lhs == rhs ); }
152 #define DEF_BUILTIN(A) \
153 namespace { static inline const IdString & a_##A () { static IdString _str(#A); return _str; } } \
154 const Arch Arch_##A( a_##A() )
242 typedef Arch::CompatEntry CompatEntry;
245 typedef std::unordered_set<CompatEntry> Set;
246 typedef Set::iterator iterator;
247 typedef Set::const_iterator const_iterator;
250 static ArchCompatSet & instance()
252 static ArchCompatSet _instance;
259 const Arch::CompatEntry & assertDef(
const std::string & archStr_r )
260 {
return *
_compatSet.insert( Arch::CompatEntry( archStr_r ) ).first; }
262 const Arch::CompatEntry & assertDef( IdString archStr_r )
263 {
return *
_compatSet.insert( Arch::CompatEntry( archStr_r ) ).first; }
265 const_iterator begin()
const
268 const_iterator end()
const
273 int operator()(
const CompatEntry & lhs,
const CompatEntry & rhs )
const
274 {
return lhs._idBit.value() < rhs._idBit.value(); }
277 std::ostream &
dumpOn( std::ostream & str )
const
279 str <<
"ArchCompatSet:";
281 ov.sort( DumpOnCompare() );
282 for_( it, ov.begin(), ov.end() )
284 str << endl <<
' ' << *it;
296 _compatSet.insert( Arch::CompatEntry( a_noarch(), 0 ) );
303 defCompatibleWith( a_i386(), a_noarch() );
304 defCompatibleWith( a_i486(), a_noarch(),a_i386() );
305 defCompatibleWith( a_i586(), a_noarch(),a_i386(),a_i486() );
306 defCompatibleWith( a_i686(), a_noarch(),a_i386(),a_i486(),a_i586() );
307 defCompatibleWith( a_athlon(), a_noarch(),a_i386(),a_i486(),a_i586(),a_i686() );
308 defCompatibleWith( a_x86_64(), a_noarch(),a_i386(),a_i486(),a_i586(),a_i686(),a_athlon() );
310 defCompatibleWith( a_pentium3(), a_noarch(),a_i386(),a_i486(),a_i586(),a_i686() );
311 defCompatibleWith( a_pentium4(), a_noarch(),a_i386(),a_i486(),a_i586(),a_i686(),a_pentium3() );
313 defCompatibleWith( a_ia64(), a_noarch(),a_i386(),a_i486(),a_i586(),a_i686() );
315 defCompatibleWith( a_s390(), a_noarch() );
316 defCompatibleWith( a_s390x(), a_noarch(),a_s390() );
318 defCompatibleWith( a_ppc(), a_noarch() );
319 defCompatibleWith( a_ppc64(), a_noarch(),a_ppc() );
320 defCompatibleWith( a_ppc64p7(), a_noarch(),a_ppc(),a_ppc64() );
322 defCompatibleWith( a_ppc64le(), a_noarch() );
324 defCompatibleWith( a_alpha(), a_noarch() );
325 defCompatibleWith( a_alphaev5(), a_noarch(),a_alpha() );
326 defCompatibleWith( a_alphaev56(), a_noarch(),a_alpha(),a_alphaev5() );
327 defCompatibleWith( a_alphapca56(), a_noarch(),a_alpha(),a_alphaev5(),a_alphaev56() );
328 defCompatibleWith( a_alphaev6(), a_noarch(),a_alpha(),a_alphaev5(),a_alphaev56(),a_alphapca56() );
329 defCompatibleWith( a_alphaev67(), a_noarch(),a_alpha(),a_alphaev5(),a_alphaev56(),a_alphapca56(),a_alphaev6() );
331 defCompatibleWith( a_sparc(), a_noarch() );
332 defCompatibleWith( a_sparcv8(), a_noarch(),a_sparc() );
333 defCompatibleWith( a_sparcv9(), a_noarch(),a_sparc(),a_sparcv8() );
334 defCompatibleWith( a_sparcv9v(), a_noarch(),a_sparc(),a_sparcv8(),a_sparcv9() );
336 defCompatibleWith( a_sparc64(), a_noarch(),a_sparc(),a_sparcv8(),a_sparcv9() );
337 defCompatibleWith( a_sparc64v(), a_noarch(),a_sparc(),a_sparcv8(),a_sparcv9(),a_sparcv9v(),a_sparc64() );
339 defCompatibleWith( a_armv3l(), a_noarch() );
340 defCompatibleWith( a_armv4l(), a_noarch(),a_armv3l() );
341 defCompatibleWith( a_armv4tl(), a_noarch(),a_armv3l(),a_armv4l() );
342 defCompatibleWith( a_armv5l(), a_noarch(),a_armv3l(),a_armv4l(),a_armv4tl() );
343 defCompatibleWith( a_armv5tl(), a_noarch(),a_armv3l(),a_armv4l(),a_armv4tl(),a_armv5l() );
344 defCompatibleWith( a_armv5tel(), a_noarch(),a_armv3l(),a_armv4l(),a_armv4tl(),a_armv5l(),a_armv5tl() );
345 defCompatibleWith( a_armv5tejl(), a_noarch(),a_armv3l(),a_armv4l(),a_armv4tl(),a_armv5l(),a_armv5tl(),a_armv5tel() );
346 defCompatibleWith( a_armv6l(), a_noarch(),a_armv3l(),a_armv4l(),a_armv4tl(),a_armv5l(),a_armv5tl(),a_armv5tel(),a_armv5tejl() );
347 defCompatibleWith( a_armv7l(), a_noarch(),a_armv3l(),a_armv4l(),a_armv4tl(),a_armv5l(),a_armv5tl(),a_armv5tel(),a_armv5tejl(),a_armv6l() );
349 defCompatibleWith( a_armv6hl(), a_noarch() );
350 defCompatibleWith( a_armv7hl(), a_noarch(),a_armv6hl() );
351 defCompatibleWith( a_armv7hnl(), a_noarch(),a_armv7hl(),a_armv6hl() );
353 defCompatibleWith( a_armv7nhl(), a_noarch(),a_armv7hnl(),a_armv7hl(),a_armv6hl() );
355 defCompatibleWith( a_armv7thl(), a_noarch(),a_armv7hl() );
356 defCompatibleWith( a_armv7tnhl(), a_noarch(),a_armv7hl(),a_armv7nhl(),a_armv7thl() );
358 defCompatibleWith( a_aarch64(), a_noarch() );
360 defCompatibleWith( a_sh3(), a_noarch() );
362 defCompatibleWith( a_sh4(), a_noarch() );
363 defCompatibleWith( a_sh4a(), a_noarch(),a_sh4() );
365 defCompatibleWith( a_m68k(), a_noarch() );
367 defCompatibleWith( a_mips(), a_noarch() );
368 defCompatibleWith( a_mipsel(), a_noarch() );
369 defCompatibleWith( a_mips64(), a_noarch() );
370 defCompatibleWith( a_mips64el(), a_noarch() );
388 ZYPP_THROW( Exception(
"Need more bits to encode architectures.") );
397 const CompatEntry & assertCompatSetEntry( IdString archStr_r )
398 {
return *
_compatSet.insert( Arch::CompatEntry( archStr_r, nextIdBit() ) ).first; }
402 void defCompatibleWith( IdString targetArch_r,
404 IdString arch1_r = IdString(),
405 IdString arch2_r = IdString(),
406 IdString arch3_r = IdString(),
407 IdString arch4_r = IdString(),
408 IdString arch5_r = IdString(),
409 IdString arch6_r = IdString(),
410 IdString arch7_r = IdString(),
411 IdString arch8_r = IdString(),
412 IdString arch9_r = IdString() )
414 const CompatEntry & target( assertCompatSetEntry( targetArch_r ) );
415 target.addCompatBit( assertCompatSetEntry( arch0_r )._idBit );
416 #define SETARG(N) if ( arch##N##_r.empty() ) return; target.addCompatBit( assertCompatSetEntry( arch##N##_r )._idBit )
445 : _entry( &ArchCompatSet::instance().assertDef( a_noarch() ) )
449 : _entry( &ArchCompatSet::instance().assertDef(
IdString(id_r) ) )
453 : _entry( &ArchCompatSet::instance().assertDef( idstr_r ) )
457 : _entry( &ArchCompatSet::instance().assertDef( str_r ) )
461 : _entry( &ArchCompatSet::instance().assertDef( cstr_r ) )
530 if ( cset.size() > 2 )
532 return *(++cset.rbegin());
554 for ( ArchCompatSet::const_iterator it = ArchCompatSet::instance().begin();
555 it != ArchCompatSet::instance().end(); ++it )
557 if ( it->compatibleWith( *targetArch_r.
_entry ) )
559 ret.insert(
Arch(*it) );
bool compatibleWith(const Arch &targetArch_r) const
Compatibility relation.
int compare(const CompatEntry &rhs) const
compare by score, then archStr.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
const std::string & asString() const
IdType id() const
Expert backdoor.
std::set< Arch, CompareByGT< Arch > > CompatSet
Reversed arch order, best Arch first.
const Arch Arch_empty(IdString::Empty)
IdString idStr() const
String representation of Arch.
Access to the sat-pools string space.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
CompatEntry(const std::string &archStr_r, CompatBits::IntT idBit_r=1)
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
int compare(const Arch &rhs) const
Arch comparison.
const CompatEntry * _entry
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
static const IdString Empty
Empty string.
sat::detail::IdType IdType
std::ostream & operator<<(std::ostream &str, const Arch::CompatEntry &obj)
void addCompatBit(const CompatBits &idBit_r) const
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
static const unsigned size
bit::BitField< uint64_t > CompatBits
Bitfield for architecture IDs and compatBits relation.
std::string numstring(char n, int w=0)
static CompatSet compatSet(const Arch &targetArch_r)
Return a set of all Arch's compatibleWith a targetArch_r.
TInt value() const
Return the value.
bool operator!=(const Arch::CompatEntry &lhs, const Arch::CompatEntry &rhs)
Arch()
Default ctor Arc_noarch.
ZYPP_DEFINE_ID_HASHABLE(zypp::Arch::CompatEntry)
bool compatibleWith(const CompatEntry &targetEntry_r) const
Return whether this is compatible with targetEntry_r.
IdString::IdType id() const
bool isBuiltIn() const
Whether this is a buitin (or known) architecture.
bool operator==(const Arch::CompatEntry &lhs, const Arch::CompatEntry &rhs)
CompatEntry(IdString archStr_r, CompatBits::IntT idBit_r=1)
Holds an architecture ID and it's compatible relation.