/*
$Id: CollectArchitecture.cc 1562 2006-06-08 10:27:20Z suzuki $
*/


#include "CollectArchitecture.hh"
/////////////////////////////////////////////
CollectArchitecture::
CollectArchitecture()
{
  /*
  utsname uts;

  if( uname( &uts ) != 0 ){
    std::cout << "CollectArchitecture::CollectArchitecture" << std::endl;
    std::cout << "uname error." << std::endl;
  }

  SysName  = std::string( uts.sysname );
  NodeName = std::string( uts.nodename );
  Release  = std::string( uts.release );
  Version  = std::string( uts.version );
  Machine  = std::string( uts.machine );
  */

}
/////////////////////////////////////////////
CollectArchitecture::
~CollectArchitecture()
{
}
/////////////////////////////////////////////
std::string CollectArchitecture::
PutEndian()
{
  std::string e = "big";

  UInt4 value = 1;
  UInt4 Size  = sizeof( UInt4 );

  UChar *p;
  p = ( UChar * ) &value;

  if(      ( UInt4 )( *( p + 0 ) )        == 1 ) e = "little";
  else if( ( UInt4 )( *( p + Size - 1 ) ) == 1 ) e = "big";

  else{
    std::cout << "CollectArchitecture::PutEndian"                      << std::endl;
    std::cout << "Cannot detect the CPU architecture of this machine." << std::endl;
    std::cout << "Return Big-Endian flag. " << std::endl;
    e = "big";
  }

  return e;
}
/////////////////////////////////////////////
/*
void CollectArchitecture::
DumpAllInfo()
{
  std::cout << PutNodeName() << std::endl;
  std::cout << PutRelease()  << std::endl;
  std::cout << PutVersion()  << std::endl;
  std::cout << PutMachine()  << std::endl;
  std::cout << PutEndian()   << std::endl;
}
*/
/////////////////////////////////////////////
