USGS

Isis 3.0 Application Source Code Reference

Home

Column.h

Go to the documentation of this file.
00001 #if !defined(Column_h)
00002 #define Column_h
00003 /**
00004  * @file
00005  * $Revision: 1.1 $
00006  * $Date: 2007/08/09 18:24:24 $
00007  *
00008  *   Unless noted otherwise, the portions of Isis written by the USGS are public
00009  *   domain. See individual third-party library and package descriptions for
00010  *   intellectual property information,user agreements, and related information.
00011  *
00012  *   Although Isis has been used by the USGS, no warranty, expressed or implied,
00013  *   is made by the USGS as to the accuracy and functioning of such software
00014  *   and related material nor shall the fact of distribution constitute any such
00015  *   warranty, and no responsibility is assumed by the USGS in connection
00016  *   therewith.
00017  *
00018  *   For additional information, launch
00019  *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html in a browser or see
00020  *   the Privacy & Disclaimers page on the Isis website,
00021  *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
00022  *   http://www.usgs.gov/privacy.html.
00023  */
00024 
00025 #include <vector>
00026 #include <string>
00027 
00028 namespace Isis {
00029   /**
00030    * @brief Format ascii tables
00031    * 
00032    * This class takes in a series of string vectors and writes them out to a
00033    * file as a table. Formatting options are up to the user.
00034    * 
00035    * @ingroup Utility
00036    * 
00037    * @author 2007-05-01 Brendan George
00038    * 
00039    * @internal
00040    *   @history 2007-06-18 Brendan George Fixed error message outputs and
00041    *           unitTest
00042    */
00043   class Column {
00044   public:
00045 
00046     enum Align { NoAlign = 0,
00047                  Right = 1, 
00048                  Left = 2, 
00049                  Decimal = 3 };
00050     enum Type { NoType = 0,
00051                 Integer = 1,
00052                 Real = 2,
00053                 String = 3,
00054                 Pixel = 4 };
00055     Column ();
00056     Column (std::string name, int width, Column::Type type, Align align=Column::Right);
00057     void SetName (std::string name);
00058     void SetWidth (unsigned int width);
00059     void SetType (Column::Type type);
00060     void SetAlignment (Column::Align alignment);
00061     void SetPrecision (unsigned int precision);
00062 
00063     std::string Name () {return p_name;};
00064     unsigned int Width (){return p_width;};
00065     Column::Type DataType ();
00066     Column::Align Alignment (){return p_align;};
00067     unsigned int Precision (){return p_precision;};
00068 
00069   private:
00070     std::string p_name;
00071     unsigned int p_width;
00072     Column::Type p_type;
00073     Column::Align p_align;
00074     unsigned int p_precision;
00075   };
00076 };
00077 
00078 #endif