//Copyright 2020 Siemens Digital Industries Software
//==================================================
//Copyright $2008.
//Siemens Product Lifecycle Management Software Inc.
//All Rights Reserved.
//==================================================
//Copyright 2020 Siemens Digital Industries Software

/*==================================================================================================
File description:
   This file contains the declaration for the abstract class RootObject

    Filename: RootObject.hxx
    Module  : metaframework

==================================================================================================*/

#ifndef TEAMCENTER__ROOTOBJECT__HXX
#define TEAMCENTER__ROOTOBJECT__HXX

#include <string>
#include <unidefs.h>
#include <vector>
#include <cstdarg>


#include <metaframework/Object.hxx>

#include <metaframework/libmetaframework_exports.h>

namespace Teamcenter
{
   class RootObject;
}
namespace Teamcenter
{
   class RootObjectImpl;
   class RuntimeBusinessObjectImpl;
   class BusinessObjectRegistryImpl;
}
namespace Teamcenter
{
   class BusinessObject;
}

class  METAFRAMEWORK_API Teamcenter::RootObject : public Teamcenter::Object
{
public:

    //  Getter method for the Implementation Object
    virtual RuntimeBusinessObjectImpl*  getRuntimeBusinessObjectImpl() const;

    // Get the Interface Name
    static const std::string& getInterfaceName();

    //operations
    // get the object tag
    tag_t getTag() const;

    // get the BusinessObject(Type) name
    const std::string& getTypeName() const;

    // get the BusinessObject(Type) tag
    tag_t getTypeTag() const;

    // va_list does not support std::string& so converting to std::string*
    int invokeOperation( const std::string* operationId, ...);
    int invokeOperation( const std::string& operationId, va_list args );
    int invokeOperation( int operationIdInt, va_list args );
    int invokeOperation( const std::string& operationId, std::vector<void*>& args );
    int invokeOperation( int operationIdInt, std::vector<void*>& args );

protected:
    RootObject();
    virtual ~RootObject();

    // initialization for object instantiation
    virtual void initialize(RootObjectImpl * impl = 0);

    // set the object tag
    void setTag(tag_t tag);

private:
    void setType(tag_t tag, const std::string& name);

    // object tag
    tag_t m_tag;

    // business object type name
    std::string m_typeName;
    // business object type tag
    tag_t m_typeTag;

    // Name of the Object
    static std::string name;

    // Private default constructor. We do not want this class instantiated without the business object passed in.
    RootObject( const RootObject& );
    RootObject& operator=( const RootObject& );

    // friends
    friend class Teamcenter::BusinessObjectRegistryImpl;// persist BusinessObject: accessing setTag and setType
};

#include <metaframework/libmetaframework_undef.h>
#endif // TEAMCENTER__ROOTOBJECT__HXX
