#ifndef __matrix_hh__
#define __matrix_hh__

#ifndef USE_omniORB_logStream
#define USE_omniORB_logStream
#endif

#ifndef __CORBA_H_EXTERNAL_GUARD__
#define __CORBA_H_EXTERNAL_GUARD__
#include <omniORB2/CORBA.h>
#endif

#ifdef _LC_attr
# error "A local CPP macro _LC_attr has already been defined."
#else
# ifdef  USE_stub_in_nt_dll
#  define _LC_attr _OMNIORB_NTDLL_IMPORT
# else
#  define _LC_attr
# endif
#endif

typedef _CORBA_Unbounded_Sequence_w_FixSizeElement<CORBA::Double,8,8> Row;
typedef _CORBA_Sequence_Var<Row, CORBA::Double > Row_var;

typedef _CORBA_Unbounded_Sequence_w_FixSizeElement<CORBA::Double,8,8> Column;
typedef _CORBA_Sequence_Var<Column, CORBA::Double > Column_var;

#ifndef __Matrix__
#define __Matrix__
class   Matrix;
typedef Matrix* Matrix_ptr;
typedef Matrix_ptr MatrixRef;

class Matrix_Helper {
  public:
  static Matrix_ptr _nil();
  static CORBA::Boolean is_nil(Matrix_ptr p);
  static void release(Matrix_ptr p);
  static void duplicate(Matrix_ptr p);
  static size_t NP_alignedSize(Matrix_ptr obj,size_t initialoffset);
  static void marshalObjRef(Matrix_ptr obj,NetBufferedStream &s);
  static Matrix_ptr unmarshalObjRef(NetBufferedStream &s);
  static void marshalObjRef(Matrix_ptr obj,MemBufferedStream &s);
  static Matrix_ptr unmarshalObjRef(MemBufferedStream &s);
};
typedef _CORBA_ObjRef_Var<Matrix,Matrix_Helper> Matrix_var;

#endif
#define Matrix_IntfRepoID "IDL:Matrix:1.0"

class Matrix : public virtual omniObject, public virtual CORBA::Object {
public:

  typedef _CORBA_Unbounded_Sequence<_CORBA_Unbounded_Sequence_w_FixSizeElement<CORBA::Double,8,8> > rep;
  typedef _CORBA_Sequence_Var<rep, _CORBA_Unbounded_Sequence_w_FixSizeElement<CORBA::Double,8,8> > rep_var;

  virtual Column * block_product(CORBA::ULong  first, CORBA::ULong  last, const Column & c) = 0;
  static Matrix_ptr _duplicate(Matrix_ptr);
  static Matrix_ptr _narrow(CORBA::Object_ptr);
  static Matrix_ptr _nil();

  static inline size_t NP_alignedSize(Matrix_ptr obj,size_t initialoffset) {
    return CORBA::AlignedObjRef(obj,Matrix_IntfRepoID,15,initialoffset);
  }

  static inline void marshalObjRef(Matrix_ptr obj,NetBufferedStream &s) {
    CORBA::MarshalObjRef(obj,Matrix_IntfRepoID,15,s);
  }

  static inline Matrix_ptr unmarshalObjRef(NetBufferedStream &s) {
    CORBA::Object_ptr _obj = CORBA::UnMarshalObjRef(Matrix_IntfRepoID,s);
    Matrix_ptr _result = Matrix::_narrow(_obj);
    CORBA::release(_obj);
    return _result;
  }

  static inline void marshalObjRef(Matrix_ptr obj,MemBufferedStream &s) {
    CORBA::MarshalObjRef(obj,Matrix_IntfRepoID,15,s);
  }

  static inline Matrix_ptr unmarshalObjRef(MemBufferedStream &s) {
    CORBA::Object_ptr _obj = CORBA::UnMarshalObjRef(Matrix_IntfRepoID,s);
    Matrix_ptr _result = Matrix::_narrow(_obj);
    CORBA::release(_obj);
    return _result;
  }

  static CORBA::Boolean _0RL_is_a(const char *base_repoId);

protected:

  Matrix() {
    if (!is_proxy())
      omniObject::PR_IRRepositoryId(Matrix_IntfRepoID);
    this->PR_setobj(this);
  }
  virtual ~Matrix() {}
  virtual void *_widenFromTheMostDerivedIntf(const char *repoId,CORBA::Boolean is_cxx_type_id=0);

private:

  Matrix(const Matrix&);
  Matrix &operator=(const Matrix&);
};

class _sk_Matrix :  public virtual Matrix {
public:

  _sk_Matrix() {}
  _sk_Matrix(const omniORB::objectKey& k);
  virtual ~_sk_Matrix() {}
  Matrix_ptr _this() { return Matrix::_duplicate(this); }
  void _obj_is_ready(CORBA::BOA_ptr boa) { boa->obj_is_ready(this); }
  CORBA::BOA_ptr _boa() { return CORBA::BOA::getBOA(); }
  void _dispose() { _boa()->dispose(this); }
  omniORB::objectKey _key();
  virtual Column * block_product(CORBA::ULong  first, CORBA::ULong  last, const Column & c) = 0;
  virtual CORBA::Boolean dispatch(GIOP_S &s,const char *op,CORBA::Boolean response);

protected:
  virtual void *_widenFromTheMostDerivedIntf(const char *repoId,CORBA::Boolean is_cxx_type_id) {
    return Matrix::_widenFromTheMostDerivedIntf(repoId,is_cxx_type_id);
  }
private:
  _sk_Matrix (const _sk_Matrix&);
  _sk_Matrix &operator=(const _sk_Matrix&);
};

class _proxy_Matrix :  public virtual Matrix {
public:

  _proxy_Matrix (Rope *r,CORBA::Octet *key,size_t keysize,IOP::TaggedProfileList *profiles,CORBA::Boolean release) :
    omniObject(Matrix_IntfRepoID,r,key,keysize,profiles,release) {
      omni::objectIsReady(this);
  }
  virtual ~_proxy_Matrix() {}
  virtual Column * block_product(CORBA::ULong  first, CORBA::ULong  last, const Column & c);

protected:

  _proxy_Matrix () {}

  virtual void *_widenFromTheMostDerivedIntf(const char *repoId,CORBA::Boolean is_cxx_type) {
    return Matrix::_widenFromTheMostDerivedIntf(repoId,is_cxx_type);
  }
private:

  _proxy_Matrix (const _proxy_Matrix&);
  _proxy_Matrix &operator=(const _proxy_Matrix&);
};

class _nil_Matrix : public virtual Matrix {
public:
  _nil_Matrix() : omniObject(omniObject::nilObjectManager()) { this->PR_setobj(0); }
  virtual ~_nil_Matrix() {}
  Column * block_product(CORBA::ULong  first, CORBA::ULong  last, const Column & c){
    throw CORBA::BAD_OPERATION(0,CORBA::COMPLETED_NO);
#ifdef NEED_DUMMY_RETURN
    // never reach here! Dummy return to keep some compilers happy.
    Column * _0RL_result = 0;
    return _0RL_result;
#endif
  }

protected:
  virtual void *_widenFromTheMostDerivedIntf(const char *repoId,CORBA::Boolean is_cxx_type_id) {
    return Matrix::_widenFromTheMostDerivedIntf(repoId,is_cxx_type_id);
  }
};

class Matrix_proxyObjectFactory : public proxyObjectFactory {
public:
  Matrix_proxyObjectFactory () {}
  virtual ~Matrix_proxyObjectFactory () {}
  virtual const char *irRepoId() const;
  virtual CORBA::Object_ptr newProxyObject(Rope *r,CORBA::Octet *key,size_t keysize,IOP::TaggedProfileList *profiles,CORBA::Boolean release);
  virtual CORBA::Boolean is_a(const char *base_repoId) const;
  static Matrix_ptr _nil() {
    if (!__nil_Matrix) {
      __nil_Matrix = new _nil_Matrix;
    }
    return __nil_Matrix;
  }
private:
  static Matrix_ptr __nil_Matrix;
};


#undef _LC_attr

#endif // __matrix_hh__
