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

#ifndef BRAHMSARTS_H
#define BRAHMSARTS_H

#include "common.h"

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

class BrahmsMidiRecorder;

class BrahmsMidiRecorder_base : virtual public Arts::MidiPort_base {
public:
	static unsigned long _IID; // interface ID

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

	static BrahmsMidiRecorder_base *_fromDynamicCast(const Arts::Object& object);
	inline BrahmsMidiRecorder_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);

	virtual bool record() = 0;
	virtual void record(bool newValue) = 0;
	virtual std::vector<Arts::MidiEvent> * getQueue() = 0;
	virtual void setMidiThru(Arts::MidiPort port) = 0;
};

class BrahmsMidiRecorder_stub : virtual public BrahmsMidiRecorder_base, virtual public Arts::MidiPort_stub {
protected:
	BrahmsMidiRecorder_stub();

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

	bool record();
	void record(bool newValue);
	std::vector<Arts::MidiEvent> * getQueue();
	void setMidiThru(Arts::MidiPort port);
};

class BrahmsMidiRecorder_skel : virtual public BrahmsMidiRecorder_base, virtual public Arts::MidiPort_skel {
protected:
	// emitters for change notifications
	inline void record_changed(bool newValue) {
		_emit_changed("record_changed",newValue);
	}

public:
	BrahmsMidiRecorder_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 BrahmsMidiRecorder : public Arts::Object {
private:
	static Arts::Object_base* _Creator();
	BrahmsMidiRecorder_base *_cache;
	inline BrahmsMidiRecorder_base *_method_call() {
		_pool->checkcreate();
		if(_pool->base) {
			_cache=(BrahmsMidiRecorder_base *)_pool->base->_cast(BrahmsMidiRecorder_base::_IID);
			assert(_cache);
		}
		return _cache;
	}

protected:
	inline BrahmsMidiRecorder(BrahmsMidiRecorder_base* b) : Arts::Object(b), _cache(0) {}


public:
	typedef BrahmsMidiRecorder_base _base_class;

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

	inline Arts::TimeStamp time();
	inline void processCommand(const Arts::MidiCommand& command);
	inline void processEvent(const Arts::MidiEvent& event);
	inline bool record();
	inline void record(bool _newValue);
	inline std::vector<Arts::MidiEvent> * getQueue();
	inline void setMidiThru(Arts::MidiPort port);
};

// Forward wrapper calls to _base classes:

inline Arts::TimeStamp BrahmsMidiRecorder::time()
{
	return _cache?static_cast<Arts::MidiPort_base*>(_cache)->time():static_cast<Arts::MidiPort_base*>(_method_call())->time();
}

inline void BrahmsMidiRecorder::processCommand(const Arts::MidiCommand& command)
{
	 _cache?static_cast<Arts::MidiPort_base*>(_cache)->processCommand(command):static_cast<Arts::MidiPort_base*>(_method_call())->processCommand(command);
}

inline void BrahmsMidiRecorder::processEvent(const Arts::MidiEvent& event)
{
	 _cache?static_cast<Arts::MidiPort_base*>(_cache)->processEvent(event):static_cast<Arts::MidiPort_base*>(_method_call())->processEvent(event);
}

inline bool BrahmsMidiRecorder::record()
{
	return _cache?static_cast<BrahmsMidiRecorder_base*>(_cache)->record():static_cast<BrahmsMidiRecorder_base*>(_method_call())->record();
}

inline void BrahmsMidiRecorder::record(bool _newValue)
{
	 _cache?static_cast<BrahmsMidiRecorder_base*>(_cache)->record(_newValue):static_cast<BrahmsMidiRecorder_base*>(_method_call())->record(_newValue);
}

inline std::vector<Arts::MidiEvent> * BrahmsMidiRecorder::getQueue()
{
	return _cache?static_cast<BrahmsMidiRecorder_base*>(_cache)->getQueue():static_cast<BrahmsMidiRecorder_base*>(_method_call())->getQueue();
}

inline void BrahmsMidiRecorder::setMidiThru(Arts::MidiPort port)
{
	 _cache?static_cast<BrahmsMidiRecorder_base*>(_cache)->setMidiThru(port):static_cast<BrahmsMidiRecorder_base*>(_method_call())->setMidiThru(port);
}

#endif /* BRAHMSARTS_H */
