Solved: Exposition of a getter returning SBHashMap



  • 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.


Log in to reply
 

Looks like your connection to SAMSON Connect - Forum was lost, please wait while we try to reconnect.