reSIProcate/repro  9694
ReproVersion.cxx
Go to the documentation of this file.
00001 
00002 /*
00003 ** Build system provides these.
00004 ** VERSION comes from a file and is the 'marketing' version
00005 **          of repro (major.minor)
00006 ** BUILD_REV is the subversion svnversion output (lightly formatted)
00007 **           (ends in M if there are local modifications)
00008 ** RELEASE_VERSION
00009 */
00010 
00011 #include <string>
00012 
00013 #if defined(TESTDRIVER)
00014 #include <iostream>
00015 #endif
00016 
00017 #include "repro/ReproVersion.hxx"
00018 #include "repro/reproInfo.hxx"
00019 #if !defined(REPRO_BUILD_REV)
00020 # define REPRO_BUILD_REV "000000"
00021 #endif
00022 
00023 #if !defined(REPRO_BUILD_HOST)
00024 # define REPRO_BUILD_HOST "unknown.invalid"
00025 #endif
00026 
00027 #if !defined(REPRO_RELEASE_VERSION)
00028 # define REPRO_RELEASE_VERSION "0.0"
00029 #endif
00030 
00031 #if !defined(REPRO_NAME)
00032 # define REPRO_NAME "Repro"
00033 #endif
00034 
00035 
00036 
00037 namespace repro
00038 {
00039    VersionUtils::VersionUtils():
00040       mBuildHost(REPRO_BUILD_HOST),
00041       mReleaseVersion(REPRO_RELEASE_VERSION),
00042       mScmRevision(REPRO_BUILD_REV),
00043       mDisplayVersion(REPRO_NAME),
00044       mBuildStamp(REPRO_BUILD_REV)
00045    {
00046       mDisplayVersion += ' ';
00047       mDisplayVersion += mReleaseVersion;
00048       mDisplayVersion += '/';
00049 
00050       mBuildStamp += '@';
00051       mBuildStamp += mBuildHost;
00052 
00053       mDisplayVersion += mBuildStamp;
00054    }
00055 
00056    VersionUtils* VersionUtils::sVU = 0;
00057 
00058    const VersionUtils&
00059    VersionUtils::instance()
00060    {
00061       if (sVU == 0)
00062       {
00063          sVU = new VersionUtils;
00064       }
00065       return *sVU;
00066    }
00067 
00068    VersionUtils::~VersionUtils() {};
00069 
00070    const std::string&
00071    VersionUtils::buildStamp() const
00072    {
00073       return  mBuildStamp;
00074    }
00075    
00076    const std::string&
00077    VersionUtils::releaseVersion() const
00078    {
00079       return mReleaseVersion;
00080    }
00081 
00082 
00083    const std::string&
00084    VersionUtils::buildHost() const
00085    {
00086       return mBuildHost;
00087    }
00088 
00089    const std::string&
00090    VersionUtils::displayVersion() const
00091    {
00092       return mDisplayVersion;
00093    }
00094 
00095    const std::string&
00096    VersionUtils::scmRevision() const
00097    {
00098       return mScmRevision;
00099    }
00100 
00101 };
00102 
00103 
00104 #if defined(TESTDRIVER)
00105 int main()
00106 {
00107 #define T(x) std::cout << #x << " = " << repro::VersionUtils::instance().x() << std::endl;
00108    T(displayVersion);
00109    T(buildStamp);
00110    T(scmRevision);
00111    T(releaseVersion);
00112    T(buildHost);
00113    return 0;
00114 }
00115 #undef T
00116 #endif
00117 /* ====================================================================
00118  * The Vovida Software License, Version 1.0 
00119  * 
00120  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00121  * 
00122  * Redistribution and use in source and binary forms, with or without
00123  * modification, are permitted provided that the following conditions
00124  * are met:
00125  * 
00126  * 1. Redistributions of source code must retain the above copyright
00127  *    notice, this list of conditions and the following disclaimer.
00128  * 
00129  * 2. Redistributions in binary form must reproduce the above copyright
00130  *    notice, this list of conditions and the following disclaimer in
00131  *    the documentation and/or other materials provided with the
00132  *    distribution.
00133  * 
00134  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00135  *    and "Vovida Open Communication Application Library (VOCAL)" must
00136  *    not be used to endorse or promote products derived from this
00137  *    software without prior written permission. For written
00138  *    permission, please contact vocal@vovida.org.
00139  *
00140  * 4. Products derived from this software may not be called "VOCAL", nor
00141  *    may "VOCAL" appear in their name, without prior written
00142  *    permission of Vovida Networks, Inc.
00143  * 
00144  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00145  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00146  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00147  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00148  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00149  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00150  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00151  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00152  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00153  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00154  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00155  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00156  * DAMAGE.
00157  * 
00158  * ====================================================================
00159  */