128 {
return ! ( lhs == rhs ); }
152 #define DEF_BUILTIN(A) \
153 namespace { static inline const IdString & _##A () { static IdString __str(#A); return __str; } } \
154 const Arch Arch_##A( _##A() )
233 typedef Arch::CompatEntry CompatEntry;
236 typedef std::tr1::unordered_set<CompatEntry> Set;
237 typedef Set::iterator iterator;
238 typedef Set::const_iterator const_iterator;
241 static ArchCompatSet & instance()
243 static ArchCompatSet _instance;
250 const Arch::CompatEntry & assertDef(
const std::string & archStr_r )
251 {
return *
_compatSet.insert( Arch::CompatEntry( archStr_r ) ).first; }
253 const Arch::CompatEntry & assertDef( IdString archStr_r )
254 {
return *
_compatSet.insert( Arch::CompatEntry( archStr_r ) ).first; }
256 const_iterator begin()
const
259 const_iterator end()
const
264 int operator()(
const CompatEntry & lhs,
const CompatEntry & rhs )
const
265 {
return lhs._idBit.value() < rhs._idBit.value(); }
268 std::ostream &
dumpOn( std::ostream &
str )
const
270 str <<
"ArchCompatSet:";
272 ov.sort( DumpOnCompare() );
273 for_( it, ov.begin(), ov.end() )
275 str << endl <<
' ' << *it;
287 _compatSet.insert( Arch::CompatEntry( _noarch(), 0 ) );
294 defCompatibleWith( _i386(), _noarch() );
295 defCompatibleWith( _i486(), _noarch(),_i386() );
296 defCompatibleWith( _i586(), _noarch(),_i386(),_i486() );
297 defCompatibleWith( _i686(), _noarch(),_i386(),_i486(),_i586() );
298 defCompatibleWith( _athlon(), _noarch(),_i386(),_i486(),_i586(),_i686() );
299 defCompatibleWith( _x86_64(), _noarch(),_i386(),_i486(),_i586(),_i686(),_athlon() );
301 defCompatibleWith( _pentium3(), _noarch(),_i386(),_i486(),_i586(),_i686() );
302 defCompatibleWith( _pentium4(), _noarch(),_i386(),_i486(),_i586(),_i686(),_pentium3() );
304 defCompatibleWith( _ia64(), _noarch(),_i386(),_i486(),_i586(),_i686() );
306 defCompatibleWith( _s390(), _noarch() );
307 defCompatibleWith( _s390x(), _noarch(),_s390() );
309 defCompatibleWith( _ppc(), _noarch() );
310 defCompatibleWith( _ppc64(), _noarch(),_ppc() );
311 defCompatibleWith( _ppc64p7(), _noarch(),_ppc(),_ppc64() );
313 defCompatibleWith( _ppc64le(), _noarch() );
315 defCompatibleWith( _alpha(), _noarch() );
316 defCompatibleWith( _alphaev5(), _noarch(),_alpha() );
317 defCompatibleWith( _alphaev56(), _noarch(),_alpha(),_alphaev5() );
318 defCompatibleWith( _alphapca56(), _noarch(),_alpha(),_alphaev5(),_alphaev56() );
319 defCompatibleWith( _alphaev6(), _noarch(),_alpha(),_alphaev5(),_alphaev56(),_alphapca56() );
320 defCompatibleWith( _alphaev67(), _noarch(),_alpha(),_alphaev5(),_alphaev56(),_alphapca56(),_alphaev6() );
322 defCompatibleWith( _sparc(), _noarch() );
323 defCompatibleWith( _sparcv8(), _noarch(),_sparc() );
324 defCompatibleWith( _sparcv9(), _noarch(),_sparc(),_sparcv8() );
325 defCompatibleWith( _sparcv9v(), _noarch(),_sparc(),_sparcv8(),_sparcv9() );
327 defCompatibleWith( _sparc64(), _noarch(),_sparc(),_sparcv8(),_sparcv9() );
328 defCompatibleWith( _sparc64v(), _noarch(),_sparc(),_sparcv8(),_sparcv9(),_sparcv9v(),_sparc64() );
330 defCompatibleWith( _armv3l(), _noarch() );
331 defCompatibleWith( _armv4l(), _noarch(),_armv3l() );
332 defCompatibleWith( _armv4tl(), _noarch(),_armv3l(),_armv4l() );
333 defCompatibleWith( _armv5l(), _noarch(),_armv3l(),_armv4l(),_armv4tl() );
334 defCompatibleWith( _armv5tel(), _noarch(),_armv3l(),_armv4l(),_armv4tl(),_armv5l() );
335 defCompatibleWith( _armv5tejl(), _noarch(),_armv3l(),_armv4l(),_armv4tl(),_armv5l(),_armv5tel() );
336 defCompatibleWith( _armv6l(), _noarch(),_armv3l(),_armv4l(),_armv4tl(),_armv5l(),_armv5tel(),_armv5tejl() );
337 defCompatibleWith( _armv6hl(), _noarch() );
338 defCompatibleWith( _armv7l(), _noarch(),_armv3l(),_armv4l(),_armv4tl(),_armv5l(),_armv5tel(),_armv5tejl(),_armv6l() );
339 defCompatibleWith( _armv7hl(), _noarch(),_armv6hl() );
340 defCompatibleWith( _armv7nhl(), _noarch(),_armv7hl() );
341 defCompatibleWith( _armv7thl(), _noarch(),_armv7hl() );
342 defCompatibleWith( _armv7tnhl(), _noarch(),_armv7hl(),_armv7nhl(),_armv7thl() );
343 defCompatibleWith( _aarch64(), _noarch() );
345 defCompatibleWith( _sh3(), _noarch() );
347 defCompatibleWith( _sh4(), _noarch() );
348 defCompatibleWith( _sh4a(), _noarch(),_sh4() );
350 defCompatibleWith(_m68k(), _noarch());
368 ZYPP_THROW( Exception(
"Need more bits to encode architectures.") );
377 const CompatEntry & assertCompatSetEntry( IdString archStr_r )
378 {
return *
_compatSet.insert( Arch::CompatEntry( archStr_r, nextIdBit() ) ).first; }
382 void defCompatibleWith( IdString targetArch_r,
384 IdString arch1_r = IdString(),
385 IdString arch2_r = IdString(),
386 IdString arch3_r = IdString(),
387 IdString arch4_r = IdString(),
388 IdString arch5_r = IdString(),
389 IdString arch6_r = IdString(),
390 IdString arch7_r = IdString(),
391 IdString arch8_r = IdString(),
392 IdString arch9_r = IdString() )
394 const CompatEntry & target( assertCompatSetEntry( targetArch_r ) );
395 target.addCompatBit( assertCompatSetEntry( arch0_r )._idBit );
396 #define _SETARG(N) if ( arch##N##_r.empty() ) return; target.addCompatBit( assertCompatSetEntry( arch##N##_r )._idBit )
425 : _entry( &ArchCompatSet::instance().assertDef( _noarch() ) )
429 : _entry( &ArchCompatSet::instance().assertDef(
IdString(id_r) ) )
433 : _entry( &ArchCompatSet::instance().assertDef( idstr_r ) )
437 : _entry( &ArchCompatSet::instance().assertDef( str_r ) )
441 : _entry( &ArchCompatSet::instance().assertDef( cstr_r ) )
510 if ( cset.size() > 2 )
512 return *(++cset.rbegin());
534 for ( ArchCompatSet::const_iterator it = ArchCompatSet::instance().begin();
535 it != ArchCompatSet::instance().end(); ++it )
537 if ( it->compatibleWith( *targetArch_r.
_entry ) )
539 ret.insert(
Arch(*it) );
_IntT value() const
Return the value.
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)
String related utilities and Regular expression matching.
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)
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.
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)
static const unsigned size
Easy-to use interface to the ZYPP dependency resolver.
CompatEntry(IdString archStr_r, CompatBits::IntT idBit_r=1)
Holds an architecture ID and it's compatible relation.