A CMS export plug-in externalizes the information about changes made to a design and emits it in a format that can be consumed by a corresponding import plug-in. An export plug-in
The sections that follow provide a general guide for writing an export plug-in.
For an overview of the CMS system, refer to Change Management System (CMS) in the Programmers Guide.
An application exports information about tracked design changes through CMS using the public oaChangeMgr class and an export plug-in. All interactions between CMS and the plug-in are managed by the oaChangeMgr singleton public class.
The exported changes can then be imported by a different application with the appropriate import plug-in.
Refer to Exporting Changes in the Change Management System (CMS) document for an overview of the sequence of interactions between the end user, the application, the oaChangeMgr instance, and the tracking plug-in.
Before starting this project, you might want to read How to Write a Plug-In, which is a more generic document describing the general concept of plug-ins and how they work.
In order to create an CMS export plug-in, you need to:
OpenAccess provides infrastructure support for implementing a CMS plug-in. The functions in oaCommon.h provide basic plug-in support such as the ability to get the globally unique identifier (Guid) and manage the plug-in lifetime. Functions in oaCM.h provide support for all CMS objects.
Note that a sample export plug-in is provided at <install_dir>
/oa/examples/cms/src/export
.
To create a basic export plug-in:
const oa::oaString myExportPlugIn::plugInName("myExportPlugIn");
oaCommon::Factory<myExportPlugIn> myTrackingPlugIn::factory(myExportPlugIn::getPlugInName());
extern "C" long
getClassObject(const char *classID,
const Guid &interfaceID,
void **ptr);
long
getClassObject(const char *classID,
const oaCommon::Guid &interfaceID,
void **ptr)
{
return oaCommon::FactoryBase::getClassObject(classID, interfaceID, ptr);
}
class myCMExport : public oaCommon::PlugInBase
<oaPlugIn::IExport> {
public:
myCMExport();
virtual void init();
virtual void getProtocols(oa::oaCMProtocolArray &out) const;
virtual void setProtocol(const oa::oaCMProtocol &in);
virtual void exportFull(oa::oaChangeSetBase *changeSet);
virtual void exportIncr(oa::oaChangeSetBase *changeSet);
virtual void discardChangeSet(oa::oaChangeSetBase *in);
static oaCommon::IFactory *getFactory();
static const oa::oaString &getPlugInName();
private:
oaCMProtocolArray m_protocols;
oaCMProtocol m_protocol;
static const oa::oaString plugInName;
static oaCommon::Factory
<oaCMExportSample> factory;
};
virtual bool validate()
<?xml version="1.0" encoding="utf-8" ?>Note: The registration file can be installed in $(OA_HOME)/data/plugins when the plug-in shared library is installed. Alternatively, the OA_PLUGIN_PATH environment variable can be used to reference a .plg file outside of $(OA_HOME)/data/plugins. Refer to Writing the Plug-In Registration File in How to Write a Plug-In for more information.
<plugIn lib="myExportPlugIn"/>
The following are sample implementations of the interface functions shown in Step 4 above.
This function initializes the plug-in and establishes the protocol. It could be implemented as:
void myCMExport::init() { oaCMAttrArray fixed; oaCMAttrArray mod; fixed.append(oaCMAttr("Format", "File")); mod.append(oaCMAttr("FileName")); m_protocols.append(oaCMProtocol("myExport", "myCMExport", fixed, mod)); }
void
myCMExport::getProtocols(oa::oaCMProtocolArray &out) const
{
out = m_protocols;
}
This function sets the protocols of this plug-in and could be implemented as:
void myCMExport::setProtocol(const oa::oaCMProtocol &in) { if (!m_protocols.validate(in)) { throw oaError(oacCMInvalidPlugInProtocol); } m_protocol = in; }
void myCMExport::exportFull(oa::oaChangeSetBase *changeSet) { changeSet->setExported(); } void myCMExport::exportIncr(oa::oaChangeSetBase *changeSet) { if (!changeSet->isActive()) { changeSet->setExported(); } }
void myCMExport::discardChangeSet(oa::oaChangeSetBase *in) { }
This function returns the factory interface for this plug-in and could be implemented as:
inline oaPlugIn::IFactory* myCMExport::getFactory() { return &factory; }
This function returns the string name of the plug-in and could be implemented as:
inline const oa::oaString& myCMExport::getPlugInName() { return plugInName; }
Return to Programmers Guide topics
Copyright © 2001-2010 Cadence Design Systems, Inc.
All rights reserved.