/********************************************************************/
/* Copyright (c) 2017 System fugen G.K. and Yuzi Mizuno          */
/* All rights reserved.                                             */
/********************************************************************/
#ifndef _MGAttrib_HH_
#define _MGAttrib_HH_

#include "mg/Pvector.h"
#include "mg/Gel.h"
#include "mg/types.h"

//
//Define MGAttrib Class.

class MGIfstream;
class MGOfstream;
class MGAttrib;
class MGGLAttrib;
class MGContext;

/** @addtogroup GelRelated
 *  @{
 */

///MGAttrib is an abstract class that defines attribute elements of MGGel.

///Currently main subclasses of MGAttrib are MGGLAttrib, MGAppearance, and MGContex.
class MG_DLL_DECLR MGAttrib: public MGGel{

public:

///Virtual Destructor
virtual ~MGAttrib();

///Assignment.
///When the leaf objects of this and gel2 are not equal, this assignment does nothing.
virtual MGAttrib& operator=(const MGAttrib& gel2){MGGel::operator=(gel2); return *this;};

////////Member Function////////

/// Output virtual function.
virtual std::ostream& out(std::ostream&) const=0;

///Return MGAttrib pointer if this MGGel is an MGAttrib, else return null.
MGAttrib* attrib(){return this;};
const MGAttrib* attrib()const{return this;};

/// Return This object's typeID
///Sub class of MGAttrib must have the id as 0x02nnnnnnL.
virtual long identify_type() const{return MGATTRIB_TID;};

///Test if this gel includes an object.
const MGObject* includes_object()const{return 0;};

///Test if this gel includes an object.
MGObject* includes_object(){return 0;};

protected:

///Read all member data.
virtual void ReadMembers(MGIfstream& buf);

///Write all member data
virtual void WriteMembers(MGOfstream& buf)const;

private:

friend class MGIfstream;
friend class MGOfstream;

};

typedef MGPvector<MGGLAttrib> MGGLAttribs;///<attributes.

///Construct a null newed MGAttrib from the type id TID.
MG_DLL_DECLR MGAttrib* MGNullAttrib(long TID);

/** @} */ // end of GelRelated group
#endif