00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://svn.east.isi.edu/torc/trunk/src/torc/architecture/Versions.hpp $ 00003 // $Id: Versions.hpp 479 2011-06-05 04:04:54Z nsteiner $ 00004 00005 // This program is free software: you can redistribute it and/or modify it under the terms of the 00006 // GNU General Public License as published by the Free Software Foundation, either version 3 of the 00007 // License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00010 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 00011 // the GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along with this program. If 00014 // not, see <http://www.gnu.org/licenses/>. 00015 00016 /// \file 00017 /// \brief Header for the Versions class. 00018 00019 #ifndef TORC_ARCHITECTURE_VERSIONS_HPP 00020 #define TORC_ARCHITECTURE_VERSIONS_HPP 00021 00022 #include "torc/architecture/XilinxDatabaseTypes.hpp" 00023 #include "torc/architecture/DigestStream.hpp" 00024 #include "torc/common/DottedVersion.hpp" 00025 00026 namespace torc { 00027 namespace architecture { 00028 00029 // forward declaration of our unit test class within its namespace 00030 namespace architecture { class DigestStreamUnitTest; } 00031 00032 /// \brief Encapsulation of database version information. 00033 /// \details The format version information determines if and how DDB should read the database. 00034 /// The vendor vesion information indicates the version of the vendor tools that the 00035 /// database was generated from. 00036 class Versions { 00037 // friends 00038 /// \brief The database has access to our protected functions. 00039 friend class DDB; 00040 /// \brief The DigestStream unit test has access to our protected functions. 00041 friend class torc::architecture::architecture::DigestStreamUnitTest; 00042 protected: 00043 // types 00044 typedef std::string string; ///< \brief Imported type name. 00045 typedef boost::uint8_t uint8_t; ///< \brief Imported type name. 00046 typedef boost::uint16_t uint16_t; ///< \brief Imported type name. 00047 typedef boost::uint32_t uint32_t; ///< \brief Imported type name. 00048 typedef torc::common::DottedVersion DottedVersion; ///< \brief Imported type name. 00049 // nested classes 00050 protected: 00051 // members 00052 /// \brief The database format version. 00053 DottedVersion mFormat; 00054 /// \brief The database build number. 00055 uint32_t mBuild; 00056 /// \brief The vendor data version. 00057 DottedVersion mVendor; 00058 /// \brief The vendor data version string. 00059 string mVendorString; 00060 // functions 00061 /// \brief Read the version information. 00062 size_t readVersions(DigestStream& inStream, bool inShowVersion = false); 00063 // constructors 00064 /// \brief Protected constructor. 00065 Versions(void) : mFormat(), mBuild(0), mVendor(), mVendorString() {} 00066 public: 00067 // accessors 00068 /// \brief Returns the database format version. 00069 const DottedVersion& getFormat(void) const { return mFormat; } 00070 /// \brief Returns the database build number. 00071 uint32_t getBuild(void) const { return mBuild; } 00072 /// \brief Returns the vendor data version. 00073 const DottedVersion& getVendor(void) const { return mVendor; } 00074 /// \brief Returns the database format version string. 00075 const string& getVendorString(void) const { return mVendorString; } 00076 }; 00077 00078 } // namespace architecture 00079 } // namespace torc 00080 00081 #endif // TORC_ARCHITECTURE_VERSIONS_HPP