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

#include "winskinvis.h"

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

Noatun::WinSkinFFT_base *Noatun::WinSkinFFT_base::_fromString(const std::string& objectref)
{
	Arts::ObjectReference r;

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

Noatun::WinSkinFFT_base *Noatun::WinSkinFFT_base::_fromDynamicCast(const Arts::Object& object)
{
	if(object.isNull()) return 0;

	Noatun::WinSkinFFT_base *castedObject = (Noatun::WinSkinFFT_base *)object._base()->_cast(Noatun::WinSkinFFT_base::_IID);
	if(castedObject) return castedObject->_copy();

	return _fromString(object._toString());
}

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

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

void *Noatun::WinSkinFFT_base::_cast(unsigned long iid)
{
	if(iid == Noatun::WinSkinFFT_base::_IID) return (Noatun::WinSkinFFT_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;
}

Noatun::WinSkinFFT_stub::WinSkinFFT_stub()
{
	// constructor for subclasses (don't use directly)
}

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

std::vector<float> * Noatun::WinSkinFFT_stub::scope()
{
	long methodID = _lookupMethodFast("method:0000000673636f706500000000072a666c6f617400000000020000000000000000");
	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 occurred
	result->readFloatSeq(*_returnCode);
	delete result;
	return _returnCode;
}

float Noatun::WinSkinFFT_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 occurred
	float returnCode = result->readFloat();
	delete result;
	return returnCode;
}

void Noatun::WinSkinFFT_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 Noatun::WinSkinFFT_skel::_interfaceName()
{
	return "Noatun::WinSkinFFT";
}

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

std::string Noatun::WinSkinFFT_skel::_interfaceNameSkel()
{
	return "Noatun::WinSkinFFT";
}

// scope
static void _dispatch_Noatun_WinSkinFFT_00(void *object, Arts::Buffer *, Arts::Buffer *result)
{
	std::vector<float> *_returnCode = ((Noatun::WinSkinFFT_skel *)object)->scope();
	result->writeFloatSeq(*_returnCode);
	delete _returnCode;
}

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

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

void Noatun::WinSkinFFT_skel::_buildMethodTable()
{
	Arts::Buffer m;
	m.fromString(
        "MethodTable:0000000673636f706500000000072a666c6f617400000000020000"
        "000000000000000000145f6765745f62616e645265736f6c7574696f6e00000000"
        "06666c6f617400000000020000000000000000000000145f7365745f62616e6452"
        "65736f6c7574696f6e0000000005766f696400000000020000000100000006666c"
        "6f617400000000096e657756616c7565000000000000000000",
		"MethodTable"
	);
	_addMethod(_dispatch_Noatun_WinSkinFFT_00,this,Arts::MethodDef(m));
	_addMethod(_dispatch_Noatun_WinSkinFFT_01,this,Arts::MethodDef(m));
	_addMethod(_dispatch_Noatun_WinSkinFFT_02,this,Arts::MethodDef(m));
	Arts::StereoEffect_skel::_buildMethodTable();
}

Noatun::WinSkinFFT_skel::WinSkinFFT_skel()
{
}

Arts::Object_base* Noatun::WinSkinFFT::_Creator() {
	return Noatun::WinSkinFFT_base::_create();
}

unsigned long Noatun::WinSkinFFT_base::_IID = Arts::MCOPUtils::makeIID("Noatun::WinSkinFFT");

static Arts::IDLFileReg IDLFileReg_winskinvis("winskinvis",
    "IDLFile:0000000100000000000000000000000001000000134e6f6174756e3a3a5769"
    "6e536b696e464654000000000100000013417274733a3a53746572656f456666656374"
    "00000000010000000673636f706500000000072a666c6f617400000000020000000000"
    "000000000000010000000f62616e645265736f6c7574696f6e0000000006666c6f6174"
    "000000001300000000000000000000000000000000"
);
