STK++ 1.0
STK_DataFrame.h
Go to the documentation of this file.
00001 /*--------------------------------------------------------------------*/
00002 /*     Copyright (C) 2004-2007  Serge Iovleff
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU Lesser General Public License as
00006     published by the Free Software Foundation; either version 2 of the
00007     License, or (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU Lesser General Public License for more details.
00013 
00014     You should have received a copy of the GNU Lesser General Public
00015     License along with this program; if not, write to the
00016     Free Software Foundation, Inc.,
00017     59 Temple Place,
00018     Suite 330,
00019     Boston, MA 02111-1307
00020     USA
00021 
00022     Contact : Serge.Iovleff@stkpp.org
00023 */
00024 
00025 /*
00026  * Project:  stkpp::DManager
00027  * Purpose:  Define the DataFrame class.
00028  * Author:   Serge Iovleff, serge.iovleff@stkpp.org
00029  *
00030  **/
00031 
00036 #ifndef STK_DATAFRAME_H
00037 #define STK_DATAFRAME_H
00038 
00039 #include "../../Sdk/include/STK_IContainer2D.h"
00040 
00041 #include "STK_List1D.h"
00042 #include "STK_IVariable.h"
00043 
00044 namespace STK
00045 {
00056 class DataFrame : protected List1D<IVariable* >
00057                 , public IContainer2D
00058 {
00059   protected:
00061     typedef List1D<IVariable*> _BaseList;
00062 
00063   public:
00065     DataFrame();
00066 
00072     DataFrame( DataFrame const& T, bool ref = false);
00073 
00075     virtual ~DataFrame();
00076 
00078     void clear();
00079 
00081     inline IVariable* & elt(Integer const& i)
00082     { return _BaseList::elt(i);}
00083 
00085     inline IVariable* const & elt(Integer const& i) const
00086     { return _BaseList::elt(i);}
00087 
00089     DataFrame& operator=(DataFrame const& T);
00090 
00092     void shift(Integer const& cbeg =1);
00093 
00095     void shift(Integer const& rbeg, Integer const& cbeg);
00096 
00098     void popBackCols(Integer const& n);
00099 
00101     void eraseCols( Integer const& pos, Integer const& n=1);
00102 
00107     inline void swapCols(Integer j1, Integer j2)
00108     { _BaseList::swap(j1, j2);}
00109 
00113     void popBackRows(Integer const& n);
00114 
00119     void eraseRows( Integer const& pos, Integer const& n=1);
00120 
00125     void insertVariable( Integer const& pos, IVariable* const & V);
00126 
00130     void pushBackVariable( IVariable* const & V);
00131 
00133     inline void pushFrontVariable( IVariable* const & V)
00134     { insertVariable(firstCol(), V);}
00135 
00139     void insertDataFrame( Integer const& pos, const DataFrame& D);
00140 
00142     void pushBackDataFrame( DataFrame const &D);
00143 
00145     inline void pushFrontDataFrame( DataFrame const &D)
00146     { insertDataFrame(firstCol(), D);}
00147 
00149     void writeDataFrame( ostream  &os
00150                        , Integer const& left
00151                        , Integer const& right
00152                        ) const;
00153   protected:
00155     void freeMem();
00156 
00158     void freeRows();
00159 
00161     void pushBackCols(Integer const& n=1);
00162 
00164     void insertCols( Integer const& pos, Integer const& n=1);
00165 
00167     void pushBackRows(Integer const& n=1);
00168 
00170     void insertRows( Integer const& pos, Integer const& n =1);
00171 };
00172 
00177 ostream& operator<< (ostream& s, const DataFrame& V);
00178 
00179 } // Namespace STK
00180 
00181 #endif
00182 //STK_DATAFRAME_H