// This file is generated by omniidl (C++ backend)- omniORB_4_1. Do not edit.

#include "MotorControlPro.hh"
#include <omniORB4/IOP_S.h>
#include <omniORB4/IOP_C.h>
#include <omniORB4/callDescriptor.h>
#include <omniORB4/callHandle.h>
#include <omniORB4/objTracker.h>


OMNI_USING_NAMESPACE(omni)

static const char* _0RL_library_version = omniORB_4_1;



Motor_ptr Motor_Helper::_nil() {
  return ::Motor::_nil();
}

::CORBA::Boolean Motor_Helper::is_nil(::Motor_ptr p) {
  return ::CORBA::is_nil(p);

}

void Motor_Helper::release(::Motor_ptr p) {
  ::CORBA::release(p);
}

void Motor_Helper::marshalObjRef(::Motor_ptr obj, cdrStream& s) {
  ::Motor::_marshalObjRef(obj, s);
}

Motor_ptr Motor_Helper::unmarshalObjRef(cdrStream& s) {
  return ::Motor::_unmarshalObjRef(s);
}

void Motor_Helper::duplicate(::Motor_ptr obj) {
  if( obj && !obj->_NP_is_nil() )  omni::duplicateObjRef(obj);
}

Motor_ptr
Motor::_duplicate(::Motor_ptr obj)
{
  if( obj && !obj->_NP_is_nil() )  omni::duplicateObjRef(obj);
  return obj;
}

Motor_ptr
Motor::_narrow(::CORBA::Object_ptr obj)
{
  if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil();
  _ptr_type e = (_ptr_type) obj->_PR_getobj()->_realNarrow(_PD_repoId);
  return e ? e : _nil();
}


Motor_ptr
Motor::_unchecked_narrow(::CORBA::Object_ptr obj)
{
  if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil();
  _ptr_type e = (_ptr_type) obj->_PR_getobj()->_uncheckedNarrow(_PD_repoId);
  return e ? e : _nil();
}

Motor_ptr
Motor::_nil()
{
#ifdef OMNI_UNLOADABLE_STUBS
  static _objref_Motor _the_nil_obj;
  return &_the_nil_obj;
#else
  static _objref_Motor* _the_nil_ptr = 0;
  if( !_the_nil_ptr ) {
    omni::nilRefLock().lock();
    if( !_the_nil_ptr ) {
      _the_nil_ptr = new _objref_Motor;
      registerNilCorbaObject(_the_nil_ptr);
    }
    omni::nilRefLock().unlock();
  }
  return _the_nil_ptr;
#endif
}

const char* Motor::_PD_repoId = "IDL:Motor:1.0";


_objref_Motor::~_objref_Motor() {
  
}


_objref_Motor::_objref_Motor(omniIOR* ior, omniIdentity* id) :
   omniObjRef(::Motor::_PD_repoId, ior, id, 1)
   
   
{
  _PR_setobj(this);
}

void*
_objref_Motor::_ptrToObjRef(const char* id)
{
  if( id == ::Motor::_PD_repoId )
    return (::Motor_ptr) this;
  
  if( id == ::CORBA::Object::_PD_repoId )
    return (::CORBA::Object_ptr) this;

  if( omni::strMatch(id, ::Motor::_PD_repoId) )
    return (::Motor_ptr) this;
  
  if( omni::strMatch(id, ::CORBA::Object::_PD_repoId) )
    return (::CORBA::Object_ptr) this;

  return 0;
}

// Proxy call descriptor class. Mangled signature:
//  void_i_cdouble_i_cdouble_i_cdouble_i_cdouble
class _0RL_cd_b394bc3f813260ee_00000000
  : public omniCallDescriptor
{
public:
  inline _0RL_cd_b394bc3f813260ee_00000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0):
     omniCallDescriptor(lcfn, op_, oplen, 0, 0, 0, upcall)
  {
    
  }
  
  void marshalArguments(cdrStream&);
  void unmarshalArguments(cdrStream&);

    
  
  ::CORBA::Double arg_0;
  ::CORBA::Double arg_1;
  ::CORBA::Double arg_2;
  ::CORBA::Double arg_3;
};

void _0RL_cd_b394bc3f813260ee_00000000::marshalArguments(cdrStream& _n)
{
  arg_0 >>= _n;
  arg_1 >>= _n;
  arg_2 >>= _n;
  arg_3 >>= _n;

}

void _0RL_cd_b394bc3f813260ee_00000000::unmarshalArguments(cdrStream& _n)
{
  (::CORBA::Double&)arg_0 <<= _n;
  (::CORBA::Double&)arg_1 <<= _n;
  (::CORBA::Double&)arg_2 <<= _n;
  (::CORBA::Double&)arg_3 <<= _n;

}

// Local call call-back function.
static void
_0RL_lcfn_b394bc3f813260ee_10000000(omniCallDescriptor* cd, omniServant* svnt)
{
  _0RL_cd_b394bc3f813260ee_00000000* tcd = (_0RL_cd_b394bc3f813260ee_00000000*)cd;
  _impl_Motor* impl = (_impl_Motor*) svnt->_ptrToInterface(Motor::_PD_repoId);
  impl->setPDGain(tcd->arg_0, tcd->arg_1, tcd->arg_2, tcd->arg_3);


}

void _objref_Motor::setPDGain(::CORBA::Double PGainL, ::CORBA::Double PGainR, ::CORBA::Double DGainL, ::CORBA::Double DGainR)
{
  _0RL_cd_b394bc3f813260ee_00000000 _call_desc(_0RL_lcfn_b394bc3f813260ee_10000000, "setPDGain", 10);
  _call_desc.arg_0 = PGainL;
  _call_desc.arg_1 = PGainR;
  _call_desc.arg_2 = DGainL;
  _call_desc.arg_3 = DGainR;

  _invoke(_call_desc);



}
// Proxy call descriptor class. Mangled signature:
//  void
class _0RL_cd_b394bc3f813260ee_20000000
  : public omniCallDescriptor
{
public:
  inline _0RL_cd_b394bc3f813260ee_20000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0):
     omniCallDescriptor(lcfn, op_, oplen, 0, 0, 0, upcall)
  {
    
  }
  
  
    
  
  
};

// Local call call-back function.
static void
_0RL_lcfn_b394bc3f813260ee_30000000(omniCallDescriptor*, omniServant* svnt)
{
  
  _impl_Motor* impl = (_impl_Motor*) svnt->_ptrToInterface(Motor::_PD_repoId);
  impl->Start();


}

void _objref_Motor::Start()
{
  _0RL_cd_b394bc3f813260ee_20000000 _call_desc(_0RL_lcfn_b394bc3f813260ee_30000000, "Start", 6);


  _invoke(_call_desc);



}
// Local call call-back function.
static void
_0RL_lcfn_b394bc3f813260ee_40000000(omniCallDescriptor*, omniServant* svnt)
{
  
  _impl_Motor* impl = (_impl_Motor*) svnt->_ptrToInterface(Motor::_PD_repoId);
  impl->Finish();


}

void _objref_Motor::Finish()
{
  _0RL_cd_b394bc3f813260ee_20000000 _call_desc(_0RL_lcfn_b394bc3f813260ee_40000000, "Finish", 7);


  _invoke(_call_desc);



}
// Local call call-back function.
static void
_0RL_lcfn_b394bc3f813260ee_50000000(omniCallDescriptor*, omniServant* svnt)
{
  
  _impl_Motor* impl = (_impl_Motor*) svnt->_ptrToInterface(Motor::_PD_repoId);
  impl->Clear();


}

void _objref_Motor::Clear()
{
  _0RL_cd_b394bc3f813260ee_20000000 _call_desc(_0RL_lcfn_b394bc3f813260ee_50000000, "Clear", 6);


  _invoke(_call_desc);



}
// Local call call-back function.
static void
_0RL_lcfn_b394bc3f813260ee_60000000(omniCallDescriptor*, omniServant* svnt)
{
  
  _impl_Motor* impl = (_impl_Motor*) svnt->_ptrToInterface(Motor::_PD_repoId);
  impl->Stop();


}

void _objref_Motor::Stop()
{
  _0RL_cd_b394bc3f813260ee_20000000 _call_desc(_0RL_lcfn_b394bc3f813260ee_60000000, "Stop", 5);


  _invoke(_call_desc);



}
_pof_Motor::~_pof_Motor() {}


omniObjRef*
_pof_Motor::newObjRef(omniIOR* ior, omniIdentity* id)
{
  return new ::_objref_Motor(ior, id);
}


::CORBA::Boolean
_pof_Motor::is_a(const char* id) const
{
  if( omni::ptrStrMatch(id, ::Motor::_PD_repoId) )
    return 1;
  
  return 0;
}

const _pof_Motor _the_pof_Motor;

_impl_Motor::~_impl_Motor() {}


::CORBA::Boolean
_impl_Motor::_dispatch(omniCallHandle& _handle)
{
  const char* op = _handle.operation_name();

  if( omni::strMatch(op, "setPDGain") ) {

    _0RL_cd_b394bc3f813260ee_00000000 _call_desc(_0RL_lcfn_b394bc3f813260ee_10000000, "setPDGain", 10, 1);
    
    _handle.upcall(this,_call_desc);
    return 1;
  }

  if( omni::strMatch(op, "Start") ) {

    _0RL_cd_b394bc3f813260ee_20000000 _call_desc(_0RL_lcfn_b394bc3f813260ee_30000000, "Start", 6, 1);
    
    _handle.upcall(this,_call_desc);
    return 1;
  }

  if( omni::strMatch(op, "Finish") ) {

    _0RL_cd_b394bc3f813260ee_20000000 _call_desc(_0RL_lcfn_b394bc3f813260ee_40000000, "Finish", 7, 1);
    
    _handle.upcall(this,_call_desc);
    return 1;
  }

  if( omni::strMatch(op, "Clear") ) {

    _0RL_cd_b394bc3f813260ee_20000000 _call_desc(_0RL_lcfn_b394bc3f813260ee_50000000, "Clear", 6, 1);
    
    _handle.upcall(this,_call_desc);
    return 1;
  }

  if( omni::strMatch(op, "Stop") ) {

    _0RL_cd_b394bc3f813260ee_20000000 _call_desc(_0RL_lcfn_b394bc3f813260ee_60000000, "Stop", 5, 1);
    
    _handle.upcall(this,_call_desc);
    return 1;
  }


  return 0;
}

void*
_impl_Motor::_ptrToInterface(const char* id)
{
  if( id == ::Motor::_PD_repoId )
    return (::_impl_Motor*) this;
  
  if( id == ::CORBA::Object::_PD_repoId )
    return (void*) 1;

  if( omni::strMatch(id, ::Motor::_PD_repoId) )
    return (::_impl_Motor*) this;
  
  if( omni::strMatch(id, ::CORBA::Object::_PD_repoId) )
    return (void*) 1;
  return 0;
}

const char*
_impl_Motor::_mostDerivedRepoId()
{
  return ::Motor::_PD_repoId;
}

POA_Motor::~POA_Motor() {}

