// This may look like C code, but it is really -*- C++ -*-
// Adaptateur d objets (pour NamedObjMgr) 
// pour les classes TMatrix<T>, TVector<T> de Sophya
//                                      Reza 11/99
//  LAL-IN2P3/CNRS               CEA-DAPNIA     
 
#ifndef NOMTARRAYADAPTER_H_SEEN
#define NOMTARRAYADAPTER_H_SEEN

#include "nomgadapter.h"
#include "tarray.h"

//---------------------------------------------------------------
// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet TArray 
//---------------------------------------------------------------

template <class T> 
class NOMAdapter_TArray : public NObjMgrAdapter {
public:
				NOMAdapter_TArray(TArray<T>* m = NULL);
  virtual			~NOMAdapter_TArray();

  virtual NObjMgrAdapter*	Clone(AnyDataObj* o);

  virtual string		GetDataObjType();

  virtual AnyDataObj*		CloneDataObj(bool share=false);

// Returns a string with synthetic information about the object 
// opts : additional optional argument 
  virtual string                GetInfoString(vector<string>& opts);
// Perform an operation on the object definded 
// opts : operation definition 
  virtual int                   PerformOperation(vector<string>& opts);

  virtual void			SavePPF(POutPersist& s, string const & nom);

  virtual void			Print(ostream& os, int lev=0);
  virtual PIDrawer*		GetDrawer(string& dopt);
  virtual P2DArrayAdapter*	Get2DArray(string& dopt);
  virtual NTupleInterface*	GetNTupleInterface(bool& adel);

protected:
  TArray<T>* mArr;
};

// Class Interface NTuple pour TArray<T>

template <class T> 
class NTupInt_TArray : public NTupleInterface {
public:
			NTupInt_TArray(TArray<T>* m);
  virtual		~NTupInt_TArray();
  virtual sa_size_t     NbLines() const ;
  virtual sa_size_t     NbColumns() const ;
  virtual r_8		GetCell(sa_size_t n, sa_size_t k) const ;
  virtual sa_size_t     ColumnIndex(string const & nom)  const ;
  virtual void		GetMinMax(sa_size_t k, double& min, double& max)   const ; 
  virtual r_8 *         GetLineD(sa_size_t n) const ;
  virtual string        VarList_C(const char* nomx=NULL) const ;
protected:
  TArray<T>* mArr;
  mutable r_8 mRet[11];
};


#endif
