//----------------------------------------------------------------------------------
// <copyright file="LqrSMACCmdOutputFormatterAlias.h" company="LiquidRobotics">
//
// Copyright (c) 2014 Liquid Robotics, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// This software is associated with a release.  Liquid Robotics makes no
// representation that the design, interfaces or component distribution will
// remain unchanged in future releases.
//
// </copyright>
//
// <summary>
//   Declaration of CmdOutputFormatterAlias, a subclass of a CmdOutputFormatter that
//   passes its output to the referenced instance
// </summary>
//
// <owner>Mike Cookson</owner>
//----------------------------------------------------------------------------------

#ifndef __LqrSMACCmdOutputFormatterAlias_h__
#define __LqrSMACCmdOutputFormatterAlias_h__

#include "LqrSMACCmdOutputFormatter.h"

namespace LiquidRobotics {
namespace SMACFramework {

class SHARED_LIB_PUBLIC CmdOutputFormatterAlias : public CmdOutputFormatterBase
{
public:

	CmdOutputFormatterAlias(CmdOutputFormatter::Ptr _instance);

	virtual void AddAttribute(const string& attributeName, const string& attributeValue);
	virtual void AppendOutput(const void* pStart, unsigned len);
	virtual void AppendResult(const void* pStart, unsigned len);
	virtual void AppendTag(const string& tagName, const void* pStart, unsigned len);
	virtual string GetAttribute(const string& attributeName) const;
	virtual string GetOutput() const;
	virtual string GetTag(const string& tagName) const;
	virtual Ptr NewChild();
	virtual OutputStream& ToStream(OutputStream& stm, unsigned nesting = 0, unsigned maxLength = ~0) const;

	virtual void AppendOutput(const ByteArray& data);
	virtual void AppendOutput(const string& data);
	virtual void AppendResult(const ByteArray& data);
	virtual void AppendResult(const string& data);
	virtual TimestampValue& CreateTime();
	virtual const TimestampValue& CreateTime() const;
	virtual TimestampValue& EndTime();
	virtual const TimestampValue& EndTime() const;
	virtual void FlagCompleted(CORBA::Exception& ex);
	virtual void FlagCompleted(std::exception& ex);
	virtual void FlagCompleted(bool success = true);
	virtual void FlagStarted();
	virtual bool FlaggedCompleted() const;
	virtual bool FlaggedStarted() const;
	virtual void GetChildren(PtrArray& _children) const;
	virtual string GetCommandName() const;
	virtual CmdOutputFormatterBase* GetParent() const;
	virtual void NewChild(Ptr newChild);
	virtual void NewChild(CmdOutputFormatterBase* newChild);
	virtual OutputterStream& Output();
	virtual const OutputterStream& Output() const;
	virtual void SetCommandName(const string& newValue);
	virtual void SetParent(CmdOutputFormatterBase* newValue);
	virtual TimestampValue& StartTime();
	virtual const TimestampValue& StartTime() const;
	virtual string ToString(unsigned nesting = 0, unsigned maxLength = ~0) const;

private:

	CmdOutputFormatter::Ptr instance;
};


}
}

#endif
