You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.2 KiB
101 lines
3.2 KiB
// ==================================================
|
|
// Copyright 2014.
|
|
// Siemens Product Lifecycle Management Software Inc.
|
|
// All Rights Reserved.
|
|
// ==================================================
|
|
|
|
/**
|
|
@file
|
|
|
|
Holds registry information about a Business Object Extender.
|
|
*/
|
|
|
|
/* */
|
|
|
|
#ifndef TEAMCENTER_BUSINESSOBJECTEXTENDERREGISTRY_HXX
|
|
#define TEAMCENTER_BUSINESSOBJECTEXTENDERREGISTRY_HXX
|
|
|
|
#include <unidefs.h>
|
|
#include <metaframework/BusinessObjectExtender.hxx>
|
|
#include <metaframework/libmetaframework_exports.h>
|
|
|
|
/**
|
|
@ingroup BO
|
|
@{
|
|
*/
|
|
|
|
namespace Teamcenter
|
|
{
|
|
/**
|
|
Constructor method Definition
|
|
*/
|
|
typedef BusinessObjectExtender* (*BusinessObjectExtenderConstructor)( tag_t );
|
|
/**
|
|
Initializer method Definition
|
|
*/
|
|
typedef int (*BusinessObjectExtenderInitializer)();
|
|
class BusinessObjectExtender;
|
|
}
|
|
|
|
/**
|
|
Method to register the Extender Interface
|
|
*/
|
|
extern METAFRAMEWORK_API void registerExtenderInterface(const std::string& owningExtenderInterfaceName, const std::string& boInterfaceName, const std::string& boName, Teamcenter::BusinessObjectExtenderConstructor ctr,
|
|
Teamcenter::BusinessObjectExtenderInitializer initilaizer);
|
|
/**
|
|
Method to find the Extender Interface in the registry
|
|
*/
|
|
extern METAFRAMEWORK_API Teamcenter::BusinessObjectExtender* findExtenderInterfaceObject (const std::string& interfaceName, tag_t objTag);
|
|
|
|
namespace Teamcenter
|
|
{
|
|
|
|
/**
|
|
@brief Holds the registry information for a behavior.
|
|
|
|
Holds the registry information for a Business Object Extender.
|
|
|
|
@code
|
|
Auto generated usage for business object extender's:
|
|
Teamcenter::BusinessObjectExtenderRegistry<Teamcenter::aosinternal::Item>&
|
|
Teamcenter::aosinternal::Item::extenderRegistry()
|
|
{
|
|
Teamcenter::BusinessObjectRegistry::instance().loadBusinessObjectExtenderLibrary ( "Item" );
|
|
static Teamcenter::BusinessObjectExtenderRegistry< Teamcenter::aosinternal::Item > extenderRegistry;
|
|
return extenderRegistry;
|
|
}
|
|
@endcode
|
|
*/
|
|
template <class B>
|
|
class BusinessObjectExtenderRegistry
|
|
{
|
|
|
|
public:
|
|
/**
|
|
Add the registration into TypeExtenderMap. In this design, key will be typeTag.
|
|
*/
|
|
void registerExtender(const std::string& boName, const std::string& boInterface, BusinessObjectExtenderConstructor ctr,
|
|
BusinessObjectExtenderInitializer initilaizer)
|
|
{
|
|
registerExtenderInterface(B::getExtenderInterfaceName(), boInterface, boName, ctr, initilaizer);
|
|
};
|
|
|
|
/**
|
|
Find the Business object extender for a given object tag.
|
|
|
|
@returns A pointer to the Business Object Extender
|
|
*/
|
|
B* findExtenderObject (
|
|
tag_t objTag /**< (I) The input Object tag */
|
|
) const
|
|
{
|
|
return dynamic_cast<B* > ( findExtenderInterfaceObject ( B::getExtenderInterfaceName(), objTag ) );
|
|
}
|
|
};
|
|
}
|
|
|
|
/** @} */
|
|
|
|
#include <metaframework/libmetaframework_undef.h>
|
|
#endif //TEAMCENTER_BUSINESSOBJECTEXTENDERREGISTRY_HXX
|