FME SDK 1.1 (FME Objects and Pluginbuilder) Porting Notes for FME 2022.0+

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2022.0

Introduction

In FME 2022.0 and newer, we’ve made a number of improvements to the FME Software Development Kits (SDK). Specifically, we’ve introduced the FME Objects 1.1 and FME Pluginbuilder 1.1 APIs. This article lists both the changes and recommended suggestions for SDK users on how to adopt them in their FME Plug-in SDK modules and FME Objects applications. 
 

.NET Applications

FME Objects .NET applications built with earlier versions of FME will fail to run with FME 2022 with the following exception:

System.IO.FileLoadException: A procedure imported by 'FMEObjectsDotNet4.dll' could not be loaded.

To run successfully with FME 2022, .NET applications will need to be rebuilt referencing the FMEObjectsDotNet4.dll included with FME 2022.0.
 

C++ Applications

After updating to the new SDK, existing plug-ins and applications will no longer compile. Resolving the various compilation errors should result in a successful migration to the latest FME SDK. The changes in the document are ordered and can be applied sequentially to ease the migration to the new FME SDK version, including both breaking and non-breaking changes.
 

fme:: namespace

FMEObjects API is now contained in the fme:: namespace. All FMEObjects classes have been renamed from IFME[Class] to I[Class]. For example, IFMEFeature is now fme::IFeature

Impact As a result of this change, all forward declarations for (former) IFME[Class]es will fail to compile
Recommended Action Replace all forward declarations with their new respective forward declaration header files. New header files for all the affected classes are distributed in the same directory as the original file itself and contain a “_fwd” suffix Example: class IFMEFeature; can be renamed to #include <ifeature_fwd.h> </ifeature_fwd.h> 

 

Method Renaming

A number of methods on the interface have been renamed to overloads of other existing methods. Please refer to the tables below for an exhaustive list of renamed methods
 

fme::IFeature (formerly IFMEFeature)

Old Method Name New Method Name
getInt8Attribute
getBooleanAttribute
getInt64Attribute
getUInt64Attribute
getAttribute
setInt64Attribute
setUInt64Attribute
setInt8Attribute
setBooleanAttribute
setAttribute
setAttributeNullWithType setAttributeNull
exportGeometryToOGCWKT2 exportGeometryToOGCWKT
exportGeometryToOGCWKB2 exportGeometryToOGCWKB

 

fme::IGeometry (formerly IFMEGeometry)

Old Method Name New Method Name
getTraitBoolean
getTraitInt64
getTraitUInt64
getTraitReal32
getTraitReal64
getTraitUInt8
getTraitUInt16
getTraitInt16
getTraitUInt32
getTraitInt32
getTraitString
getTraitEncoded
getTrait
setTraitBoolean
setTraitEncoded
setTraitString 
setTraitReal64 
setTraitReal32 
setTraitInt32 
setTraitUInt32
setTraitInt16 
setTraitUInt16
setTraitUInt8 
setTraitInt64 
setTraitUInt64
setTrait
setTraitNullWithType setTraitNull
removeTraits2 removeTraits

 

Impact The renamed methods will fail to compile
Some unexpected implicit type conversions may occur
Recommended Action Search and replace old method names with new ones

Resolve undesirable implicit type-conversions:
If the calling code explicitly required invoking setInt64Attribute() but provided an FME_Int32 value, after renaming, the compiler will default to invoking an FME_Int32 overload of setAttribute(). In order to preserve setInt64Attribute() behaviour, the calling code must use static_cast<FME_Int64>(value) before providing the value to setAttribute()

 

fme::IFeature

list attribute handling

The following methods have been removed from the interface:

  • setListAttributeNonSequenced()
  • setEncodedListAttributeNonSequenced()


The following methods now supply non-sequenced attributes

  • setListAttribute()
  • setEncodedListAttribute()
Impact The removed list attribute methods will cause compilation errors
Recommended Action Replace all usages of setListAttributeNonSequenced() with setListAttribute()

Replace all usages of setEncodedListAttributeNonSequenced() with setEncodedListAttribute()

 

Several default parameter values have been removed from methods on fme::IFeature

Please refer to the table below for a complete list of affected methods, removed default values and their respective recommended replacements.

Method Removed default value(s) Recommended action
addCoordinate() const FME_Real64 xCoord = 0
const FME_Real64 yCoord = 0
const FME_Real64 zCoord = 0
Replace all values with 0.0
 
scale() const FME_Real64 scaleZ = 1.0 Replace with 1.0
offset() const FME_Real64 offsetZ = 0.0 Replace with 0.0
generatePointInPolygon() const FME_Boolean pretty = FME_FALSE Replace with FME_FALSE
splitAggregate() const FME_Boolean recurse = FME_FALSE Replace with FME_FALSE
makeDonuts() const FME_Boolean keepHoles = FME_FALSE Replace with FME_FALSE
getAllCoordinates() const FME_Real64* z = nullptr Replace with nullptr
addCoordinates() const FME_Real64* z = nullptr Replace with nullptr

 

Impact The removed default parameters will cause compilation errors requiring specification of the now missing method parameters
Recommended Action Provide appropriate parameter values per method based on the context and potentially the previous default value

 

fme::IString (formerly IFMEString) changes

operator=(const char*) return type has been changed from const char* to IString&
 

Old Name New Name
virtual const char* operator=(const char* stringValue) = 0; virtual IString& operator=(const char* stringValue) = 0;

 

Impact Compilation failures for callers of the operator
Recommended Action Explicitly call the .data() method on the returned IString to acquire const char*

Alternatively, continue using the new return type fme::IString


operator const char*() const has been removed. fme::IStirng can no longer be implicitly converted to const char*

Impact Implicit conversions to const char* will fail to compile
Recommended Action Explicitly call the fme::IString .data() method instead

 

fme::IStringArray (formerly IFMEStringArray) changes

const char* operator()(FME_UInt32 index) const has been removed.

Impact Compilation failures for callers of the operator
Recommended Action Explicitly invoke elementAt(#)->data() instead

Alternatively, continue using fme::IString returned by elementAt(#)

 

fme::IRectangle (formerly IFMERectangle) changes

The following methods have been removed from the fme::IRectangle interface:

  • clear()
  • contains()
Impact Compilation failures for callers of the removed methods
Recommended Action Usages of those methods do not fit the new ownership model of fme::IRectangle and therefore should be removed

  

fme::IRectangle operator| renamed

Old Name New Name
IRectangle& operator|(const IRectangle& other)  IRectangle& operator|=(const IRectangle& other)

 

Impact Compilation failures for callers of the removed methods
Recommended Action Replace existing operator| with operator|=

 

fme::IFeatureVector (formerly IFMEFeatureVector) changes

The following methods have been removed from the interface:

  • clear()
  • contains()

Additionally, fme::IFeatureVector documentation has been updated to explicitly indicate that the vector always explicitly owns the features that are inserted into the vector.

Impact Compilation failures for callers of the removed methods
Recommended Action Usages of those methods do not fit the new ownership model of fme::IFeatureVector and therefore should be removed

 

fme::IUniversalWriter (formerly IFMEUniversalWriter) and fme::IWriter (formerly IFMEWriter) changes

const have been removed from write() on both interfaces

Old Name New Name
virtual FME_MsgNum fme::IUniversalWriter::write(const IFeature&)  virtual FME_MsgNum fme::IUniversalWriter::write(IFeature&)
virtual FME_Status fme::IWriter::write(const IFeature&) virtual FME_Status fme::IWriter::write(IFeature&)

 

Impact Compilation failures for callers of the removed methods
Recommended Action Callers fme::IUniversalWriter::write() method should no longer expect const-correctness from the IFeature they’re providing
Implementers of fme::IWriter::write() may now modify the fme::IFeature provided by FME

 

fme::IAggregate (formerly IFMEAggregate) changes

The following methods have been removed from the interface:

  • getMultipleGeometryFlag()
  • setMultipleGeometryFlag()
Impact Compilation failures for callers of the removed methods
Recommended Action The callers of getMultipleGeometryFlag() should use
fme::IGeometryTools::hasMultipleGeometries()

The callers of setMultipleGeometryFlag() should use
fme::IGeometryTools::createMultipleGeometryFromAggregate() or
fme::IGeometryTools::createAggregateFromMultipleGeometry()

 

fme::IText (formerly IFMEText) changes

The following methods have been removed from the interface:

  • getTextString()
  • setTextString()
Impact Compilation failures for callers of the removed methods
Recommended Action The callers of getTextString() should use getTextStringAndEncoding() or getEncodedTextString() instead
The callers of setTextString() should use setEncodedTextString() instead

 

fme::IFeatureVectorOnDisk (formerly IFMEFeatureVectorOnDisk) changes

The following method have been renamed:

Old Method Name New Method Name
virtual FME_MsgNum fme::IUniversalWriter::write(const IFeature&)  virtual FME_MsgNum fme::IU

 

Impact Compilation failures for callers of the removed methods
Recommended Action Replace usages of the operator()(FME_UInt32) with getCopyAt(FME_UInt32)

 

fme::Boolean (formerly FME_Boolean) type change in fmetypes.h

fme::Boolean is no longer defined as an enum, it is now aliased to a standard C++ bool.

Impact Function overload sets that operate on both fme::Boolean and bool will no longer compile
Recommended Action Remove unnecessary overloads if fme::Boolean and bool overloads performed the same action

 

Integer type changes in fmetypes.h

fme::[U]Int## (formerly FME_[U]Int##) integer types are now aliased to standard C++ [u]int##_t types

Impact Code that uses fme::[U]Int## types interchangeably with other integer types may not work/compile properly
Recommended Action Consistently use fme::[U]Int## or [u]int##_t types when working with the FMEObjects API. Use other appropriate types when using other APIs

 

fme::Status (formerly FME_Status) and fme::MsgNum (formerly FME_MsgNum) change in fmetypes.h

fme::Status and fme::MsgNum are no longer aliased to the same integer type - they are now explicitly different (non-integer) types.

Impact Code which uses fme::Status and fme::MsgNum interchangeably will no longer compile
Recommended Action fme::Status and fme::MsgNum should not be used interchangeably. Converting from fme::MsgNum to fme::Status loses the potential error message number.
Use each type as required based on the return value of a called method

 

Impact Some compilers will produce warnings about extern “C” functions returning C++ types.
e.g. warning C4190: 'FME_initialize' has C-linkage specified, but returns UDT 'fme::v1_1::Status' which is incompatible with C`Visual Studio: C4190

Clang: -Wreturn-type-c-linkage
 
Recommended Action The FME SDK requires a C++ compiler and thus this class of warning is safe to ignore or suppress

 

Deprecated method removals

The following methods have been removed and should no longer be called
 

Affected class/enum Method(s) removed Legacy name
fme::IFeature unused bool parameter from setRejectionAttributes() bool setRejectedFlag = false
_deprecated_0_( hasRichGeometry()
fme::IFunction _exectue_deprecated() execute()
_inverse_depercated() inverse()
fme::IGeometryTools _deprecated_0_() createPointCloud()
_deprecated_1_() createPointCloudCopy()
_deprecated_2_() createPointCloudBlock()
setArcRotation() setArcRotation()
setArcPrimaryRadius() setArcPrimaryRadius()
setArcSecondaryRadius() setArcSecondaryRadius()
setArcSweepAngle() setArcSweepAngle()
fme::IPointCloud _destroy_Deprecated() destroy()
fme::IRaster _destroy_Deprecated() destroy()
fme::IFeatureTable _destroy_Deprecated() destroy()
fme::IFeatureTableTools _deprecated_0_() createEntangledAttribute()
_deprecated_1_() entangleAttributes()
fme::IFace isPlanar_deprecated() isPlanar()
enum fme::ServiceID FME_DEPRECATED_1 FME_SERV_LINEPOLYBUILDER
FME_DEPRECATED_2 FME_SERV_INTCARD
fme::IDevFactory id() id()
fme::IFunction id() id()
fme::IReader id() id()
fme::IWriter id() id()
_startTransaction_deprecated() startTransaction()
_commitTransaction_deprecated() commitTransaction()
_rollbackTransaction_deprecated() rollbackTransaction()
fme::ILogFile activityMessage() has been removed. Use logMessageString(..., FME_STATUSREPORT) instead activityMessage()

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.