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

#ifndef SPLAYPLAYOBJECT_H
#define SPLAYPLAYOBJECT_H

#include "common.h"

// includes of other idl definitions
#include "kmedia2.h"
#include "artsflow.h"

class SplayPlayObject;

class SplayPlayObject_base : virtual public Arts::StreamPlayObject_base,
	virtual public Arts::SynthModule_base {
public:
	static unsigned long _IID; // interface ID

	static SplayPlayObject_base *_create(const std::string& subClass = "SplayPlayObject");
	static SplayPlayObject_base *_fromString(const std::string& objectref);
	static SplayPlayObject_base *_fromReference(Arts::ObjectReference ref, bool needcopy);

	static SplayPlayObject_base *_fromDynamicCast(const Arts::Object& object);
	inline SplayPlayObject_base *_copy() {
		assert(_refCnt > 0);
		_refCnt++;
		return this;
	}

	virtual std::vector<std::string> _defaultPortsIn() const;
	virtual std::vector<std::string> _defaultPortsOut() const;

	void *_cast(unsigned long iid);

};

class SplayPlayObject_stub : virtual public SplayPlayObject_base, virtual public Arts::StreamPlayObject_stub,
	virtual public Arts::SynthModule_stub {
protected:
	SplayPlayObject_stub();

public:
	SplayPlayObject_stub(Arts::Connection *connection, long objectID);

};

class SplayPlayObject_skel : virtual public SplayPlayObject_base, virtual public Arts::StreamPlayObject_skel,
	virtual public Arts::SynthModule_skel {
protected:
	// variables for streams
	Arts::ByteAsyncStream indata;             // incoming stream
	float *left;                              // outgoing stream
	float *right;                             // outgoing stream

	// handler for asynchronous streams
	virtual void process_indata(Arts::DataPacket<Arts::mcopbyte> *) = 0;

public:
	SplayPlayObject_skel();

	static std::string _interfaceNameSkel();
	std::string _interfaceName();
	bool _isCompatibleWith(const std::string& interfacename);
	void _buildMethodTable();
	void dispatch(Arts::Buffer *request, Arts::Buffer *result,long methodID);
	void notify(const Arts::Notification& notification);
};

#include "reference.h"
class SplayPlayObject : public Arts::Object {
private:
	static Arts::Object_base* _Creator();
	SplayPlayObject_base *_cache;
	inline SplayPlayObject_base *_method_call() {
		_pool->checkcreate();
		if(_pool->base) {
			_cache=(SplayPlayObject_base *)_pool->base->_cast(SplayPlayObject_base::_IID);
			assert(_cache);
		}
		return _cache;
	}

protected:
	inline SplayPlayObject(SplayPlayObject_base* b) : Arts::Object(b), _cache(0) {}


public:
	typedef SplayPlayObject_base _base_class;

	inline SplayPlayObject() : Arts::Object(_Creator), _cache(0) {}
	inline SplayPlayObject(const Arts::SubClass& s) :
		Arts::Object(SplayPlayObject_base::_create(s.string())), _cache(0) {}
	inline SplayPlayObject(const Arts::Reference &r) :
		Arts::Object(r.isString()?(SplayPlayObject_base::_fromString(r.string())):(SplayPlayObject_base::_fromReference(r.reference(),true))), _cache(0) {}
	inline SplayPlayObject(const Arts::DynamicCast& c) : Arts::Object(SplayPlayObject_base::_fromDynamicCast(c.object())), _cache(0) {}
	inline SplayPlayObject(const SplayPlayObject& target) : Arts::Object(target._pool), _cache(target._cache) {}
	inline SplayPlayObject(Arts::Object::Pool& p) : Arts::Object(p), _cache(0) {}
	inline static SplayPlayObject null() {return SplayPlayObject((SplayPlayObject_base*)0);}
	inline static SplayPlayObject _from_base(SplayPlayObject_base* b) {return SplayPlayObject(b);}
	inline SplayPlayObject& operator=(const SplayPlayObject& target) {
		if (_pool == target._pool) return *this;
		_pool->Dec();
		_pool = target._pool;
		_cache = target._cache;
		_pool->Inc();
		return *this;
	}
	inline operator Arts::StreamPlayObject() const { return Arts::StreamPlayObject(*_pool); }
	inline operator Arts::PlayObject() const { return Arts::PlayObject(*_pool); }
	inline operator Arts::PlayObject_private() const { return Arts::PlayObject_private(*_pool); }
	inline operator Arts::SynthModule() const { return Arts::SynthModule(*_pool); }
	inline SplayPlayObject_base* _base() {return _cache?_cache:_method_call();}

	inline bool streamMedia(Arts::InputStream instream);
	inline Arts::InputStream inputStream();
	inline std::string description();
	inline Arts::poTime currentTime();
	inline Arts::poTime overallTime();
	inline Arts::poCapabilities capabilities();
	inline std::string mediaName();
	inline Arts::poState state();
	inline void play();
	inline void seek(const Arts::poTime& newTime);
	inline void pause();
	inline void halt();
	inline bool loadMedia(const std::string& filename);
	inline Arts::AutoSuspendState autoSuspend();
	inline void start();
	inline void stop();
	inline void streamInit();
	inline void streamStart();
	inline void streamEnd();
};

// Forward wrapper calls to _base classes:

inline bool SplayPlayObject::streamMedia(Arts::InputStream instream)
{
	return _cache?static_cast<Arts::StreamPlayObject_base*>(_cache)->streamMedia(instream):static_cast<Arts::StreamPlayObject_base*>(_method_call())->streamMedia(instream);
}

inline Arts::InputStream SplayPlayObject::inputStream()
{
	return _cache?static_cast<Arts::StreamPlayObject_base*>(_cache)->inputStream():static_cast<Arts::StreamPlayObject_base*>(_method_call())->inputStream();
}

inline std::string SplayPlayObject::description()
{
	return _cache?static_cast<Arts::PlayObject_base*>(_cache)->description():static_cast<Arts::PlayObject_base*>(_method_call())->description();
}

inline Arts::poTime SplayPlayObject::currentTime()
{
	return _cache?static_cast<Arts::PlayObject_base*>(_cache)->currentTime():static_cast<Arts::PlayObject_base*>(_method_call())->currentTime();
}

inline Arts::poTime SplayPlayObject::overallTime()
{
	return _cache?static_cast<Arts::PlayObject_base*>(_cache)->overallTime():static_cast<Arts::PlayObject_base*>(_method_call())->overallTime();
}

inline Arts::poCapabilities SplayPlayObject::capabilities()
{
	return _cache?static_cast<Arts::PlayObject_base*>(_cache)->capabilities():static_cast<Arts::PlayObject_base*>(_method_call())->capabilities();
}

inline std::string SplayPlayObject::mediaName()
{
	return _cache?static_cast<Arts::PlayObject_base*>(_cache)->mediaName():static_cast<Arts::PlayObject_base*>(_method_call())->mediaName();
}

inline Arts::poState SplayPlayObject::state()
{
	return _cache?static_cast<Arts::PlayObject_base*>(_cache)->state():static_cast<Arts::PlayObject_base*>(_method_call())->state();
}

inline void SplayPlayObject::play()
{
	 _cache?static_cast<Arts::PlayObject_base*>(_cache)->play():static_cast<Arts::PlayObject_base*>(_method_call())->play();
}

inline void SplayPlayObject::seek(const Arts::poTime& newTime)
{
	 _cache?static_cast<Arts::PlayObject_base*>(_cache)->seek(newTime):static_cast<Arts::PlayObject_base*>(_method_call())->seek(newTime);
}

inline void SplayPlayObject::pause()
{
	 _cache?static_cast<Arts::PlayObject_base*>(_cache)->pause():static_cast<Arts::PlayObject_base*>(_method_call())->pause();
}

inline void SplayPlayObject::halt()
{
	 _cache?static_cast<Arts::PlayObject_base*>(_cache)->halt():static_cast<Arts::PlayObject_base*>(_method_call())->halt();
}

inline bool SplayPlayObject::loadMedia(const std::string& filename)
{
	return _cache?static_cast<Arts::PlayObject_private_base*>(_cache)->loadMedia(filename):static_cast<Arts::PlayObject_private_base*>(_method_call())->loadMedia(filename);
}

inline Arts::AutoSuspendState SplayPlayObject::autoSuspend()
{
	return _cache?static_cast<Arts::SynthModule_base*>(_cache)->autoSuspend():static_cast<Arts::SynthModule_base*>(_method_call())->autoSuspend();
}

inline void SplayPlayObject::start()
{
	 _cache?static_cast<Arts::SynthModule_base*>(_cache)->start():static_cast<Arts::SynthModule_base*>(_method_call())->start();
}

inline void SplayPlayObject::stop()
{
	 _cache?static_cast<Arts::SynthModule_base*>(_cache)->stop():static_cast<Arts::SynthModule_base*>(_method_call())->stop();
}

inline void SplayPlayObject::streamInit()
{
	 _cache?static_cast<Arts::SynthModule_base*>(_cache)->streamInit():static_cast<Arts::SynthModule_base*>(_method_call())->streamInit();
}

inline void SplayPlayObject::streamStart()
{
	 _cache?static_cast<Arts::SynthModule_base*>(_cache)->streamStart():static_cast<Arts::SynthModule_base*>(_method_call())->streamStart();
}

inline void SplayPlayObject::streamEnd()
{
	 _cache?static_cast<Arts::SynthModule_base*>(_cache)->streamEnd():static_cast<Arts::SynthModule_base*>(_method_call())->streamEnd();
}

#endif /* SPLAYPLAYOBJECT_H */
