Back to index

salome-kernel  6.5.0
SALOMEDSImpl_AttributeTableOfInteger.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_AttributeTableOfInteger.hxx
00025 //  Author : Michael Ponikarov
00026 //  Module : SALOME
00027 //
00028 #ifndef _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile
00029 #define _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile
00030 
00031 #include "SALOMEDSImpl_Defines.hxx"
00032 #include "DF_Attribute.hxx"
00033 #include "DF_Label.hxx"   
00034 #include "SALOMEDSImpl_GenericAttribute.hxx"
00035 #include "SALOMEDSImpl_AttributeTable.hxx"
00036 
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 
00041 
00042 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeTableOfInteger :
00043   public SALOMEDSImpl_GenericAttribute, public SALOMEDSImpl_AttributeTable
00044 {
00045 
00046 public:
00047   virtual std::string       Save();
00048   virtual void              Load(const std::string&); 
00049   
00050   static const std::string& GetID();
00051   static SALOMEDSImpl_AttributeTableOfInteger* Set(const DF_Label& label);
00052   
00053   SALOMEDSImpl_AttributeTableOfInteger();
00054 
00055   void                     SetNbColumns(const int theNbColumns);
00056   void                     SetTitle(const std::string& theTitle);
00057   std::string              GetTitle() const;
00058   void                     SetRowData(const int theRow, const std::vector<int>& theData);
00059   std::vector<int>         GetRowData(const int theRow);
00060   void                     SetRowTitle(const int theRow, const std::string& theTitle);
00061   void                     SetRowUnit(const int theRow, const std::string& theUnit);
00062   std::string              GetRowUnit(const int theRow) const;
00063   void                     SetRowUnits(const std::vector<std::string>& theUnits);
00064   std::vector<std::string> GetRowUnits();
00065   void                     SetRowTitles(const std::vector<std::string>& theTitles);
00066   std::vector<std::string> GetRowTitles();
00067   std::string              GetRowTitle(const int theRow) const;
00068   void                     SetColumnData(const int theColumn, const std::vector<int>& theData);
00069   std::vector<int>         GetColumnData(const int theColumn);
00070   void                     SetColumnTitle(const int theColumn, const std::string& theTitle);
00071   std::string              GetColumnTitle(const int theColumn) const;
00072   void                     SetColumnTitles(const std::vector<std::string>& theTitles);
00073   std::vector<std::string> GetColumnTitles();
00074   int                      GetNbRows() const;
00075   int                      GetNbColumns() const;
00076 
00077   void                     PutValue(const int theValue, const int theRow, const int theColumn);
00078   bool                     HasValue(const int theRow, const int theColumn);
00079   int                      GetValue(const int theRow, const int theColumn);
00080   void                     RemoveValue(const int theRow, const int theColumn);
00081   const std::string&       ID() const;
00082   void                     Restore(DF_Attribute* with);
00083   DF_Attribute*            NewEmpty() const;
00084   void                     Paste(DF_Attribute* into);
00085 
00086   std::vector<int>         GetSetRowIndices(const int theRow);
00087   std::vector<int>         GetSetColumnIndices(const int theColumn);
00088 
00089   std::vector<int>         SortRow(const int theRow, SortOrder sortOrder, SortPolicy sortPolicy);
00090   std::vector<int>         SortColumn(const int theColumn, SortOrder sortOrder, SortPolicy sortPolicy);
00091   std::vector<int>         SortByRow(const int theRow, SortOrder sortOrder, SortPolicy sortPolicy);
00092   std::vector<int>         SortByColumn(const int theColumn, SortOrder sortOrder, SortPolicy sortPolicy);
00093 
00094   void                     SwapCells(const int theRow1, const int theColumn1, const int theRow2, const int theColumn2);
00095   void                     SwapRows(const int theRow1, const int theRow2);
00096   void                     SwapColumns(const int theColumn1, const int theColumn2);
00097 
00098   ~SALOMEDSImpl_AttributeTableOfInteger() {}
00099 
00100 private: 
00101   std::map<int, int>       myTable;
00102   std::string              myTitle;
00103   std::vector<std::string> myRows;
00104   std::vector<std::string> myCols;
00105   int                      myNbRows;
00106   int                      myNbColumns;
00107 };
00108 
00109 #endif