//
//  Factory.h
//
//  Factory class for cloning objects
//
//  David Burgess
//  March 2000
//


#ifndef FACTORY_H
#define FACTORY_H


#include "QObject.h"
#include "QdString.h"
#include "QdTime.h"
#include "Numeric.h"

#include "DataBuffer.h"

namespace QDOS {

#define TTAGS "Ttags"
#define DATA_PTR_NAME "Data_ptr_name"

class FactoryException : public Exception {
public:
  FactoryException( ExceptionMsg m = "" )
    : Exception( m << " [FactoryException]" ) {;} };

class Factory {

public:
  static QdObject_var clone( QdObject_var obj)
  { return obj->copy();}

  static QdString_var clone( const string& s );
  static QdString_var clone( QdString_var qs_var );
  
  static QdStringSeq_var clone( const vector<string>& s );
  static QdStringSeq_var clone( const QdStringSeq& s );
  static QdStringSeq_var clone( QdStringSeq_var qs_var );

  static QdTime_var clone( const Time& t );
  static QdTime_var clone( QdTime_var t_var );
  
  static QdTimeInterval_var clone( const TimeInterval& tintvl );
  static QdTimeInterval_var clone( QdTimeInterval_var tintvl_var );
  
  static QdTimeIntervalSeq_var clone( const TimeIntervalSeq& tintvl );
  static QdTimeIntervalSeq_var clone( QdTimeIntervalSeq_var tintvl_var );
  
  static QdTimeSeq_var clone( const TimeSeq& t );
  static QdTimeSeq_var clone( QdTimeSeq_var t_var );
   
  static QdObject_var clone( DataBuffer_var dbuff );
  static QdObject_var clone( StringDataBuffer_var sdbuff );
  static QdObject_var clone( NumericDataBuffer_var ndbuff );

  static QdRScalar_var clone( double x );
  static QdRScalar_var clone( const QdRScalar& x );
  static QdRScalar_var clone( QdRScalar_var x_var );

  static QdRScalarSeq_var clone( const vector<double>& v );
  static QdRScalarSeq_var clone( const vector<float>& v );
  static QdRScalarSeq_var clone( const vector<int>& v );
  static QdRScalarSeq_var clone( const RScalarSeq& rss );
  static QdRScalarSeq_var clone( QdRScalarSeq_var rss_var );
  
  static QdRMatrix_var clone( const RMatrix& m );
  static QdRMatrix_var clone( const QdRMatrix_var& m_var );

  static QdSMatrix_var clone( const SMatrix& sm );
  static QdSMatrix_var clone( const QdSMatrix_var& sm_var );

  static QdRMatrixSeq_var clone( const RMatrixSeq& mseq );
  static QdRMatrixSeq_var clone( const QdRMatrixSeq_var& mseq_var );

  static QdSMatrixSeq_var clone( const SMatrixSeq& smseq );
  static QdSMatrixSeq_var clone( const QdSMatrixSeq_var& smseq_var );

};

} // end namespace QDOS

#endif // #ifndef FACTORY_H

