297 | | |
| 297 | ==== Copy Function ==== |
| 298 | |
| 299 | The actual process of copying or cloning individual non SchemaElement objects within the FDO API shall be accomplished with the addition of a standard Copy method as opposed to a !DeepCopy method. |
| 300 | |
| 301 | The following Copy method will be added to the set of FDO API classes’ listed n section 2.3.2. |
| 302 | |
| 303 | |
| 304 | {{{ |
| 305 | /// \brief |
| 306 | /// copy this instance of class Fdo[ClassName]. |
| 307 | /// |
| 308 | /// \return |
| 309 | /// Returns a newly created instance of class Fdo[ClassName] |
| 310 | /// |
| 311 | FDO_API virtual Fdo[ClassName]* Copy( void ); |
| 312 | }}} |
| 313 | |
| 314 | The following list of classes will have a Copy function (As defined in section 2.3.1) added to their class definition. |
| 315 | |
| 316 | |
| 317 | {{{ |
| 318 | FdoCLOBValue |
| 319 | FdoComputedIdentifier |
| 320 | FdoComparisonCondition |
| 321 | FdoBinaryLogicalOperator |
| 322 | FdoBinaryExpression |
| 323 | FdoBLOBValue |
| 324 | FdoBooleanValue |
| 325 | FdoByteValue |
| 326 | FdoDataValue |
| 327 | FdoDataValueCollection |
| 328 | FdoDateTimeValue |
| 329 | FdoDecimalValue |
| 330 | FdoDistanceCondition |
| 331 | FdoDoubleValue |
| 332 | FdoExpression |
| 333 | FdoExpressionCollection |
| 334 | FdoFilter |
| 335 | FdoFunction |
| 336 | FdoGeometryValue |
| 337 | FdoGeometricCondition |
| 338 | FdoInt16Value |
| 339 | FdoInt32Value |
| 340 | FdoInt64Value |
| 341 | FdoIdentifier |
| 342 | FdoInCondition |
| 343 | FdoLogicalOperator |
| 344 | FdoNullCondition |
| 345 | FdoParameter |
| 346 | FdoPropertyValueConstraint |
| 347 | FdoPropertyValueConstraintRange |
| 348 | FdoPropertyValueConstraintList |
| 349 | FdoRasterDataModel |
| 350 | FdoSearchCondition |
| 351 | FdoSchemaAttributeDictionary |
| 352 | FdoSingleValue |
| 353 | FdoSpatialCondition |
| 354 | FdoStringValue |
| 355 | FdoUnaryExpression |
| 356 | FdoUnaryLogicalOperator |
| 357 | FdoUniqueConstraint |
| 358 | FdoUniqueConstraintCollection |
| 359 | FdoValueExpression |
| 360 | FdoValueExpressionCollection |
| 361 | }}} |
| 362 | |
| 363 | NOTE: This list may have to be expanded depending on additional requirements |
| 364 | |
| 365 | ===== Example Implementation ===== |
| 366 | |
| 367 | The following example demonstrates how the Copy method might be implemented for class FdoCLOBValue class. |
| 368 | |
| 369 | |
| 370 | {{{ |
| 371 | FdoCLOBValue* FdoCLOBValue::Copy( void ) |
| 372 | { |
| 373 | FdoPtr<FdoCLOBValue> clone = FdoCLOBValue::Create();; |
| 374 | if (IsNull()) |
| 375 | { |
| 376 | clone->SetNull(); |
| 377 | } |
| 378 | else |
| 379 | { |
| 380 | FdoPtr<FdoByteArray> sourceData = GetData(); |
| 381 | |
| 382 | FdoInt32 count = sourceData->GetCount() |
| 383 | FdoByteArray* ba = sourceData->GetData(); |
| 384 | |
| 385 | FdoPtr<FdoByteArray> clonedArray = FdoByteArray::Create(ba, count); |
| 386 | clone->SetData(clonedArray); |
| 387 | } |
| 388 | |
| 389 | return FDO_SAFE_ADDREF(clone.p); |
| 390 | } |
| 391 | }}} |
| 392 | |