wvandamm Posted November 25, 2019 Report Share Posted November 25, 2019 Hi, In my model I would like to have a module for which the number of parameters is variable i.e. I would like to have a vector of cci_parameters, or a cci_parameter which contains a vector of cci_values. I read the following in the specification in section "5.5.2 cci_value": Quote The cci_value class shall provide a variant type for exchanging configuration parameter values. The following types are supported: •User-specific data types, supported by implementing the helper template class cci_value_converter<T>(which is also the mechanism by which the C++ and SystemC data types are supported) •C++ arrays and std::vector<> of any supported data type, converting to a cci_value_list. •Lists (vectors) of cci_value, represented as cci_value_list. •String-keyed maps of cci_value, represented as cci_value_map. This seemed to imply to me that it is possible to have a cci_param which contains a cci_value_list or cci_value_map with entries that are cci_values and hence have individual handles. This is exacly what I'm looking for. However, I have no clue how to use it. :-) For example doing the following (in analogy to the usage of custom types in Annex D) results in a compiler error: cci::cci_value_map testmap; cci::cci_param<cci::cci_value_map> myparam("paramname", testmap); How could I get this to work? Or should I resort to writing my own custom type? Thanks! Wim Quote Link to comment Share on other sites More sharing options...
twieman Posted November 27, 2019 Report Share Posted November 27, 2019 This should work. Your attempt is consistent with the example in the specification (early in Section 5.54). BTW, cci_value_map is used internal to cci_param_untyped as a holder for the metadata, which is exercised in Example #7. Please provide your compiler error to aid diagnosis. Quote Link to comment Share on other sites More sharing options...
wvandamm Posted November 28, 2019 Author Report Share Posted November 28, 2019 Hi, Thanks for the feedback. With the above 2 lines of code I get following compiler errors: cci-1.0.0/src/cci_cfg/cci_param_typed.h:760:40: error: no matching function for call to cci::cci_value::get() const cci-1.0.0/src/cci_core/cci_value.h:200:27: error: no type named type in struct cci::cci_value_converter<cci::cci_value_map> cci-1.0.0/src/cci_cfg/cci_param_typed.h:809:5: error: no matching function for call to cci::cci_value::try_get(cci::cci_value_map&) cci-1.0.0/src/cci_core/cci_value.h:192:8: error: no type named type in struct cci::cci_value_converter<cci::cci_value_map> cci-1.0.0/src/cci_cfg/cci_param_typed.h:769:48: error: no matching function for call to ‘cci::cci_value::get() const cci-1.0.0/src/cci_core/cci_value.h:200:27: error: no type named type in struct cci::cci_value_converter<cci::cci_value_map> Cheers, Wim Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted November 28, 2019 Report Share Posted November 28, 2019 Hi Wim, On 11/25/2019 at 5:41 PM, wvandamm said: This seemed to imply to me that it is possible to have a cci_param which contains a cci_value_list or cci_value_map with entries that are cci_values and hence have individual handles Currently, cci_param<T> indeed does not support any of cci_value, cci_value_list, cci_value_map as value type T. The main reason is, that it would otherwise cause ambiguities in the API of cci_value(_list,_map) itself, if the generic conversion functions (which are used by cci_param internally) would support this. However, it might be possible to extend cci_param<T> to support this scenario explicitly. Greetings from Duisburg, Philipp Quote Link to comment Share on other sites More sharing options...
wvandamm Posted December 4, 2019 Author Report Share Posted December 4, 2019 Okay, good to know. Thanks for the feedback! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.