SAMSON Forum
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • SAMSON Connect
    • Get SAMSON

    Solved: Exposition of a getter returning SBHashMap

    Editors
    1
    1
    1750
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Yassine
      Yassine last edited by Yassine

      Hi everyone,

      I had an issue that Stephane and my self managed to solve so I post the fix here because it might be useful for other people that could face the same error.

      So, I have an importer where I store an SBHashMap and I wanted to expose the getter returning this SBHashMap. To do so, I added the following line to the descriptor of my importer like it is supposed to be done for functions exposition:

      SB_INTERFACE_BEGIN;
      
      SB_STATIC_FUNCTION_0(SBHashMap<CustomClass1*, CustomClass2*>*, SECustomImporter, getHashMap);
      
      SB_INTERFACE_END;
      
      

      But it was not compiling and it was throwing errors saying that the number of arguments of SB_STATIC_FUNCTION_0 was not sufficient. This error might be due to the SBHashMap macro which was not unfolded in a good way.

      To fix this error we tried to typedef the SBHashMap<CustomClass1*, CustomClass2*> before exposing it like this:

      typedef SBHashMap<CustomClass1*, CustomClass2*> CustomHashMap;
      SB_REGISTER_TYPE(CustomHashMap, "CustomHashMap", "c5e7844d-1788-41ac-872d-e3d3e9a3c768")
      

      As you can see we also registered this now object in the second line using SB_REGISTER_TYPE. Then we modified the exposition like this:

      SB_INTERFACE_BEGIN;
      
      SB_STATIC_FUNCTION_0(CustomHashMap*, SECustomImporter, getHashMap);
      
      SB_INTERFACE_END;
      

      This worked perfectly ! If you have troubles with this fix do not hesitate to reply to this post.

      1 Reply Last reply Reply Quote 1
      • First post
        Last post