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

#ifndef PLAYOBJECTS_H
#define PLAYOBJECTS_H

#include "common.h"

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

class AVIPlayObject;

class AVIPlayObject_base : virtual public Arts::PlayObject_base {
public:
	static unsigned long _IID; // interface ID

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

	inline AVIPlayObject_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 AVIPlayObject_stub : virtual public AVIPlayObject_base, virtual public Arts::PlayObject_stub {
protected:
	AVIPlayObject_stub();

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

};

class AVIPlayObject_skel : virtual public AVIPlayObject_base, virtual public Arts::PlayObject_skel {
public:
	AVIPlayObject_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);
};

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

protected:
	inline AVIPlayObject(AVIPlayObject_base* b) : Arts::Object(b), _cache(0) {}


public:
	typedef AVIPlayObject_base _base_class;

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

	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);
};

// Forward wrapper calls to _base classes:

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

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

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

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

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

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

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

inline void AVIPlayObject::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 AVIPlayObject::pause()
{
	 _cache?static_cast<Arts::PlayObject_base*>(_cache)->pause():static_cast<Arts::PlayObject_base*>(_method_call())->pause();
}

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

inline bool AVIPlayObject::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);
}

#endif /* PLAYOBJECTS_H */
