UtilityServices.h

Go to the documentation of this file.
00001 /*
00002  * The information in this file is
00003  * Copyright(c) 2007 Ball Aerospace & Technologies Corporation
00004  * and is subject to the terms and conditions of the
00005  * GNU Lesser General Public License Version 2.1
00006  * The license text is available from   
00007  * http://www.gnu.org/licenses/lgpl.html
00008  */
00009 
00010 #ifndef _UTILITYSERVICES_H
00011 #define _UTILITYSERVICES_H
00012 
00013 #include "ColorType.h"
00014 #include "DateTime.h"
00015 #include "MessageLogMgr.h"
00016 #include "Progress.h"
00017 #include "Service.h"
00018 
00019 #include <string>
00020 
00021 /**
00022  *  \ingroup ServiceModule
00023  *  Provides access to data objects not available in the object factory
00024  *  as well as other miscellaneous routines.
00025  *
00026  *  Access to instantiation of Utilities objects found
00027  *  in the Interfaces. These are inherited from Serializable,
00028  *  and therefore cannot be created with the ObjectFactory.
00029  *
00030  *  @see        ObjectFactory
00031  */
00032 class UtilityServices
00033 {
00034 public:
00035    /**
00036     *  Instantiate an object that can be used with the
00037     *  DateTime interface.
00038     *
00039     *  @return  Pointer to an object publicizing the DateTime
00040     *           interface.
00041     */
00042    virtual DateTime* getDateTime() = 0;
00043 
00044    /**
00045     *  Delete an object that can be used with the
00046     *  DateTime interface.
00047     *
00048     *  @param   dt
00049     *           Pointer to an object publicizing the DateTime
00050     *           interface.
00051     */
00052    virtual void destroyDateTime(DateTime* dt) = 0;
00053 
00054    /**
00055     *  Instantiate an object that can be used with the
00056     *  Progress interface.
00057     *
00058     *  @param   threadSafe
00059     *           should a thread safe Progress be created?
00060     *           This is needed for background plugins.
00061     *           If the plugin is not running in the background, you
00062     *           should use a non-thread safe version as there
00063     *           is less overhead
00064     *
00065     *  @return  Pointer to an object publicizing the DateTime
00066     *           interface.
00067     */
00068    virtual Progress* getProgress(bool threadSafe=false) = 0;
00069 
00070    /**
00071     *  Delete an object that can be used with the
00072     *  Progress interface.
00073     *
00074     *  @param   prog
00075     *           Pointer to an object publicizing the Progress
00076     *           interface.
00077     */
00078    virtual void destroyProgress(Progress* prog) = 0;
00079 
00080    /**
00081     *  Returns a pointer to the MessageLogMgr singleton.
00082     *
00083     *  @return  Pointer to the MessageLogMgr singleton.
00084     */
00085    virtual MessageLogMgr* getMessageLog() const = 0;
00086 
00087    /**
00088     *  Returns the number of processors on the computer.
00089     *
00090     *  @return  The number of processors on the computer.
00091     */
00092    virtual unsigned int getNumProcessors() const = 0;
00093 
00094    /**
00095     *  Returns the default classification level, based on the value in
00096     *  the first row of the SecurityMarkings/Classification.txt file.
00097     *
00098     *  @return the default classification level.
00099     */
00100    virtual std::string getDefaultClassification() const = 0;
00101 
00102    /**
00103     *  Returns the file control security codes.
00104     *
00105     *  @return  The file control security codes.
00106     */
00107    virtual const std::vector<std::string>& getFileControls() const = 0;
00108 
00109    /**
00110     *  Returns the file downgrade security codes.
00111     *
00112     *  @return  The file downgrade security codes.
00113     */
00114    virtual const std::vector<std::string>& getFileDowngrades() const = 0;
00115 
00116    /**
00117     *  Returns the declassification type security codes.
00118     *
00119     *  @return  The declassification type security codes.
00120     */
00121    virtual const std::vector<std::string>& getDeclassificationTypes() const = 0;
00122 
00123    /**
00124     *  Returns the classification reason security codes.
00125     *
00126     *  @return  The classification reason security codes.
00127     */
00128    virtual const std::vector<std::string>& getClassificationReasons() const = 0;
00129 
00130    /**
00131     *  Returns the declassification exemptions security codes.
00132     *
00133     *  @return  The declassification exemptions security codes.
00134     */
00135    virtual const std::vector<std::string>& getDeclassificationExemptions() const = 0;
00136 
00137    /**
00138     *  Returns the file releasing security codes.
00139     *
00140     *  @return  The file releasing security codes.
00141     */
00142    virtual const std::vector<std::string>& getFileReleasing() const = 0;
00143 
00144    /**
00145     *  Returns the country code security codes.
00146     *
00147     *  @return  The country code security codes.
00148     */
00149    virtual const std::vector<std::string>& getCountryCodes() const = 0;
00150 
00151    /**
00152     *  Returns the system security codes.
00153     *
00154     *  @return  The system security codes.
00155     */
00156    virtual const std::vector<std::string>& getSystems() const = 0;
00157 
00158    /**
00159     *  Returns the codeword security codes.
00160     *
00161     *  @return  The codeword security codes.
00162     */
00163    virtual const std::vector<std::string>& getCodewords() const = 0;
00164 
00165    /**
00166     *  Provides a color taken from a color table
00167     *
00168     *  This method returns a ColorType from an autocolor.clu file based on the index
00169     *
00170     *  @param   color_index
00171     *           The index value of the color in the autocolor file.
00172     *
00173     *  @return  The color in the autocolor file.  A red ColorType is returned if
00174     *           there is a failure.
00175     */
00176    virtual ColorType getAutoColor(int color_index) const = 0;
00177 
00178    /**
00179     *  Returns the size of the largest free contiguous memory block.
00180     *
00181     *  Windows fragments memory with DLL's statically mapped throughout
00182     *  the process space.  This method walks the virtual memory and 
00183     *  determine the largest contiguous free block of memory.  UNIX
00184     *  platforms do not have this limitation and for UNIX this method returns
00185     *  the available virtual memory.
00186     *
00187     *  @return  The size of the largest block possible in bytes.
00188     */
00189    virtual size_t getMaxMemoryBlockSize() = 0;
00190 
00191    /**
00192     *  Returns the total amount of physical memory.
00193     *
00194     *  @return  The amount of total physical memory in bytes.
00195     */
00196    virtual size_t getTotalPhysicalMemory() = 0;
00197 
00198    /**
00199     *  Returns the current amount of available virtual memory.
00200     *
00201     *  @return  The amount of free virtual memory in bytes.
00202     */
00203    virtual size_t getAvailableVirtualMemory() = 0;
00204 
00205    /**
00206     *  Returns the contents of a file as text.
00207     *  This method also works with the Qt resource system, provided that the resource can be read as text.
00208     *
00209     *  @param   filename 
00210     *           The name of the file to read.
00211     *           This file must be a text file.
00212     *
00213     *  @return  The contents of the file or an error message if the file could not be opened.
00214     */
00215    virtual std::string getTextFromFile(const std::string& filename) = 0;
00216 
00217 protected:
00218    /**
00219     * This will be cleaned up during application close.  Plug-ins do not
00220     * need to destroy it.
00221     */
00222    virtual ~UtilityServices() {}
00223 };
00224 
00225 #endif

Software Development Kit - Opticks 4.9.0 Build 16218