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

#include "RawScope.h"

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

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

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

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

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

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

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

std::vector<float> * Arts::RawScope_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 occured
	result->readFloatSeq(*_returnCode);
	delete result;
	return _returnCode;
}

long Arts::RawScope_stub::buffer()
{
	long methodID = _lookupMethodFast("method:0000000c5f6765745f62756666657200000000056c6f6e6700000000020000000000000000");
	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::RawScope_stub::buffer(long newValue)
{
	long methodID = _lookupMethodFast("method:0000000c5f7365745f6275666665720000000005766f6964000000000200000001000000056c6f6e6700000000096e657756616c7565000000000000000000");
	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::RawScope_skel::_interfaceName()
{
	return "Arts::RawScope";
}

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

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

// _get_buffer
static void _dispatch_Arts_RawScope_01(void *object, Arts::Buffer *, Arts::Buffer *result)
{
	result->writeLong(((Arts::RawScope_skel *)object)->buffer());
}

// _set_buffer
static void _dispatch_Arts_RawScope_02(void *object, Arts::Buffer *request, Arts::Buffer *)
{
	long newValue = request->readLong();
	((Arts::RawScope_skel *)object)->buffer(newValue);
}

void Arts::RawScope_skel::_buildMethodTable()
{
	Arts::Buffer m;
	m.fromString(
        "MethodTable:0000000673636f706500000000072a666c6f617400000000020000"
        "0000000000000000000c5f6765745f62756666657200000000056c6f6e67000000"
        "000200000000000000000000000c5f7365745f6275666665720000000005766f69"
        "64000000000200000001000000056c6f6e6700000000096e657756616c75650000"
        "00000000000000",
		"MethodTable"
	);
	_addMethod(_dispatch_Arts_RawScope_00,this,Arts::MethodDef(m));
	_addMethod(_dispatch_Arts_RawScope_01,this,Arts::MethodDef(m));
	_addMethod(_dispatch_Arts_RawScope_02,this,Arts::MethodDef(m));
	Arts::StereoEffect_skel::_buildMethodTable();
}

Arts::RawScope_skel::RawScope_skel()
{
}

Arts::Object_base* Arts::RawScope::_Creator() {
	return Arts::RawScope_base::_create();
}

unsigned long Arts::RawScope_base::_IID = Arts::MCOPUtils::makeIID("Arts::RawScope");

static Arts::IDLFileReg IDLFileReg_RawScope("RawScope",
    "IDLFile:00000001000000000000000000000000010000000f417274733a3a52617753"
    "636f7065000000000100000013417274733a3a53746572656f45666665637400000000"
    "010000000673636f706500000000072a666c6f61740000000002000000000000000000"
    "0000010000000762756666657200000000056c6f6e6700000000130000000000000000"
    "0000000000000000"
);
