Back to index

salome-kernel  6.5.0
SALOMEDSImpl_AttributeTableOfString.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SALOME SALOMEDSImpl : data structure of SALOME and sources of Salome data server 
00024 //  File   : SALOMEDSImpl_AttributeTableOfString.hxx
00025 //  Author : Sergey Ruin
00026 //  Module : SALOME
00027 //
00028 #ifndef _SALOMEDSImpl_AttributeTableOfString_HeaderFile
00029 #define _SALOMEDSImpl_AttributeTableOfString_HeaderFile
00030 
00031 #include "SALOMEDSImpl_Defines.hxx"
00032 #include "DF_Label.hxx"       
00033 #include "DF_Attribute.hxx"
00034 #include "SALOMEDSImpl_GenericAttribute.hxx"
00035 #include "SALOMEDSImpl_AttributeTable.hxx"
00036 
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 
00041 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeTableOfString : 
00042   public SALOMEDSImpl_GenericAttribute, public SALOMEDSImpl_AttributeTable
00043 {
00044 
00045 public:
00046   virtual std::string       Save();
00047   virtual void              Load(const std::string&); 
00048 
00049   static const std::string& GetID();
00050   static SALOMEDSImpl_AttributeTableOfString* Set(const DF_Label& label);
00051 
00052   SALOMEDSImpl_AttributeTableOfString();
00053   void                     SetNbColumns(const int theNbColumns);
00054   void                     SetTitle(const std::string& theTitle);
00055   std::string              GetTitle() const;
00056   void                     SetRowData(const int theRow, const std::vector<std::string>& theData);
00057   std::vector<std::string> GetRowData(const int theRow);
00058   void                     SetRowTitle(const int theRow, const std::string& theTitle);
00059   void                     SetRowUnit(const int theRow, const std::string& theUnit);
00060   std::string              GetRowUnit(const int theRow) const;
00061   void                     SetRowUnits(const std::vector<std::string>& theUnits);
00062   std::vector<std::string> GetRowUnits();
00063   void                     SetRowTitles(const std::vector<std::string>& theTitles);
00064   std::vector<std::string> GetRowTitles();
00065   std::string              GetRowTitle(const int theRow) const;
00066   void                     SetColumnData(const int theColumn, const std::vector<std::string>& theData);
00067   std::vector<std::string> GetColumnData(const int theColumn);
00068   void                     SetColumnTitle(const int theColumn, const std::string& theTitle);
00069   std::string              GetColumnTitle(const int theColumn) const;
00070   void                     SetColumnTitles(const std::vector<std::string>& theTitles);
00071   std::vector<std::string> GetColumnTitles();
00072   int                      GetNbRows() const;
00073   int                      GetNbColumns() const;
00074 
00075   void                     PutValue(const std::string& theValue, const int theRow, const int theColumn);
00076   bool                     HasValue(const int theRow, const int theColumn);
00077   std::string              GetValue(const int theRow, const int theColumn);
00078   void                     RemoveValue(const int theRow, const int theColumn);
00079   const std::string&       ID() const;
00080   void                     Restore(DF_Attribute* with);
00081   DF_Attribute*            NewEmpty() const;
00082   void                     Paste(DF_Attribute* into);
00083 
00084   std::vector<int>         GetSetRowIndices(const int theRow);
00085   std::vector<int>         GetSetColumnIndices(const int theColumn);
00086 
00087   std::vector<int>         SortRow(const int theRow, SortOrder sortOrder, SortPolicy sortPolicy);
00088   std::vector<int>         SortColumn(const int theColumn, SortOrder sortOrder, SortPolicy sortPolicy);
00089   std::vector<int>         SortByRow(const int theRow, SortOrder sortOrder, SortPolicy sortPolicy);
00090   std::vector<int>         SortByColumn(const int theColumn, SortOrder sortOrder, SortPolicy sortPolicy);
00091 
00092   void                     SwapCells(const int theRow1, const int theColumn1, const int theRow2, const int theColumn2);
00093   void                     SwapRows(const int theRow1, const int theRow2);
00094   void                     SwapColumns(const int theColumn1, const int theColumn2);
00095 
00096   ~SALOMEDSImpl_AttributeTableOfString() {}
00097 
00098 private: 
00099   std::map<int, std::string> myTable;
00100   std::string                myTitle;
00101   std::vector<std::string>   myRows;
00102   std::vector<std::string>   myCols;
00103   int                        myNbRows;
00104   int                        myNbColumns;
00105 };
00106 
00107 #endif