//..............................................................................
//
// Ninja log - main log engine api
//

import "ui_Icon.jnc"
import "log_Writer.jnc"
import "log_Converter.jnc"
import "log_Filter.jnc"
import "log_Observer.jnc"
import "log_RangeProcessor.jnc"

namespace log {

//! \addtogroup api-log
//! @{

//..............................................................................

opaque class Log {
	size_t property m_leafLineCountLimit;
	size_t property m_cacheUpdateScrollRateLimit;

	ui.Icon* property m_iconTable(size_t i);

	Writer* readonly m_writer;
	uint64_t const property m_syncId; // -1 if last record is not StdRecordCode.Sync
	uint64_t autoget property m_baseTimestamp;
	char const* const property m_recordFileName;

	destruct();

	void suspend();
	void resume();
	void rebuild();

	void addConverter(
		Converter* converter,
		std.Guid const* auxClassGuidArray,
		size_t auxClassCount
	);

	void addConverter(
		Converter* converter,
		std.Guid const* auxClassGuid
	) {
		addConverter(converter, auxClassGuid, 1);
	}

	void addConverter(Converter* converter) {
		addConverter(converter, null, 0);
	}

	void removeAllConverters();

	void addFilter(Filter* filter);
	void removeAllFilters();

	void addFoldingFilter(FoldingFilter* filter);
	void removeAllFoldingFilters();

	void addObserver(ObserverFunc* observerFunc);
	void removeAllObservers();

	void addSelectionProcessor(RangeProcessorFactoryFunc* factoryFunc);
	void removeAllSelectionProcessors();
}

//..............................................................................

// the main log writer keeps track of log.StdRecordCode.Tx, .Rx, and .TxRx

struct TxRxStats {
	uint64_t readonly volatile m_txTotalSize;
	uint64_t readonly volatile m_rxTotalSize;

	void reset();
	void addTx(size_t size);
	void addRx(size_t size);
}

//..............................................................................

//! @}

} // namespace log
