Rss Categories

Creating, Copying, and Releasing a LVParseTree Handle

Reference Number: AA-00953 Views: 2986 0 Rating/ Voters

LVParseTree objects are fully copyable and assignable.


  • H_PARSE_TREE LVParseTree_Create()

    H_PARSE_TREE LVParseTree_CreateFromCopy(H_PARSE_TREE Other)

    void LVParseTree_Copy(H_PARSE_TREE Tree, H_PARSE_TREE Other)

    void LVParseTree_Release(H_PARSE_TREE Tree)



A handle to a parse tree being released or copied into


A handle to a parse tree being copied.


CreateFromCopy and Copy both perform deep copies on the handles in question. Both handles will have to be released after either function call to release all allocated memory. Tree handles given to the user via LV_SRE_CreateParseTree must also be released.


C Code

  1. HPORT Port;
  2. int VOICECHANNEL = 1;

  3. // Open the port and do a decode
  4. // ...
  5. // When the decode is finished, grab a parse tree handle

  6. // Here, we create an empty handle. This is useful if you want to declare
  7. // your parse tree outside of any function.

  8. H_PARSE_TREE Tree = LVParseTree_Create();

  9. // Now, use the LV_SRE function to fill in the information.

  10. Tree = LV_SRE_CreateParseTree(Port, VOICECHANNEL, 1);

  11. // secondTree will have all of the same attributes as Tree.

  12. H_PARSE_TREE secondTree = LVParseTree_CreateFromCopy(Tree);

  13. // Alternatively, we could use the create function to break this up into
  14. // two steps. Remember that the first argument is the destination tree,
  15. // and the second one is the tree from which we are copying information.

  16. H_PARSE_TREE thirdTree = LVParseTree_Create();
  17. LVParseTree_Copy(thirdTree, Tree);

  18. // After you are done using the parse trees, make sure to delete all
  19. // trees created throughout the program.

  20. LVParseTree_Release(Tree);
  21. LVParseTree_Release(secondTree);
  22. LVParseTree_Release(thirdTree);

See Also