/* this file was generated by the MCOP idl compiler - DO NOT EDIT */

#include "StereoVolumeControl_Noatun.h"

// Implementation
Arts::StereoVolumeControl_Noatun_base *Arts::StereoVolumeControl_Noatun_base::_create(const std::string& subClass)
{
	Arts::Object_skel *skel = Arts::ObjectManager::the()->create(subClass);
	assert(skel);
	Arts::StereoVolumeControl_Noatun_base *castedObject = (Arts::StereoVolumeControl_Noatun_base *)skel->_cast(Arts::StereoVolumeControl_Noatun_base::_IID);
	assert(castedObject);
	return castedObject;
}

Arts::StereoVolumeControl_Noatun_base *Arts::StereoVolumeControl_Noatun_base::_fromString(std::string objectref)
{
	Arts::ObjectReference r;

	if(Arts::Dispatcher::the()->stringToObjectReference(r,objectref))
		return Arts::StereoVolumeControl_Noatun_base::_fromReference(r,true);
	return 0;
}

Arts::StereoVolumeControl_Noatun_base *Arts::StereoVolumeControl_Noatun_base::_fromReference(Arts::ObjectReference r, bool needcopy)
{
	Arts::StereoVolumeControl_Noatun_base *result;
	result = (Arts::StereoVolumeControl_Noatun_base *)Arts::Dispatcher::the()->connectObjectLocal(r,"Arts::StereoVolumeControl_Noatun");
	if(result)
	{
		if(!needcopy)
			result->_cancelCopyRemote();
	}
	else
	{
		Arts::Connection *conn = Arts::Dispatcher::the()->connectObjectRemote(r);
		if(conn)
		{
			result = new Arts::StereoVolumeControl_Noatun_stub(conn,r.objectID);
			if(needcopy) result->_copyRemote();
			result->_useRemote();
			if (!result->_isCompatibleWith("Arts::StereoVolumeControl_Noatun")) {
				result->_release();
				return 0;
			}
		}
	}
	return result;
}

std::vector<std::string> Arts::StereoVolumeControl_Noatun_base::_defaultPortsIn() const {
	std::vector<std::string> ret;
	ret.push_back("inleft");
	ret.push_back("inright");
	return ret;
}
std::vector<std::string> Arts::StereoVolumeControl_Noatun_base::_defaultPortsOut() const {
	std::vector<std::string> ret;
	ret.push_back("outleft");
	ret.push_back("outright");
	return ret;
}

void *Arts::StereoVolumeControl_Noatun_base::_cast(unsigned long iid)
{
	if(iid == Arts::StereoVolumeControl_Noatun_base::_IID) return (Arts::StereoVolumeControl_Noatun_base *)this;
	if(iid == Arts::StereoEffect_base::_IID) return (Arts::StereoEffect_base *)this;
	if(iid == Arts::SynthModule_base::_IID) return (Arts::SynthModule_base *)this;
	if(iid == Arts::Object_base::_IID) return (Arts::Object_base *)this;
	return 0;
}

Arts::StereoVolumeControl_Noatun_stub::StereoVolumeControl_Noatun_stub()
{
	// constructor for subclasses (don't use directly)
}

Arts::StereoVolumeControl_Noatun_stub::StereoVolumeControl_Noatun_stub(Arts::Connection *connection, long objectID)
	: Arts::Object_stub(connection, objectID)
{
	// constructor to create a stub for an object
}

long Arts::StereoVolumeControl_Noatun_stub::percent()
{
	long methodID = _lookupMethodFast("method:0000000d5f6765745f70657263656e7400000000056c6f6e6700000000020000000000000000");
	long requestID;
	Arts::Buffer *request, *result;
	request = Arts::Dispatcher::the()->createRequest(requestID,_objectID,methodID);
	request->patchLength();
	_connection->qSendBuffer(request);

	result = Arts::Dispatcher::the()->waitForResult(requestID,_connection);
	if(!result) return 0; // error occured
	long returnCode = result->readLong();
	delete result;
	return returnCode;
}

void Arts::StereoVolumeControl_Noatun_stub::percent(long newValue)
{
	long methodID = _lookupMethodFast("method:0000000d5f7365745f70657263656e740000000005766f6964000000000200000001000000056c6f6e6700000000096e657756616c7565000000000000000000");
	long requestID;
	Arts::Buffer *request, *result;
	request = Arts::Dispatcher::the()->createRequest(requestID,_objectID,methodID);
	request->writeLong(newValue);
	request->patchLength();
	_connection->qSendBuffer(request);

	result = Arts::Dispatcher::the()->waitForResult(requestID,_connection);
	if(result) delete result;
}

std::string Arts::StereoVolumeControl_Noatun_skel::_interfaceName()
{
	return "Arts::StereoVolumeControl_Noatun";
}

bool Arts::StereoVolumeControl_Noatun_skel::_isCompatibleWith(const std::string& interfacename)
{
	if (interfacename == "Arts::StereoVolumeControl_Noatun") return true;
	if (interfacename == "Arts::StereoEffect") return true;
	if (interfacename == "Arts::SynthModule") return true;
	if (interfacename == "Arts::Object") return true;
	return false;
}

std::string Arts::StereoVolumeControl_Noatun_skel::_interfaceNameSkel()
{
	return "Arts::StereoVolumeControl_Noatun";
}

// _get_percent
static void _dispatch_Arts_StereoVolumeControl_Noatun_00(void *object, Arts::Buffer *, Arts::Buffer *result)
{
	result->writeLong(((Arts::StereoVolumeControl_Noatun_skel *)object)->percent());
}

// _set_percent
static void _dispatch_Arts_StereoVolumeControl_Noatun_01(void *object, Arts::Buffer *request, Arts::Buffer *)
{
	long newValue = request->readLong();
	((Arts::StereoVolumeControl_Noatun_skel *)object)->percent(newValue);
}

void Arts::StereoVolumeControl_Noatun_skel::_buildMethodTable()
{
	Arts::Buffer m;
	m.fromString(
        "MethodTable:0000000d5f6765745f70657263656e7400000000056c6f6e670000"
        "00000200000000000000000000000d5f7365745f70657263656e74000000000576"
        "6f6964000000000200000001000000056c6f6e6700000000096e657756616c7565"
        "000000000000000000",
		"MethodTable"
	);
	_addMethod(_dispatch_Arts_StereoVolumeControl_Noatun_00,this,Arts::MethodDef(m));
	_addMethod(_dispatch_Arts_StereoVolumeControl_Noatun_01,this,Arts::MethodDef(m));
	Arts::StereoEffect_skel::_buildMethodTable();
}

Arts::StereoVolumeControl_Noatun_skel::StereoVolumeControl_Noatun_skel()
{
}

Arts::Object_base* Arts::StereoVolumeControl_Noatun::_Creator() {
	return Arts::StereoVolumeControl_Noatun_base::_create();
}

unsigned long Arts::StereoVolumeControl_Noatun_base::_IID = Arts::MCOPUtils::makeIID("Arts::StereoVolumeControl_Noatun");

static Arts::IDLFileReg IDLFileReg_StereoVolumeControl_Noatun("StereoVolumeControl_Noatun",
    "IDLFile:000000010000000000000000000000000100000021417274733a3a53746572"
    "656f566f6c756d65436f6e74726f6c5f4e6f6174756e00000000010000001341727473"
    "3a3a53746572656f4566666563740000000000000000010000000870657263656e7400"
    "000000056c6f6e67000000001300000000000000000000000000000000"
);
