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

#include "FFTScopeStereo.h"

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

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

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

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

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

void *Arts::FFTScopeStereo_base::_cast(unsigned long iid)
{
	if(iid == Arts::FFTScopeStereo_base::_IID) return (Arts::FFTScopeStereo_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::FFTScopeStereo_stub::FFTScopeStereo_stub()
{
	// constructor for subclasses (don't use directly)
}

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

std::vector<float> * Arts::FFTScopeStereo_stub::scopeRight()
{
	long methodID = _lookupMethodFast("method:0000000b73636f7065526967687400000000072a666c6f617400000000020000000000000000");
	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);
	std::vector<float> *_returnCode = new std::vector<float>;
	if(!result) return _returnCode; // error occured
	result->readFloatSeq(*_returnCode);
	delete result;
	return _returnCode;
}

std::vector<float> * Arts::FFTScopeStereo_stub::scopeLeft()
{
	long methodID = _lookupMethodFast("method:0000000a73636f70654c65667400000000072a666c6f617400000000020000000000000000");
	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);
	std::vector<float> *_returnCode = new std::vector<float>;
	if(!result) return _returnCode; // error occured
	result->readFloatSeq(*_returnCode);
	delete result;
	return _returnCode;
}

float Arts::FFTScopeStereo_stub::bandResolution()
{
	long methodID = _lookupMethodFast("method:000000145f6765745f62616e645265736f6c7574696f6e0000000006666c6f617400000000020000000000000000");
	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.0; // error occured
	float returnCode = result->readFloat();
	delete result;
	return returnCode;
}

void Arts::FFTScopeStereo_stub::bandResolution(float newValue)
{
	long methodID = _lookupMethodFast("method:000000145f7365745f62616e645265736f6c7574696f6e0000000005766f696400000000020000000100000006666c6f617400000000096e657756616c7565000000000000000000");
	long requestID;
	Arts::Buffer *request, *result;
	request = Arts::Dispatcher::the()->createRequest(requestID,_objectID,methodID);
	request->writeFloat(newValue);
	request->patchLength();
	_connection->qSendBuffer(request);

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

std::string Arts::FFTScopeStereo_skel::_interfaceName()
{
	return "Arts::FFTScopeStereo";
}

bool Arts::FFTScopeStereo_skel::_isCompatibleWith(const std::string& interfacename)
{
	if (interfacename == "Arts::FFTScopeStereo") 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::FFTScopeStereo_skel::_interfaceNameSkel()
{
	return "Arts::FFTScopeStereo";
}

// scopeRight
static void _dispatch_Arts_FFTScopeStereo_00(void *object, Arts::Buffer *, Arts::Buffer *result)
{
	std::vector<float> *_returnCode = ((Arts::FFTScopeStereo_skel *)object)->scopeRight();
	result->writeFloatSeq(*_returnCode);
	delete _returnCode;
}

// scopeLeft
static void _dispatch_Arts_FFTScopeStereo_01(void *object, Arts::Buffer *, Arts::Buffer *result)
{
	std::vector<float> *_returnCode = ((Arts::FFTScopeStereo_skel *)object)->scopeLeft();
	result->writeFloatSeq(*_returnCode);
	delete _returnCode;
}

// _get_bandResolution
static void _dispatch_Arts_FFTScopeStereo_02(void *object, Arts::Buffer *, Arts::Buffer *result)
{
	result->writeFloat(((Arts::FFTScopeStereo_skel *)object)->bandResolution());
}

// _set_bandResolution
static void _dispatch_Arts_FFTScopeStereo_03(void *object, Arts::Buffer *request, Arts::Buffer *)
{
	float newValue = request->readFloat();
	((Arts::FFTScopeStereo_skel *)object)->bandResolution(newValue);
}

void Arts::FFTScopeStereo_skel::_buildMethodTable()
{
	Arts::Buffer m;
	m.fromString(
        "MethodTable:0000000b73636f7065526967687400000000072a666c6f61740000"
        "00000200000000000000000000000a73636f70654c65667400000000072a666c6f"
        "617400000000020000000000000000000000145f6765745f62616e645265736f6c"
        "7574696f6e0000000006666c6f617400000000020000000000000000000000145f"
        "7365745f62616e645265736f6c7574696f6e0000000005766f6964000000000200"
        "00000100000006666c6f617400000000096e657756616c75650000000000000000"
        "00",
		"MethodTable"
	);
	_addMethod(_dispatch_Arts_FFTScopeStereo_00,this,Arts::MethodDef(m));
	_addMethod(_dispatch_Arts_FFTScopeStereo_01,this,Arts::MethodDef(m));
	_addMethod(_dispatch_Arts_FFTScopeStereo_02,this,Arts::MethodDef(m));
	_addMethod(_dispatch_Arts_FFTScopeStereo_03,this,Arts::MethodDef(m));
	Arts::StereoEffect_skel::_buildMethodTable();
}

Arts::FFTScopeStereo_skel::FFTScopeStereo_skel()
{
}

Arts::Object_base* Arts::FFTScopeStereo::_Creator() {
	return Arts::FFTScopeStereo_base::_create();
}

unsigned long Arts::FFTScopeStereo_base::_IID = Arts::MCOPUtils::makeIID("Arts::FFTScopeStereo");

static Arts::IDLFileReg IDLFileReg_FFTScopeStereo("FFTScopeStereo",
    "IDLFile:000000010000000000000000000000000100000015417274733a3a46465453"
    "636f706553746572656f000000000100000013417274733a3a53746572656f45666665"
    "637400000000020000000b73636f7065526967687400000000072a666c6f6174000000"
    "000200000000000000000000000a73636f70654c65667400000000072a666c6f617400"
    "000000020000000000000000000000010000000f62616e645265736f6c7574696f6e00"
    "00000006666c6f6174000000001300000000000000000000000000000000"
);
